Y-Axis

These IronPython scripts below show how to modify any of the Heat Map visualization settings found on the Y-Axis tab of the Heat Map Properties dialog box in the Spotfire user interface.
Note

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 Heat Map Y-Axis Tab Options:

This IronPython script shows how to change the following options, in order from top-left to bottom-right on the y-axis tab in the Spotfire user interface:

  1. Change the y-axis expression
  2. Set the range min and max
  3. Include origin
  4. Show zoom slider
  5. Show gridlines
  6. Reverse scale
  7. Show (or hide) scale labels
  8. Show labels horizontally or vertically
  9. Set max number of labels
  10. Set axis position to left or right
Note

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.

from Spotfire.Dxp.Application.Visuals import *

myVis = myVis.As[Visualization]()

# 1. Change the axis expression
myVis.YAxis.Expression = "<[My Column]>"

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

# 3. Include origin
myVis.YAxis.IncludeZeroInAutoZoom = True

# 4. Show zoom slider
myVis.YAxis.ManualZoom = True

# 5. Show gridlines
myVis.YAxis.Scale.ShowGridlines = True

# 6. Reverse scale
myVis.YAxis.Reversed = True
# Note: If axis is reversed, be sure to reverse AxisRange in #2 above as well

# 7. Show (or hide) scale labels
myVis.YAxis.Scale.ShowLabels = True

# 8. Show labels horizontally or vertically
myVis.YAxis.Scale.LabelOrientation = LabelOrientation.Horizontal
# OR
myVis.YAxis.Scale.LabelOrientation = LabelOrientation.Vertical

# 9. Set max number of labels
# To check the "Max number of labels" checkbox and set the number:
myVis.YAxis.Scale.LabelLayout = ScaleLabelLayout.MaximumNumberOfTicks
myVis.YAxis.Scale.MaximumNumberOfTicks = 15
# OR
# To un-check the "Max number of labels" checkbox and ignore the number:
myVis.YAxis.Scale.LabelLayout = ScaleLabelLayout.Automatic

# 10. Set axis position to left or right
myVis.YAxis.Scale.Dock = ScaleDock.Near  #Left
# OR
myVis.YAxis.Scale.Dock = ScaleDock.Far  #Right
Welcome!

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