Shinya Ito Posted April 3, 2020 Share Posted April 3, 2020 Hi, Sorry to ask such a basic question, but could you tell me how to set favorite colors to specific columns in a scatter plot in TIBCO Spotfire using IronPython scripting For example, when I make a scatter plot with X-axis of measurement date and Y-axis of 3 measured data of average, minimum, maximum, I want to assign green to average, blue to minimum, and red to maximum. But I don't know how to desribeit. When I set colors to columns automatically, I know a following script. But I dont want to use this now. from Spotfire.Dxp.Application.Visuals import * vis = vis.As[scatterPlot]() vis.ShapeAxis.Expression = '' Thanks a lot. Shinya Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted April 3, 2020 Share Posted April 3, 2020 check the following script for reference, https://community.spotfire.com/wiki/ironpython-script-bar-chart-colouring Link to comment Share on other sites More sharing options...
Shinya Ito Posted April 4, 2020 Author Share Posted April 4, 2020 Hi Shandilyasan,Thank you for your help, but I could not apply the sample of Bar chart to my case simply. I found out that Id written an appropriate example in my question. Im so sorry. I want to make a following scatter plot. I dont use Trellis. X-axis: Date Y-axis: Measured value for 3 samples (A,B, and C) Data is a table like below. Sample Date Measured value A A A B B B C C C I want to assign specific 3 colors to each sample (A is red, B is blue, and C is Yellow). How should I describe thatThanks a lot.Shinya Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted April 6, 2020 Share Posted April 6, 2020 Can you try the following, from Spotfire.Dxp.Application.Visuals import CategoryKey from System.Drawing import Color from System.Collections.Generic import List from Spotfire.Dxp.Framework.Library import * #add a script parameter schart referring to your visualization chart=schart.As[LineChart]() chart.ColorAxis.Expression = "Sample" #Get Categories based on expression keys=List[CategoryKey]() keys=chart.ColorAxis.Coloring.AddCategoricalColorRule().GetExplicitCategories() #Add colors to each category chart.ColorAxis.Coloring.SetColorForCategory(keys[0], Color.FromName("Red")) chart.ColorAxis.Coloring.SetColorForCategory(keys[1], Color.FromName("Blue")) chart.ColorAxis.Coloring.SetColorForCategory(keys[2], Color.FromName("Yellow")) Link to comment Share on other sites More sharing options...
Shinya Ito Posted April 8, 2020 Author Share Posted April 8, 2020 Thank you very much for your useful advice. I did it! Link to comment Share on other sites More sharing options...
GURUPRASATH T V Posted May 25, 2023 Share Posted May 25, 2023 How to set categorical option in x-axis in scatter plot in Spotfire through iron python????please share the reference how to do. Link to comment Share on other sites More sharing options...
Jose Leviaguirre Posted May 29, 2023 Share Posted May 29, 2023 Here is an example on how to toggle from categorical to continuous.from Spotfire.Dxp.Application.Visuals import Axis, LineChart, AxisModevis = vis.As[LineChart]()expr = vis.XAxis.Expression if vis.XAxis.AxisMode == AxisMode.Continuous: vis.XAxis.Expression = "<" + expr + ">"else: vis.XAxis.Expression = expr[1:-1]Now if you want to cycle through the category modes: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 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