Jump to content

Iron Python - Changing scatter plot point colors for categorical values, with a saved color scheme from library.

Mark Lewis 2

Recommended Posts


I am trying to change the color of points in a scatter plot with Iron Python. Preferably for categorical values - with a saved color scheme from library.

I looked at the Spotfire online refence, it seemed incomplete on this topic, and lacked examples.

I believe it is possible to do this, but please can somone provide a short Iron Python example of how this might be achieved.



Link to comment
Share on other sites

to set the colour of an axis according to a named colour scheme:

from Spotfire.Dxp.Application import *from Spotfire.Dxp.Application.Visuals import *vc = vc.As[VisualContent]()vc.ColorAxis.Coloring.Apply("name of your colour scheme")

where vc is an input parameter of type Visualization.

If you want to create a colour scheme for a particular column and use it every time that column is used in a plot, an easier way would be to assign that colour scheme to your column via: Data > Column Properties > select your column > Properties, then go down to DefaultContinuousColorScheme and/or DefaultCategoricalColorScheme and edit them, putting the name of your desired scheme there. It avoids scripting.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...