.. _`Figure`: .. _`org.sysess.sympathy.visualize.figure`: Figure ~~~~~~ .. image:: figure.svg :width: 48 The configuration for this node 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...". Some common plots ================= There are many types of plots available in the Figure node. Here follows a short word about some of 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 continueous line. To get data on the correct format for a histogram plot you can use the node :ref:`org.sysess.sympathy.dataanalysis.histogramcalc` 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 -------- Heatmaps are two-dimensional histograms. To get data on the correct format for a heatmap plot you can use the node :ref:`org.sysess.sympathy.dataanalysis.heatmapcalc` as a preprocessing node. Box plots --------- Box plots are a good plot 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 list comprehension ``[arg[col_name] for col_name in arg.column_names()]``. Pie charts ---------- 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 ready accurately. Multiple axes ============= There is support in the node for having more than one pair of axes. This can for example be useful if you want to have two different y scales 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 line plot to each *Axes*. Legends ======= 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*. 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. 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. Iterators ========= 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 ``c`` will take on all the column_names in the Table and can be used in e.g. *Y Data* as such: ``arg[col_name]``. Python expressions as values ============================ To allow the user extra flexibility, many properties can be given either as a normal value or as a python expression which evaluates to a value for that configuration item. To swith 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 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 :ref:`datatypeapis` to see all the available methods and attributes for the data type that you connect to the node. Related nodes ============= This node can not create subplots, but by creating multiple figure objects you can use the node :ref:`org.sysess.sympathy.visualize.figuresubplot` to arrange them as subplots. Use the node :ref:`Export figures` to write the figures you produce to files. :ref:`org.sysess.sympathy.visualize.figurecompressorgui` can be used to combine multiple figures into a single figure. *Input ports*: :input: Input *Output ports*: :figure: figure Output figure *Configuration*: **(no label)** (parameters) The full configuration for this figure. .. automodule:: node_figure .. class:: Figure