Change RExpression plotting actors to allow custom axis and title labels
If/When metadata is being passed around with workflow tokens, use the information contained within that to set the labels for chart axis, title etc...
#1 Updated by ben leinfelder over 11 years ago
using R "attributes" of objects, we can add some metadata to the variables as the tokens are made available in R.
In the case of the ScatterPlot-RExpression actor that has 2 input ports named "Independent" and "Dependent" the X- and Y-axis are labeled with those variable names.
If we included a "name" attribute for each of those objects, we could use that attribute as the axis label when calling plot() in R.
I propose using the upstream (source) output port name as the "name" attribute. In the case of an EML actor that provides two vectors of data (columns) for the ScatterPlot, each axis would be labeled with the column name that provided the data being plotted.
The R for creating the graph would look like this:
plot(Independent, Dependent, xlab=attributes(Independent)$name, ylab=attributes(Dependent)$name)
If the R actor class does make this "name" attribute available to script authors in Kepler, there is no need for it to be used unless desired. The R for adding these custom attributes is also quite straight forward:
attr(z, "name") <- "temperature"
sets the name attribute of object, z, to "temperature. that's it!