How do I create a 3D bubble plot in Grapher with a script?

This article contains Grapher sample script that shows how to create a 3D bubble plot and how to change all the methods and properties.


To run this script:

  1. Copy the script below, or click here to download the BAS file: Auto3DBubblePlot.BAS
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Grapher 13.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
  6. Click Script | Run to run the script.


  1. Copy the script below.
  2. Open Grapher and turn on the Script Manager by clicking View | Display | Script Manager.
  3. Press Ctrl+A to select all of the existing lines in the Script Manager and then press DELETE.
  4. Press Ctrl+V to paste it into the Script Manager.
  5. Click the Start/Resume icon () in the Script Manager.


Sub Main
'This script shows all the methods and properties of a 3D XyZ bubble plot

'Declares GrapherApp as an object
 Dim GrapherApp As Object

'Creates an instance of the Grapher Application
'object and assigns it to the variable named "GrapherApp"
 Set GrapherApp = CreateObject("Grapher.Application")

'Makes Grapher visible
 GrapherApp.Visible = True

'Declares Plot as an object
 Dim Plot As Object

'Creates a plot document in Grapher and assigns
'it to the variable named "Plot"
 Set Plot = GrapherApp.Documents.Add(grfPlotDoc)

'Declares Shapes as an object
 Dim Shapes As Object

'Assigns the AutoShapes collection to the
'variable named "Shapes"
 Set Shapes = Plot.Shapes

'Declares XYZBubbleGraph as an object
 Dim XYZBubbleGraph As Object

'Creates a graph and assigns it to the
'variable named "XYZBubbleGraph"
 Set XYZBubbleGraph = Shapes.Add3DBubblePlotGraph(GrapherApp.Path + "\samples\bar chart orientations.dat")

'Declare XYZBubblePlot as an object
 Dim XYZBubblePlot As Object

'Set XYZBubblePlot to the first line plot on the XYZBubbleGraph graph
 Set XYZBubblePlot = XYZBubbleGraph.Plots.Item(1)

'Auto3DBubblePlot properties

'Get current RadiusRange type
 Debug.Print "RadiusRange = "; XYZBubblePlot.RadiusRange

'Set RadiusRange to "Use fixed range"
 XYZBubblePlot.RadiusRange = grfUseFixedRange
 XYZBubblePlot.sizeCol = 3

'Get minimum range value
 Debug.Print "RadiusRangeMin = "; XYZBubblePlot.RadiusRangeMin

'Set minimum range value
 XYZBubblePlot.RadiusRangeMin = 1

'Get maximum range value
 Debug.Print "RadiusRangeMax = "; XYZBubblePlot.RadiusRangeMax

'Set maximum range value
 XYZBubblePlot.RadiusRangeMax = 30

'Get bubble X rotation
 Debug.Print "Bubble X rotation = "; XYZBubblePlot.BubbleXRot

'Set bubble X rotation to 30 degrees
 XYZBubblePlot.BubbleXRot = 30

'Get bubble Y rotation
 Debug.Print "Bubble Y rotation = "; XYZBubblePlot.BubbleYRot

'Set bubble Y rotation to 75 degrees
 XYZBubblePlot.BubbleYRot = 75

'Get current draw method
 Debug.Print "Draw method = "; XYZBubblePlot.DrawMethod

'Set draw method to wire frame 1
 XYZBubblePlot.DrawMethod = grfWireFrame1

'Get wire frame fill color
 Debug.Print "Fill color = "; XYZBubblePlot.FillColor

'Set wire frame fill color to blue
 XYZBubblePlot.FillColor = grfColorBlue

'Get wire frame line color
 Debug.Print "Line color = "; XYZBubblePlot.lineColor

'Set wireframe line color to green
 XYZBubblePlot.lineColor = grfColorGreen

'Return line count
 Debug.Print "Line count = "; XYZBubblePlot.LineCount

'Set line count to 10
 XYZBubblePlot.LineCount = 10

'Get gradient fill detail
 XYZBubblePlot.DrawMethod = grfGradient
 Debug.Print "Gradient detail = "; XYZBubblePlot.GradDetail

'Set "Gradient detail" to 50
 XYZBubblePlot.GradDetail = 50

'Return size column
 Debug.Print "Size column = "; XYZBubblePlot.sizeCol

'Change size column
 XYZBubblePlot.RadiusRange = grfUseDataRange
 XYZBubblePlot.sizeCol = 3

'Return bubble minimum radius
 Debug.Print "Minimum radius = "; XYZBubblePlot.BubbleMin

'Set minimum bubble radius to 0.1
 XYZBubblePlot.BubbleMin = 0.10

'Return bubble maximum radius
 Debug.Print "Maximum radius = "; XYZBubblePlot.BubbleMax

'Set maximum bubble radius to 0.6
 XYZBubblePlot.BubbleMax = 0.6

'Auto3DBubblePlot method

'Set the bubble plot gradient fill color
 XYZBubblePlot.LoadColorMap(GrapherApp.Path + "\Color Scales\ChromaDepth.clr")

End Sub


Updated September 24, 2018

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.