Figure from Table with Table (deprecated)

../../../../_images/figure.svg

Create a Figure from a data Table (upper port) using another Table for configuration (lower port).

Having the full configuration for the figure as a table on an input port allow you to programmatically configure a figure. If you are looking for an eaiser but slightly less powerful way to configure a figure you should instead use one of the nodes Figure (deprecated) or Figures (deprecated) where you can configure the figure in a graphical user interface.

The configuration table consists of one parameter column and one value column. Both column should be of text type. The easiest way to learn how to create a specific figure with this node is to first build the same figure using the node Figure (deprecated) and look at the configuration table that that node produces.

Here is a simple example of a configuration table for a line plot:

Parameters Values
axes.axes-1.xaxis_position bottom
axes.axes-1.yaxis_position left
axes.axes-1.title Plot title
axes.axes-1.xlabel The xlabel
axes.axes-1.ylabel The ylabel
line.line-1.axes axes-1
line.line-1.xdata table.col('x').data
line.line-1.ydata table.col('y').data

Plots

Every line/scatter is addressed with a unique identifier {id}, which can be any string without a ‘.’. A line parameter is constructed as with line.{id}.{property} in the parameter column and the corresponding value in the value column. Every line needs to have at least the ‘xdata’ and ‘ydata’ specified. All line properties, except the ‘ydata’, can also be given on a global level like line.{property}. All properties given on a global level with be copied to all configured lines without overriding locally declared properties.

Currently supported properties are (some properties allow alternative names longname/shortname):

Property Type
xdata unicode
ydata unicode
axes axes id (see below)
label unicode
marker matplotlib marker: o, ., ^, d, etc
markersize float
markeredgecolor mpl color (see below)
markeredgewidth float
markerfacecolor mpl color (see below)
linestyle matplotlib line style: -, –, .-, etc
linewidth float
color mpl color (see below)
alpha float [0., 1.]
zorder number
drawstyle matplotlib drawstyle: default, steps, etc

Please see the matplotlib documentation for sensible values of the different types.

Example

An example assigning the ‘index’ column as x values and the ‘signal’ column as y values to a line with id ‘line-1’, as well as drawing it in red with a circular marker:

Parameters Values
line.line-1.xdata table.col('index').data
line.line-1.ydata table.col('signal').data
line.line-1.color red
line.line-1.marker o

Axes

Axes are defined similarly to lines. All axes are overlaid on top of each other. Every axes also has a unique identifier {id} (without ‘.’). The parameter name is constructed as axes.{id}.{property} on the local level or axes.{property} for global properties, valid for all defined axes.

Property Type
xaxis_position bottom, top
yaxis_position left, right
title unicode
xlabel unicode
ylabel unicode
xlim str of two comma separated numbers
ylim str of two comma separated numbers
xscale linear, log
yscale linear, log
aspect auto, equal, float
grid GRID (see below)
legend LEGEND (see below)

Grid

Every axes can also have a grid with the following optional properties:

Property Type
show bool
color mpl color (see below)
linestyle matplotlib line style: -, –, .-, etc
linewidth float
which major, minor, both
axis both, x, y

Legend

Every axes can also have a legend defined with the following optional properties:

Property Type
show bool
loc mpl legend location (e.g. best, upper left)
ncol int
fontsize e.g. x-small, medium, x-large, etc
markerfirst bool
frameon bool
title unicode

Example

The example defines two axes, one (id=xy) with the y axis on the left and the other (id=foo) with the y axis on the right while sharing the bottom x axis. Since the xaxis_position is shared between the two axes, it is defined on the global level. For xy, a legend will be shown in the upper left corner, while the foo axes will have a green grid.

Parameters Values
axes.xaxis_position bottom
axes.xy.yaxis_position left
axes.xy.xlabel The xy xlabel
axes.xy.ylabel The xy ylabel
axes.xy.legend.show True
axes.xy.legend.loc upper left
axes.foo.yaxis y2
axes.foo.ylabel The y2 ylabel
axes.foo.grid.show True
axes.foo.grid.color green

MPL colors

All properties with mpl colors values expect a string with either a hex color (with or without extra alpha channel), 3 or 4 comma separated integers for the RGBA values (range [0, 255]), 3 or 4 comma separated floats for the RGBA values (range [0., 1.]) or a matplotlib color name (e.g. r, red, blue, etc.).

Input ports:
input:

table

Input data

config:

table

Configuration

Output ports:
figure:

figure

Output figure

Configuration:
Parameters: (parameters)
The column containing the parameter names.
Values: (values)
The column containing the parameter values.
class node_old_figure.FigureFromTableWithTable[source]

Example flows