Creates scatter, line or bar plots where Y and X coordinates come from CSV files. Coordinates for the Y axis must always be provided; values for the X axis are optional. If X coordinates are missing, integers 1 to N are used. Multiple plots may be created simulateneously: each plot takes Y and X coordinates from one column in the input files "y" and "x". Columns are selected using parameters "yColumns" and "xColumns".
Each column may be plot to the same image or to different images. Creates also a pairs plot, which is each Y column ploted against all other Y columns. The X columns are discarded when using the pairs plot.
Version | 1.0 |
---|---|
Bundle | tools |
Categories | Latex Plot |
Authors | Kristian Ovaska (kristian.ovaska@helsinki.fi), Marko Laakso (Marko.Laakso@Helsinki.FI), Sirkku Karinen (sirkku.karinen@helsinki.fi) |
Issue tracker | View/Report issues |
Requires | R |
Source files | component.xml Plot2D.r |
Usage | Example with default values |
Name | Type | Mandatory | Description |
---|---|---|---|
y | CSV | Mandatory | Coordinates on the Y axis. Columns from this file are selected for plotting using "yColumns". |
x | CSV | Optional | Coordinates on the X axis. Columns from this file are selected for plotting using "xColumns". There must as many rows in "x" as there are in "y". |
labels | CSV | Optional | Labels for the ploted columns. This file needs to have exactly the same number of labels as there are X and Y columns. Same labels will be assigned the same color. |
plotAnnotator | RSource | Optional | R source file that is executed after the plot command. This can be used to add further elements to the plot. The current y and x values are available as numeric vectors "y.column" and "x.column". Current column names in y and x are available as strings "y.name" and "x.name". For example, "abline(h=max(y.column, na.rm=TRUE))" draws a horizontal line that intersects with the maximum Y coordinate. |
Name | Type | Description |
---|---|---|
out | Latex | The plots. The type depends on the plotType parameter. |
Name | Type | Default | Description |
---|---|---|---|
caption | string | "Scatter plot (%s)" | LaTeX caption of each figure. The caption may contain one or two %s placeholders, which are replaced with the current column names in "y" and "x" (if defined). Column names are not used when multiple plots are created to the same image (imageType = 'single'). |
colorFunction | string | "" | Custom function for colors. Example c('red', 'blue', 'green') or rainbow(3) or rainbow(%d), in which %d is replaced with the number of different labels or columns in the plot. Default colors start from black and continue by rainbow()-function until each label or column is assigned with own color. |
commonScale | boolean | true | If true, all plots have the same limits for X and Y axes. This makes it easier to compare plots. Only relevant when multiple columns have been selected. |
dpCm | float | 60 | Dots per centimeter. Used for png-images. |
drawX | boolean | true | If false, do not print X axis ticks and numbers. |
height | float | 11 | Height of each plot in cm. |
imageType | string | "multiple" | Plot multiple images = 'multiple', single image = 'single' or a pairs plot = 'pairs' |
labelColumn | string | "" | Columns in input "label" that is used. If not defined, uses the first column. |
legendPosition | string | "off" | Legend position 'bottomleft' or 'topright' etc (Can not be used with the pairs plot) |
nInf | float | -2e100 | Substitution value for infinitely small values |
pInf | float | 2e100 | Substitution value for infinitely great values |
plotPar | string | "" | String to be evaluated in par() function. for example "bty='n', pch=7" |
plotType | string | "p" | Plot type p=points, l=lines, h=bars, bar=barplot |
pngImage | boolean | true | Switch image format between png and pdf |
sectionTitle | string | "Two dimensional plot" | Title of the LaTeX section or an empty string to omit the section |
sectionType | string | "subsection" | Type of LaTeX section: usually one of section, subsection or subsubsection. No section statement is written if sectionTitle is empty. |
sort | boolean | false | If true, sort values before plotting. This creates a cumulative-like distribution plot. (Can not be used with pairs plot) |
title | string | "%s" | Image title. The caption may contain one or two %s placeholders, which are replaced with the current column names in "y" and "x" (if defined). Column names are not used when multiple plots are created to the same image (imageType = 'single'). |
width | float | 14 | Width of each plot in cm. |
xColumns | string | "*" | Columns in input "x" that are plotted. The special value * includes all columns except non-numeric ones. There must be as many selected columns in X as there are in Y. Note that the files "y" and "x" may still contain a different number of columns. |
xHigh | float | -0.000001 | High bound of the X axis. The special value -0.000001 means that the bound is computed from the data. |
xLabel | string | "x" | X axis label. The label may contain one %s placeholder, which is replaced with the current column name in "x", or if not defined, in "y". |
xLow | float | -0.000001 | Low bound of the X axis. The special value -0.000001 means that the bound is computed from the data. |
xTransformation | string | "" | Numeric R expression that is used to transform X values. The X values are available as a numeric matrix (or vector) under the name "x". This is analogous to "yTransformation". |
yColumns | string | "*" | Columns in input "y" that are plotted. The special value * includes all columns except non-numeric ones. |
yHigh | float | -0.000001 | High bound of the Y axis. The special value -0.000001 means that the bound is computed from the data. |
yLabel | string | "y" | X axis label. The label may contain one %s placeholder, which is replaced with the current column name in "y". |
yLow | float | -0.000001 | Low bound of the Y axis. The special value -0.000001 means that the bound is computed from the data. |
yTransformation | string | "" | Numeric R expression that is used to transform Y values. The Y values are available as a numeric matrix (or vector) under the name "y". Only those columns are present that are selected using "yColumns". For example, "-log10(y)" transforms Y values using a negative base 10 logarithm (defined only for positive values). The expression may be any legal R expression that takes a numeric matrix (or vector) and produces a matrix (or vector) of the same size. |
Test case | Parameters▼ | IN y |
IN x |
IN labels |
IN plotAnnotator |
OUT out |
---|---|---|---|---|---|---|
case1 | properties | y | (missing) | (missing) | (missing) | out |
xLabel=X (%s), |
||||||
case10_clusters | properties | y | x | labels | (missing) | out |
imageType=single, |
||||||
case11_barplot | properties | y | (missing) | (missing) | (missing) | out |
xLabel=X (%s), |
||||||
case12_barplot_single | properties | y | x | (missing) | (missing) | out |
xLabel=X (%s), |
||||||
case2_x | properties | y | x | (missing) | (missing) | out |
xColumns=X2,X3 |
||||||
case3_transformation | properties | y | x | (missing) | (missing) | out |
xColumns=X2,X3, |
||||||
case4_annotator | properties | y | x | (missing) | plotAnnotator | out |
xColumns=X2,X3, |
||||||
case5_bounds | properties | y | x | (missing) | (missing) | out |
xColumns=X2,X3, |
||||||
case6_annotator_column | properties | y | x | (missing) | (missing) | out |
yColumns=Y1, |
||||||
case7_empty_input | (missing) | y | (missing) | (missing) | (missing) | out |
case8_pairs | properties | y | (missing) | (missing) | (missing) | out |
imageType=pairs, |
||||||
case9_lines | properties | y | (missing) | (missing) | (missing) | out |
imageType=single, |