These IronPython scripts below show how to modify any of the Scatter Plot visualization settings found on the Size tab of the Scatter Plot Properties dialog box in the Spotfire user interface.

In each of the scripts below, it is assumed that the MyVis variable references the targeted visualization. See here for more information about referencing visualizations.

Change Scatter Plot Size Tab Options:

  1. Change the marker size (move the slider)
  2. Change the “Size by” custom expression
  3. Set the size scale min and max limit
from Spotfire.Dxp.Application.Visuals import *

myVis = myVis.As[Visualization]()

# 1. Change the marker size
myVis.MarkerSize = 5  #Valid range is 0 to 100
# From the Spotfire API Docs:
# The size is expressed in percent of the height or width of the plot. 
# A value of 100 means that a marker will occupy the full height or 
# width of the plot (whichever is smallest).

# 2. Change the "Size by" custom expression
myVis.SizeAxis.Expression = "Avg([Column 1])"

# 3. Set the size scale min and max limit
# Enter as AxisRange([minimum], [maximum]) to set the range
myVis.SizeAxis.Range = AxisRange(-50, 250)
# OR
# Enter None keyword to set either end of the range back to "Automatic"
myVis.SizeAxis.Range = AxisRange(None, None)

If you aren't sure how to write a specific custom expression correctly from scratch, start by building the expression interactively using the Spotfire user interface. Once your custom expression is working correctly, right-click on the custom expression input box selector(s) and choose Custom Expression. You can then copy the expression shown into your IronPython script.


The purpose of this website is to provide a comprehensive, accurate, and efficient IronPython reference for Spotfire developers.