These IronPython scripts below show how to modify any of the Heat Map visualization settings found on the X-Axis tab of the Heat Map 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 Heat Map X-Axis Tab Options:

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

  1. Change the x-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 top or bottom

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.XAxis.Expression = "<[My Column]>"

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

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

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

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

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

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

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

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

# 10. Set axis position to top or bottom
myVis.XAxis.Scale.Dock = ScaleDock.Far  #Top
# OR
myVis.XAxis.Scale.Dock = ScaleDock.Near  #Bottom

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

If you have any questions, comments, or ideas, feel free to get in touch!