-
Notifications
You must be signed in to change notification settings - Fork 3
Graphs
Graphs are used to display information on a two-dimensional Cartesian graph.
To produce a graph with plotted data requires three steps in GlowScript:
- Create a graph display, or graphic space with axes and labels
- Create a series (in the form of a curve or sequence of dots) to represent the data
- Plot the data
First, click on the graph display block and drag it into the workspace.
The graph display block is pre-loaded with a graph block, since the graph display will not appear until some data is plotted on a graph.
Next, click on the (+) sign to see the menu of attributes for the graph display.
Drag the attributes that you would like to edit over into the white space beneath display and attach them to the bottom of the chain. In this example, all of the attributes have been brought over to illustrate the default values for the attributes.
The series block has a drop-down menu that shows two options for the line style of the graph: curve and dots.
On the far right end is also a color picker that can be used to select the color for the individual graph. White is the default but is not recommended, as the background color for the graph display is also white.
The plot block has two main components:
- Two number inputs for the x and y values that will be plotted
- A drop-down menu for selecting the graph on which the data will be plotted. This menu is auto-populated with the graphs that the user has already created.
In this example, the user has already created four graphs: MyGraph1, MyGraph2, MyGraph3, and MyGraph4.
To plot multiple points on one graph, either use multiple plot blocks:
or use a loop:
Additional series blocks can be added underneath the series block that was included in the graph display block, if the user wants to display more than one graph on one set of axes.
In this example, two displays will be created, "MyGraphPaperA" and "MyGraphPaperB", with two graphs on A, and two more graphs on B.