This article contains a sample script for creating two line/scatter plots on the same graph and altering the properties of one.
To run this script:
- Copy the script below or download the attached BAS file: Two Line Plot Graph.bas
- Open Grapher and turn on the Script Manager by clicking View | Display | Script Manager.
- Press Ctrl+A to select all of the existing lines in the Script Manager and then press DELETE.
- Press Ctrl+V to paste it into the Script Manager.
- Click the green arrow Start/Resume icon in the Script Manager.
Sub Main 'Initialize Grapher Dim GrapherApp, Plot, Graph1, ScatterPlot As Object Set GrapherApp = CreateObject("Grapher.Application") GrapherApp.Visible = True Set Plot = GrapherApp.Documents.Add(grfPlotDoc) 'Create a line plot Set Graph1 = Plot.Shapes.AddLinePlotGraph(GrapherApp.Path+"\samples\tutorial.dat") 'Add a line plot to the graph Graph1.AddLinePlot(GrapherApp.Path+"\samples\tutorial.dat", 1, 3) 'Change the first plot to a scatter plot Set ScatterPlot = Graph1.Plots.Item(1) ScatterPlot.symbolFreq = 1 ScatterPlot.line.style("invisible") 'Set the symbol properties for the scatter plot ScatterPlot.symbol.Index = 38 ScatterPlot.symbol.size = 0.35 ScatterPlot.symbol.color = RGB(255,0,0) ScatterPlot.symbol.lineColor = grfColorBlue End Sub
Updated March 12, 2020
Comments
Please sign in to leave a comment.