annotate xy_plot.xml @ 0:8cdada007b82 draft

Uploaded
author saskia-hiltemann
date Thu, 29 Oct 2015 10:51:23 -0400
parents
children 1e7227087237
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
1 <tool id="XY_Plot_1" name="Plotting tool" version="1.0.1">
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
2 <description>for multiple series and graph types</description>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
3 <requirements>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
4 <requirement type="package" version="2.11.0">R</requirement>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
5 <requirement type="package" version="1.14.2">cairo</requirement>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
6 </requirements>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
7 <command interpreter="bash">r_wrapper.sh $script_file</command>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
8
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
9 <inputs>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
10 <param name="main" type="text" value="" label="Plot Title"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
11 <param name="xlab" type="text" value="" label="Label for x axis"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
12 <param name="ylab" type="text" value="" label="Label for y axis"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
13 <repeat name="series" title="Series">
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
14 <param name="input" type="data" format="tabular" label="Dataset"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
15 <param name="xcol" type="data_column" data_ref="input" label="Column for x axis"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
16 <param name="ycol" type="data_column" data_ref="input" label="Column for y axis"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
17 <conditional name="series_type">
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
18 <param name="type" type="select" label="Series Type">
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
19 <option value="line" selected="true">Line</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
20 <option value="points">Points</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
21 </param>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
22 <when value="line">
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
23 <param name="lty" type="select" label="Line Type">
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
24 <option value="1">Solid</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
25 <option value="2">Dashed</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
26 <option value="3">Dotted</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
27 </param>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
28 <param name="col" type="select" label="Line Color">
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
29 <option value="1">Black</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
30 <option value="2">Red</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
31 <option value="3">Green</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
32 <option value="4">Blue</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
33 <option value="5">Cyan</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
34 <option value="6">Magenta</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
35 <option value="7">Yellow</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
36 <option value="8">Gray</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
37 </param>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
38 <param name="lwd" type="float" label="Line Width" value="1.0"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
39 </when>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
40 <when value="points">
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
41 <param name="pch" type="select" label="Point Type">
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
42 <option value="1">Circle (hollow)</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
43 <option value="2">Triangle (hollow)</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
44 <option value="3">Cross</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
45 <option value="4">Diamond (hollow)</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
46 <option value="15">Square (filled)</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
47 <option value="16">Circle (filled)</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
48 <option value="17">Triangle (filled)</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
49 </param>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
50 <param name="col" type="select" label="Point Color">
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
51 <option value="1">Black</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
52 <option value="2">Red</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
53 <option value="3">Green</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
54 <option value="4">Blue</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
55 <option value="5">Cyan</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
56 <option value="6">Magenta</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
57 <option value="7">Yellow</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
58 <option value="8">Gray</option>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
59 </param>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
60 <param name="cex" type="float" label="Point Scale" value="1.0"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
61 </when>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
62 </conditional>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
63 </repeat>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
64 </inputs>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
65
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
66 <configfiles>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
67 <configfile name="script_file">
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
68 ## Setup R error handling to go to stderr
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
69 options( show.error.messages=F,
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
70 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
71 ## Determine range of all series in the plot
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
72 xrange = c( NULL, NULL )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
73 yrange = c( NULL, NULL )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
74 #for $i, $s in enumerate( $series )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
75 s${i} = read.table( "${s.input.file_name}" )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
76 x${i} = s${i}[,${s.xcol}]
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
77 y${i} = s${i}[,${s.ycol}]
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
78 xrange = range( x${i}, xrange )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
79 yrange = range( y${i}, yrange )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
80 #end for
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
81 ## Open output PDF file
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
82 png( "${out_file1}" )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
83 ## Dummy plot for axis / labels
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
84 plot( NULL, type="n", xlim=xrange, ylim=yrange, main="${main}", xlab="${xlab}", ylab="${ylab}" )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
85 ## Plot each series
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
86 #for $i, $s in enumerate( $series )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
87 #if $s.series_type['type'] == "line"
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
88 lines( x${i}, y${i}, lty=${s.series_type.lty}, lwd=${s.series_type.lwd}, col=${s.series_type.col} )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
89 #elif $s.series_type.type == "points"
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
90 points( x${i}, y${i}, pch=${s.series_type.pch}, cex=${s.series_type.cex}, col=${s.series_type.col} )
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
91 #end if
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
92 #end for
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
93 ## Close the PDF file
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
94 devname = dev.off()
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
95 </configfile>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
96 </configfiles>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
97
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
98 <outputs>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
99 <data format="png" name="out_file1" />
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
100 </outputs>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
101
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
102 <tests>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
103 <test>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
104 <param name="main" value="Example XY Plot"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
105 <param name="xlab" value="Column 1"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
106 <param name="ylab" value="Column 2"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
107 <param name="input" value="2.tabular" ftype="tabular"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
108 <param name="xcol" value="1"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
109 <param name="ycol" value="2"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
110 <param name="type" value="line"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
111 <param name="lty" value="2"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
112 <param name="col" value="2"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
113 <param name="lwd" value="1.0"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
114 <output name="out_file1" file="XY_Plot_1_out.pdf"/>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
115 </test>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
116 </tests>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
117 <help>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
118 .. class:: infomark
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
119
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
120 This tool allows you to plot values contained in columns of a dataset against each other and also allows you to have different series corresponding to the same or different datasets in one plot.
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
121
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
122 -----
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
123
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
124 .. class:: warningmark
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
125
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
126 This tool throws an error if the columns selected for plotting are absent or are not numeric and also if the lengths of these columns differ.
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
127
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
128 -----
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
129
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
130 **Example**
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
131
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
132 Input file::
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
133
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
134 1 68 4.1
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
135 2 71 4.6
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
136 3 62 3.8
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
137 4 75 4.4
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
138 5 58 3.2
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
139 6 60 3.1
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
140 7 67 3.8
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
141 8 68 4.1
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
142 9 71 4.3
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
143 10 69 3.7
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
144
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
145 Create a two series XY plot on the above data:
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
146
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
147 - Series 1: Red Dashed-Line plot between columns 1 and 2
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
148 - Series 2: Blue Circular-Point plot between columns 3 and 2
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
149
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
150 .. image:: xy_example.jpg
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
151 </help>
8cdada007b82 Uploaded
saskia-hiltemann
parents:
diff changeset
152 </tool>