Create a Figure from some data.
When opening the configuration for this node for the first time it will give you a selection of templates for easily getting started with some common plot configurations.
Clicking on the tools button from the template selection or from inside a template configuration gui lets you go to the tree view to see the current configuration and modify it to suit your needs. This is a great way to quickly create a plot or to learn how to do some specific things in the tree view.
The tree view¶
This configuration view consists of a tree view containing all the parts of your figure. To add plots to the figure, you can either click on its corresponding button in the toolbar, or press on a plot button and dragging it to where in the tree view you want it (possible drop locations will be shown in green). The plot will be added with some basic properties depending on which plot type you added (e.g. X Data and Y Data for line plot). Almost all configuration items support more than the default properties. To add more, right-click on a configuration item and choose “Add…”.
There are many types of plots available in the Figure node. Here follows a short word about some of the more common ones.
Scatter plots and line plots¶
These plot types are mostly pretty self-explanatory. The main difference between these is while a Line plot can have marker, a Scatter plot can not have lines. The Scatter plot can on the other hand have a different size and color for each marker, whereas Line plot can only have a single color and size for all markers.
Bar plots and histograms¶
Bar plots and histograms are pretty similar plots. The difference lies in how their x axis data is structured. The bar plot has distinct labels for each bin, whereas each bin in a histogram lies between two points on a continuous line. To get data on the correct format for a histogram plot you can use the node Histogram calculation as a preprocessing node.
Use a Bar Container if you want to combine multiple bar plots by grouping or stacking them. The bar plots should all have the same Bar Labels. Please note that stacked bar plots are only situationally useful since it’s very difficult to gauge the heights of the individual bar parts.
Use a Histogram Container if you want to combine multiple histograms by stacking them on top of each other. Please note that stacked histograms are only situationally useful since it can be very difficult to read the distributions of the individual histograms.
Heatmaps are two-dimensional histograms. To get data on the correct format for a heatmap plot you can use the node Heatmap calculation as a preprocessing node.
Box plots are good for comparing different distributions of data. The box
plot is special in that it expects a list of arrays as data. It can for
example be specified as
[arg['Column A'], arg['Column B']] or with a
[arg[col_name] for col_name in arg.column_names()].
Pie charts can be used to show parts of a whole, but are generally considered inferior to e.g. bar plots. If you use a pie chart you will also want to set the Aspect ratio of the Axes to ‘equal’. Otherwise your pie chart will be very hard to read accurately.
There is support in the node for having an extra x or y axis. This can for example be useful if you want to have two different y ranges for two line plots. To get two y axes first add an extra Axes item to the configuration tree. In the new Axes, you should set the position of the YAxis to ‘right’. Lastly add one or more plots to each Axes.
To get a legend you must both set labels on all plots that you want to include in the legend and also add a Legend item. Note that some plot types have other configuration items called things like Bin Labels or Bar Labels, but those are not used for the legend. Instead, look for a property called simply Label or Labels.
To get a single legend which summarizes all signals across multiple Axes you need to add the Legend to the root of the configuration tree, i.e. next to the Axes items.
It is possible to place the legend outside of the axes, but you might need to tweak the Distance from Axes property to get it to look just right for your specific plot.
An Iterator can be used to create a dynamic number of plots in a single
figure. The iterator can only contain a single plot, but that plot will
then be repeated depending on the Iterable. For example if the data is a
Table and the Iterable is
col_name = arg.column_names() then
col_name will take on all the column names in the Table and can be used
in e.g. Y Data as such:
Python expressions as values¶
To allow the user extra flexibility, all properties can be given either as a normal value or as a python expression which evaluates to a value for that configuration item. To switch to Python mode click the grayed out Python icon to the right of the normal input field. Note that some fields can only be entered as Python expressions (notably fields like X Data and Y Data for e.g. line plots).
In the python evironment the input data port is available under the name
arg. For example one can refer to data columns in a connected Table by
writing something like
arg['My data column']. Have a look at the
Data types to see all the available methods and attributes for the
data type that you connect to the node.