Scatter Plot

Function

ScatterPlot(DataSeries, plotFunctions, functions, showFormatOptions, title, xAxis_label, yAxis_label, yAxis_label_orientation, showXgridLines, showYgridLines, showChartBorder, xAxisTickType, yAxisTickType, chartHeight, topPadding, xTickLocation, xTickLabelVisibility, yTickLocation, yTickLabelVisibility, xUnitVisibility, yUnitVisibility, setXaxisMinAndMax, x_Chart_Min, x_Chart_Max, setYaxisMinAndMax, y_Chart_Min, y_Chart_Max, GeometryOffset, GeometryScale)

DataSeries
plotFunctions
functions
showFormatOptions
title
xAxis_label
yAxis_label
yAxis_label_orientation
showXgridLines
showYgridLines
showChartBorder
xAxisTickType
yAxisTickType
chartHeight
topPadding
xTickLocation
xTickLabelVisibility
yTickLocation
yTickLabelVisibility
xUnitVisibility
yUnitVisibility
setXaxisMinAndMax
x_Chart_Min
x_Chart_Max
setYaxisMinAndMax
y_Chart_Min
y_Chart_Max
GeometryOffset
GeometryScale

The Blockpad scatter chart is a barebones, but solid charting tool that you can use directly in a document.

On this page we'll walk through the scatterplot chart, re-creating the chart you see below.

Click the link below to view the file in the web app.

As of writing this, you can view the scatterplot in the web app, but you can't create or edit it.

To follow this walkthrough, follow the link and click File>Download file. Then open the file in the desktop app.

Scatterplot Example

Get the data together

For the scatterplot, it's easiest if your x and y values are separate named arrays. This walkthrough starts with the data in a spreadsheet.

In a newly inserted report, create two new named equations that reference the data.

Referencing the data

Named values that reference the data

Since the numbers in the data are unitless, but they're supposed to be in minutes, multiply each set by 1 min.

(Optional) - Then for the sake of space, hide the result for each set.

Insert the scatterplot

Now it's time to insert the scatter plot. Click the insert chart button in the toolbar, choose the report you're working in for placement, and click OK.

This inserts a chart with the default x and y values.

Double click the chart, and specify the x and y ranges. We want eruption duration for x, and wait time for y.

And with that, the data is plotted on the chart.

Note on units

Notice that the chart tool knows that the numbers in the dataset have units. You can edit how those units are displayed (covered below).

Also note that the chart will autoconvert compatible units and give an error if units are incompatible, like in a Blockpad formula.

For example, if the data set has numbers in inches and centimeters, then they would all be converted to inches before being plotted.

Series formatting

Multiple sets of data can be inserted into one chart by clicking the Add item button under Data series. This walkthrough doesn't cover that specifically.

Each data set can be formatted independently. Point color and size can be changed, and you can hide the points. You can also change the chart to be a line chart by specifying a line pattern.

In this walkthrough, the point color and size was changed so that the points are more differentiated.

Chart formatting

To show more formatting options for the chart, change showFormatOptions to yes.

Chart labels

Type in the title and the x and y labels under the format options.

In this walkthrough, the y axis label orientation was set to be horizontal, but the default is vertical.

Chart height

Notice that this squishes the chart a bit. You can change the chart height to space it out vertically (the width is limited by the page width).

At the time this was written, the box "holding" the chart does not respond to changes in the chart height. You can hide these boxes by un-checking View>Show Auto Borders, and then manually make space above the chart.

Unit display

When a chart has units, use X unit visibility or Y unit visibility to move the units to the label or to remove them from view. By default the units are shown next to the tick labels.

For this chart, X and Y unit visibility is set to OnAxisLabel.

Change chart range

You can set a custom max/min for the chart instead of the auto-size.

Change Set X axis bounds or Set Y axis bounds to yes to make the chart a manual size.

Note that if a range has units, then the min and max need to be compatible with those units

Tick labels and tick formatting

There's a few settings available to format the ticks.

In this example, the ticks were set to go towards the outside of the chart.

Also, the tick labels settings (the numbers that show what the marks signify) can be changed so that they are hidden. In this walkthrough X and Y tick label visibility is changed to ShowEnds.

Grid lines

Grid lines are off by default, but you can turn them on with Show X grid lines and Show Y grid lines.

Show Y grid lines is set to Yes for this example.

Linear regression

You can plot a linear regression line with a data set by changing Plot Regression to Yes.

Unlike conventional spreadsheets, the formula for the linear regression in the chart can actually be used in formulas. To do so, treat the chart like a block: click the chart while in a formula, then type in a period and LinearRegression.

In a formula, the linear regression is like a function where you input an x value and get a y value as a result.

That wraps up this walkthrough.

Not everything about charts is covered here, but you should have a good feel for the basics of creating a chart and some simple formatting.


You can refer to this function in any formula, macro, module, or other script in Blockpad. You can use either its name or its full path:

  • To refer to it by name, use ScatterPlot(...) (make sure the library Library.Charts is included with Include Libaries)
  • To refer to it by its full path, use Library.Charts.ScatterPlot(...)

 

See also: