GURUPRASATH T V Posted May 25, 2023 Share Posted May 25, 2023 please share the reference how to do. Link to comment Share on other sites More sharing options...
Gaia Paolini Posted May 26, 2023 Share Posted May 26, 2023 There is a useful website with advice for similar things:https://www.sf-ref.com/ironpython/visualizations/scatter-plot/y-axis/However I did not find there a direct answer to your question, but I think it helps formulating one.The difference between treating an axis as categorical or continuous is simply the presence on triangular brackets < > around the axis expression (you can verify it if you right-click on the axis drop-down and choose Custom Expression to get to the expression editor.So the script below would toggle between categorical and continuous by simply detecting the brackets and adding them if they are not there, removing them if they are. You can tailor it to your needs.It assumes that myVis is an input variable of type Visualization.from Spotfire.Dxp.Application.Visuals import * myVis = myVis.As[Visualization]()expr= myVis.XAxis.Expression if expr[0]=='<': myVis.XAxis.Expression = expr[1:-1]else: myVis.XAxis.Expression = '<'+expr+'>' Link to comment Share on other sites More sharing options...
Gaia Paolini Posted May 26, 2023 Share Posted May 26, 2023 but now I suspect I misunderstood your question, and it refers to the setting of categorical hierarchies? Link to comment Share on other sites More sharing options...
Gaia Paolini Posted May 26, 2023 Share Posted May 26, 2023 Using a similar reasoning, the difference between the two XAxis expressions is NEST vs CROSS in the expression:from Spotfire.Dxp.Application.Visuals import * myVis = myVis.As[Visualization]()expr= myVis.XAxis.Expression if 'NEST' in expr: myVis.XAxis.Expression =expr.replace('NEST','CROSS')if 'CROSS' in expr: myVis.XAxis.Expression =expr.replace('CROSS','NEST') Link to comment Share on other sites More sharing options...
GURUPRASATH T V Posted May 26, 2023 Author Share Posted May 26, 2023 Hi Gaia, Thank you for response I would try this code. I'm can not able to add the column in x-axis in programmatically , I need to add multiple column in x axis and y axis through iron python program.....And, I add screenshot for your reference in this picture, Now I add the column in manually. But, I need to automate through iron python. can you please share your option on this??? from Spotfire.Dxp.Application.Visuals import * myVis = myVis.As[Visualization]()expr= myVis.XAxis.Expression if expr[0]=='<': myVis.XAxis.Expression = expr[1:-1]else: myVis.XAxis.Expression = '<'+expr+'>' Link to comment Share on other sites More sharing options...
Gaia Paolini Posted May 26, 2023 Share Posted May 26, 2023 Is your question about how to build a scatterplot programmatically? Can you elaborate a bit on your process?I.e. you have a starting scatterplot with some X and Y axis definedyou want a script to change the X and Y dynamically?Otherwise, why would you need a script to add X and Y columns? Link to comment Share on other sites More sharing options...
GURUPRASATH T V Posted May 26, 2023 Author Share Posted May 26, 2023 No, Gaia actually i need to add other column value in both x-axis and y-axis.For example you add means your x axis scale also added. now every thing I do manually actually i need automate this.... Link to comment Share on other sites More sharing options...
Gaia Paolini Posted May 26, 2023 Share Posted May 26, 2023 can you verify my understanding: you want a button that :takes in a single column name (presumably from a document property)adds this column to pre-existing (assuming categorical) X and Y axessets the categorical type to what? NEST or CROSS? Link to comment Share on other sites More sharing options...
GURUPRASATH T V Posted May 26, 2023 Author Share Posted May 26, 2023 Hi Gaia ,Now, I am write this script to automate the scatter plot to add the multiple column in x and y axis but can not able to get the output. script is run there is no error show in error console window.from Spotfire.Dxp.Application.Visuals import *from Spotfire.Dxp.Application.Visuals import ScatterPlotScatterPlot = Document.ActivePageReference.Visuals.AddNew[scatterPlot]()ScatterPlot.AutoConfigure()ScatterPlot.Title = 'PSRR_Measure'ScatterPlot.ShowDescription = TrueScatterPlot.Description = 'This Plot Repected by PSRR VS SUPPLY how the data will scatter'ScatterPlot.XAxis.Expression = "[supply_v]"ScatterPlot.XAxis.Range = AxisRange(50, 250)ScatterPlot.XAxis.Range = AxisRange(None, None)ScatterPlot.XAxis.IncludeZeroInAutoZoom = TrueScatterPlot.XAxis.ManualZoom = TrueScatterPlot.XAxis.Scale.ShowGridlines = TrueScatterPlot.XAxis.TransformType = AxisTransformType.Log10 #CheckedScatterPlot.XAxis.TransformType = AxisTransformType.None #Un-checkedScatterPlot.XAxis.Scale.LabelOrientation = LabelOrientation.HorizontalScatterPlot.XAxis.Scale.LabelOrientation = LabelOrientation.VerticalScatterPlot.XAxis.Scale.LabelLayout = ScaleLabelLayout.MaximumNumberOfTicksScatterPlot.XAxis.Scale.MaximumNumberOfTicks = 15ScatterPlot.XAxis.Scale.LabelLayout = ScaleLabelLayout.Automaticexpr = ScatterPlot.YAxis.Expression if expr[0]=='<': ScatterPlot.YAxis.Expression = expr[1:-1]else: ScatterPlot.YAxis.Expression = '<'+expr+'>'ScatterPlot.YAxis.Expression = "[DUT_ID], [time]"ScatterPlot.YAxis.IndividualScaling = TrueScatterPlot.YAxis.IndividualScalingMode = IndividualScalingMode.ColorScatterPlot.YAxis.IndividualScalingMode = IndividualScalingMode.TrellisScatterPlot.YAxis.ManualZoom = TrueScatterPlot.YAxis.IndexedRange["[DUT_ID]"] = AxisRange(50, 250)ScatterPlot.YAxis.IndexedRange["[time]"] = AxisRange(-100, 150)ScatterPlot.YAxis.IndexedRange["[DUT_ID]"] = AxisRange(None, None)ScatterPlot.YAxis.IndexedIncludeZeroInAutoZoom["[DUT_ID]"] = TrueScatterPlot.YAxis.IndexedIncludeZeroInAutoZoom["[time]"] = False Link to comment Share on other sites More sharing options...
Gaia Paolini Posted May 26, 2023 Share Posted May 26, 2023 can you not try the error's "suggestion" to color by (Column Names) and see if that gives you a plot?Then you can put something like this in the script: here Axis.Default.Names is the expression you get when you manually specify to color by (Column Names)myVis.ColorAxis.Expression = "<[Axis.Default.Names]>" Link to comment Share on other sites More sharing options...
GURUPRASATH T V Posted May 29, 2023 Author Share Posted May 29, 2023 Hi Gaia,Thank you for suggestion this script line is working fine but how, I add multiple column name in x axis also ??? Link to comment Share on other sites More sharing options...
GURUPRASATH T V Posted May 29, 2023 Author Share Posted May 29, 2023 Hi Gaia,Can you share any reference study notes material about Tibco Spotfire Iron Python Automation. It will be great helpful for me. Link to comment Share on other sites More sharing options...
Gaia Paolini Posted May 30, 2023 Share Posted May 30, 2023 There is a page with Iron Python resources that should help you:https://community.spotfire.com/s/article/IronPython-Scripting-in-TIBCO-Spotfire Link to comment Share on other sites More sharing options...
Jose Leviaguirre Posted May 30, 2023 Share Posted May 30, 2023 Hello Guruprasath. To reply your original question, here is an example on how to toggle from categorical to continuous. vis from Spotfire.Dxp.Application.Visuals import Axis, ScatterPlot, AxisMode //vis is a scatter plot visualization script parametervis = vis.As[scatterPlot]() if vis.XAxis.AxisMode == AxisMode.Continuous: vis.XAxis.Expression = "<" + vis.XAxis.Expression + ">"else: vis.XAxis.Expression = vis.XAxis.Expression[1:-1]And here is an example on how to cycle through categorical modes (show all values, show filtered values, show filtered range)from Spotfire.Dxp.Application.Visuals import Axis, LineChart, AxisMode, CategoryMode vis = vis.As[LineChart]()axis = vis.XAxis if axis.AxisMode == AxisMode.Categorical: if axis.CategoryMode == CategoryMode.ShowAll: axis.CategoryMode = CategoryMode.ShowFiltered elif axis.CategoryMode == CategoryMode.ShowFiltered: axis.CategoryMode = CategoryMode.ShowFilteredRange else: axis.CategoryMode = CategoryMode.ShowAll print axis.CategoryMode If you have a different question that is not related to the original question, I encourage you to create a new question for a faster and more accurate response. The accuracy of the answer depends on the amount of details of your question. Please keep the questions clear and concise. Link to comment Share on other sites More sharing options...
GURUPRASATH T V Posted May 31, 2023 Author Share Posted May 31, 2023 Hello Jose, Thank you for reply, Still I have some more question to ask. Now I Know how to enable categorical modes in python scripts. Actually my question is how to select the multiple column in X-Axis through python ??? Please refer the given below image now I Select the multiple column in x axis this one now I do manually but I need to automate through python.. Can you please suggest how to do Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now