1 | |
---|
2 | |
---|
3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
---|
4 | <head> |
---|
5 | <title>bar_plot.pro (SAXO Documentation Assistant)</title> |
---|
6 | </head> |
---|
7 | |
---|
8 | <body text="#000000" bgcolor="#FFFFFF"> |
---|
9 | |
---|
10 | |
---|
11 | <!-- Navbar template takes a structure with the following fields: |
---|
12 | overview_href : |
---|
13 | overview_selected : |
---|
14 | dir_overview_href : |
---|
15 | dir_overview_selected : |
---|
16 | categories_href : |
---|
17 | categories_selected : |
---|
18 | index_href : |
---|
19 | index_selected : |
---|
20 | search_href : |
---|
21 | search_selected : |
---|
22 | file_selected : |
---|
23 | source_href : |
---|
24 | source_selected : |
---|
25 | help_href : |
---|
26 | help_selected : |
---|
27 | etc_selected : |
---|
28 | |
---|
29 | prev_file_href : |
---|
30 | next_file_href : |
---|
31 | |
---|
32 | view_single_page_href : |
---|
33 | view_frames_href : |
---|
34 | |
---|
35 | summary_fields_href : |
---|
36 | summary_routine_href : |
---|
37 | details_routine_href : |
---|
38 | |
---|
39 | title : |
---|
40 | subtitle : |
---|
41 | user : |
---|
42 | --> |
---|
43 | |
---|
44 | |
---|
45 | <table border="0" cellpadding="0" cellspacing="0" width="98%" bgcolor="#F0F0FF" valign="bottom"> |
---|
46 | <tr> |
---|
47 | <td width="10%"> |
---|
48 | <a href=""><img src="./../../../prev.gif" border="0" alt="Previous"></a></td> |
---|
49 | <td width="80%" align="center" valign="center"> |
---|
50 | <font size=-1><i>SAXO Documentation Assistant</i>: <a href="./../../../home.html">Overview</a></font></td> |
---|
51 | <td width="10%" align="right"> |
---|
52 | <a href="plt.html"><img src="./../../../next.gif" border="0" alt="Next"></a></td> |
---|
53 | </tr> |
---|
54 | </table> |
---|
55 | |
---|
56 | |
---|
57 | <h1><font size="-2">ToBeReviewed/PLOTS/DESSINE/</font></h1> |
---|
58 | <h2>bar_plot.pro</h2> |
---|
59 | |
---|
60 | <dl> |
---|
61 | </dl> |
---|
62 | |
---|
63 | |
---|
64 | Create a bar graph, or overplot on an existing one. |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | |
---|
70 | <a name="#_bar_plot"></a> |
---|
71 | |
---|
72 | <h2>bar_plot <font size="-1" color="#006633"> |
---|
73 | Graphics |
---|
74 | </font></h2> |
---|
75 | |
---|
76 | <p><font face="Courier">bar_plot<i>, <a href="#_bar_plot_keyword_values">values</a></i>, <a href="#_bar_plot_keyword_baselines">baselines</a>=<i>vector</i>, <a href="#_bar_plot_keyword_colors">colors</a>=<i>vector</i>, <a href="#_bar_plot_keyword_barnames">barnames</a>=<i>string</i>, <a href="#_bar_plot_keyword_title">title</a>=<i>string</i>, <a href="#_bar_plot_keyword_xtitle">xtitle</a>=<i>string</i>, <a href="#_bar_plot_keyword_ytitle">ytitle</a>=<i>string</i>, <a href="#_bar_plot_keyword_baserange">baserange</a>=<i>float</i>, <a href="#_bar_plot_keyword_barwidth">barwidth</a>=<i>float</i>, <a href="#_bar_plot_keyword_barspace">barspace</a>=<i>scalar</i>, <a href="#_bar_plot_keyword_baroffset">baroffset</a>=<i>scalar</i>, <a href="#_bar_plot_keyword_outline">outline</a>=<i>outline</i>, <a href="#_bar_plot_keyword_overplot">overplot</a>=<i>overplot</i>, <a href="#_bar_plot_keyword_background">background</a>=<i>scalar</i>, <a href="#_bar_plot_keyword_rotate">rotate</a>=<i>rotate</i>, <a href="#_bar_plot_keyword__EXTRA">_EXTRA</a>=<i>_EXTRA</i></font></p> |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | <h3>Parameters</h3> |
---|
85 | |
---|
86 | |
---|
87 | <a name="#_bar_plot_keyword_values"></a> |
---|
88 | <h4>values |
---|
89 | <font size="-1" color="#006633">in</font> |
---|
90 | |
---|
91 | |
---|
92 | <font size="-1" color="#006633">required</font> |
---|
93 | |
---|
94 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>vector</i></font> |
---|
95 | |
---|
96 | |
---|
97 | </h4> |
---|
98 | |
---|
99 | |
---|
100 | A vector containing the values to be represented by the bars. |
---|
101 | Each element in VALUES corresponds to a single bar in the |
---|
102 | output. |
---|
103 | |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | <h3>Keywords</h3> |
---|
109 | |
---|
110 | |
---|
111 | <a name="#_bar_plot_keyword_baselines"></a> |
---|
112 | <h4>baselines |
---|
113 | |
---|
114 | |
---|
115 | |
---|
116 | |
---|
117 | |
---|
118 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>vector</i></font> |
---|
119 | |
---|
120 | |
---|
121 | </h4> |
---|
122 | |
---|
123 | |
---|
124 | A vector, the same size as VALUES, that contains the |
---|
125 | base value associated with each bar. If not specified, |
---|
126 | a base value of zero is used for all bars. |
---|
127 | |
---|
128 | |
---|
129 | <a name="#_bar_plot_keyword_colors"></a> |
---|
130 | <h4>colors |
---|
131 | |
---|
132 | |
---|
133 | |
---|
134 | |
---|
135 | |
---|
136 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>vector</i></font> |
---|
137 | |
---|
138 | |
---|
139 | </h4> |
---|
140 | |
---|
141 | |
---|
142 | A vector, the same size as VALUES, containing the color index |
---|
143 | to be used for each bar. If not specified, the colors are |
---|
144 | selected based on spacing the color indexes as widely as |
---|
145 | possible within the available colors (specified by D.N_COLORS). |
---|
146 | |
---|
147 | |
---|
148 | <a name="#_bar_plot_keyword_barnames"></a> |
---|
149 | <h4>barnames |
---|
150 | |
---|
151 | |
---|
152 | |
---|
153 | |
---|
154 | |
---|
155 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>string</i></font> |
---|
156 | |
---|
157 | |
---|
158 | </h4> |
---|
159 | |
---|
160 | |
---|
161 | A string array, containing one string label per bar. |
---|
162 | If the bars are vertical, the labels are placed beneath |
---|
163 | them. If horizontal (rotated) bars are specified, the labels |
---|
164 | are placed to the left of the bars. |
---|
165 | |
---|
166 | |
---|
167 | <a name="#_bar_plot_keyword_title"></a> |
---|
168 | <h4>title |
---|
169 | |
---|
170 | |
---|
171 | |
---|
172 | |
---|
173 | |
---|
174 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>string</i></font> |
---|
175 | |
---|
176 | |
---|
177 | </h4> |
---|
178 | |
---|
179 | |
---|
180 | A string containing the main title to for the bar plot. |
---|
181 | |
---|
182 | |
---|
183 | <a name="#_bar_plot_keyword_xtitle"></a> |
---|
184 | <h4>xtitle |
---|
185 | |
---|
186 | |
---|
187 | |
---|
188 | |
---|
189 | |
---|
190 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>string</i></font> |
---|
191 | |
---|
192 | |
---|
193 | </h4> |
---|
194 | |
---|
195 | |
---|
196 | A string containing the title for the X axis. |
---|
197 | |
---|
198 | |
---|
199 | <a name="#_bar_plot_keyword_ytitle"></a> |
---|
200 | <h4>ytitle |
---|
201 | |
---|
202 | |
---|
203 | |
---|
204 | |
---|
205 | |
---|
206 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>string</i></font> |
---|
207 | |
---|
208 | |
---|
209 | </h4> |
---|
210 | |
---|
211 | |
---|
212 | A string containing the title for the Y axis. |
---|
213 | |
---|
214 | |
---|
215 | <a name="#_bar_plot_keyword_baserange"></a> |
---|
216 | <h4>baserange |
---|
217 | |
---|
218 | |
---|
219 | |
---|
220 | |
---|
221 | |
---|
222 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>float</i></font> |
---|
223 | |
---|
224 | |
---|
225 | </h4> |
---|
226 | |
---|
227 | |
---|
228 | A floating-point scalar in the range 0.0 to 1.0, that |
---|
229 | determines the fraction of the total available plotting area |
---|
230 | (in the direction perpendicular to the bars) to be used. |
---|
231 | If not specified, the full available area is used. |
---|
232 | |
---|
233 | |
---|
234 | <a name="#_bar_plot_keyword_barwidth"></a> |
---|
235 | <h4>barwidth |
---|
236 | |
---|
237 | |
---|
238 | |
---|
239 | |
---|
240 | |
---|
241 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>float</i></font> |
---|
242 | |
---|
243 | |
---|
244 | </h4> |
---|
245 | |
---|
246 | |
---|
247 | A floating-point value that specifies the width of the bars |
---|
248 | in units of "nominal bar width". The nominal bar width is |
---|
249 | computed so that all the bars (and the space between them, |
---|
250 | set by default to 20% of the width of the bars) will fill the |
---|
251 | available space (optionally controlled with the BASERANGE |
---|
252 | keyword). |
---|
253 | |
---|
254 | |
---|
255 | <a name="#_bar_plot_keyword_barspace"></a> |
---|
256 | <h4>barspace |
---|
257 | |
---|
258 | |
---|
259 | |
---|
260 | |
---|
261 | |
---|
262 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>scalar</i></font> |
---|
263 | |
---|
264 | |
---|
265 | </h4> |
---|
266 | |
---|
267 | |
---|
268 | A scalar that specifies, in units of "nominal bar width", |
---|
269 | the spacing between bars. For example, if BARSPACE is 1.0, |
---|
270 | then all bars will have one bar-width of space between them. |
---|
271 | If not specified, the bars are spaced apart by 20% of the bar |
---|
272 | width. |
---|
273 | |
---|
274 | |
---|
275 | <a name="#_bar_plot_keyword_baroffset"></a> |
---|
276 | <h4>baroffset |
---|
277 | |
---|
278 | |
---|
279 | |
---|
280 | |
---|
281 | |
---|
282 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>scalar</i></font> |
---|
283 | <font size="-1" color="#006633">default:</font> <font size="-1" color="#006633"><i>BARSPACE</i></font> |
---|
284 | |
---|
285 | </h4> |
---|
286 | |
---|
287 | |
---|
288 | A scalar that specifies the offset to be applied to the |
---|
289 | first bar, in units of "nominal bar width". This keyword |
---|
290 | allows, for example, different groups of bars to be overplotted |
---|
291 | on the same graph. |
---|
292 | |
---|
293 | |
---|
294 | <a name="#_bar_plot_keyword_outline"></a> |
---|
295 | <h4>outline |
---|
296 | |
---|
297 | |
---|
298 | |
---|
299 | |
---|
300 | |
---|
301 | |
---|
302 | |
---|
303 | |
---|
304 | </h4> |
---|
305 | |
---|
306 | |
---|
307 | If set, this keyword specifies that an outline should be |
---|
308 | drawn around each bar. |
---|
309 | |
---|
310 | |
---|
311 | <a name="#_bar_plot_keyword_overplot"></a> |
---|
312 | <h4>overplot |
---|
313 | |
---|
314 | |
---|
315 | |
---|
316 | |
---|
317 | |
---|
318 | |
---|
319 | |
---|
320 | |
---|
321 | </h4> |
---|
322 | |
---|
323 | |
---|
324 | If set, this keyword specifies that the bar plot should be |
---|
325 | overplotted on an existing graph. |
---|
326 | |
---|
327 | |
---|
328 | <a name="#_bar_plot_keyword_background"></a> |
---|
329 | <h4>background |
---|
330 | |
---|
331 | |
---|
332 | |
---|
333 | |
---|
334 | |
---|
335 | <font size="-1" color="#006633">type:</font> <font size="-1" color="#006633"><i>scalar</i></font> |
---|
336 | <font size="-1" color="#006633">default:</font> <font size="-1" color="#006633"><i>The normal IDL background color is used</i></font> |
---|
337 | |
---|
338 | </h4> |
---|
339 | |
---|
340 | |
---|
341 | A scalar that specifies the color index to be used for |
---|
342 | the background color. |
---|
343 | |
---|
344 | |
---|
345 | <a name="#_bar_plot_keyword_rotate"></a> |
---|
346 | <h4>rotate |
---|
347 | |
---|
348 | |
---|
349 | |
---|
350 | |
---|
351 | |
---|
352 | |
---|
353 | |
---|
354 | |
---|
355 | </h4> |
---|
356 | |
---|
357 | |
---|
358 | If set, this keyword indicates that horizontal rather than |
---|
359 | vertical bars should be drawn. The bases of horizontal bars |
---|
360 | are on the left, "Y" axis and the bars extend to the right. |
---|
361 | |
---|
362 | |
---|
363 | <a name="#_bar_plot_keyword__EXTRA"></a> |
---|
364 | <h4>_EXTRA |
---|
365 | |
---|
366 | |
---|
367 | |
---|
368 | |
---|
369 | |
---|
370 | |
---|
371 | |
---|
372 | |
---|
373 | </h4> |
---|
374 | |
---|
375 | |
---|
376 | |
---|
377 | |
---|
378 | |
---|
379 | <h3>Examples</h3> By using the overplotting capability, it is relatively easy to create |
---|
380 | stacked bar charts, or different groups of bars on the same graph. |
---|
381 | |
---|
382 | For example, if ARRAY is a two-dimensional array of 5 columns and 8 |
---|
383 | rows, it is natural to make a plot with 5 bars, each of which is a |
---|
384 | "stacked" composite of 8 sections. First, create a 2D COLORS array, |
---|
385 | equal in size to ARRAY, that has identical color index values across |
---|
386 | each row to ensure that the same item is represented by the same color |
---|
387 | in all bars. |
---|
388 | |
---|
389 | With ARRAYS and COLORS defined, the following code fragment |
---|
390 | illustrates the creation of stacked bars (note that the number of rows |
---|
391 | and columns is arbitrary): |
---|
392 | |
---|
393 | !Y.RANGE = [0,ymax] ; Scale range to accommodate the total bar lengths. |
---|
394 | BASE = INTARR(NROWS) |
---|
395 | FOR I = 0, NROWS-1 DO BEGIN |
---|
396 | BAR_PLOT, ARRAY(*,I), COLORS=COLORS(*,I), BASELINES=BASE, $ |
---|
397 | BARWIDTH=0.75, BARSPACE=0.25, OVER=(I GT 0) |
---|
398 | BASE = BASE + ARRAY(*,I) |
---|
399 | ENDFOR |
---|
400 | |
---|
401 | To plot each row of ARRAY as a clustered group of bars within the same |
---|
402 | graph, use the BASERANGE keyword to restrict the available plotting |
---|
403 | region for each set of bars. The sample code fragment below |
---|
404 | illustrates this method: |
---|
405 | |
---|
406 | FOR I = 0, NROWS-1 DO $ |
---|
407 | BAR_PLOT, ARRAY(*,I), COLORS=COLORVECT, BARWIDTH=0.8,BARSPACE=0.2, $ |
---|
408 | BAROFFSET=I*((1.0+BARSPACE)*NCOLS), OVER=(I GT 0), BASERANGE=0.19 |
---|
409 | |
---|
410 | where NCOLS is the number of columns in ARRAY, and COLORVECT is a |
---|
411 | vector containing the color indices to be used for each group of |
---|
412 | bars. (In this example, each group uses the same set of colors, but |
---|
413 | this could easily be changed.) |
---|
414 | |
---|
415 | <h3>Version history</h3> |
---|
416 | |
---|
417 | |
---|
418 | <h4>History</h4> August 1990, T.J. Armitage, RSI, initial programming. Replacement |
---|
419 | for PLOTBAR and OPLOTBAR routines written by William Thompson. |
---|
420 | |
---|
421 | September 1990, Steve Richards, RSI, changed defaults to improve the |
---|
422 | appearance of the bar plots in the default mode. Included |
---|
423 | spacing the bars slightly. |
---|
424 | |
---|
425 | $Id: bar_plot.pro 142 2006-07-21 12:47:49Z navarro $ |
---|
426 | |
---|
427 | |
---|
428 | |
---|
429 | |
---|
430 | |
---|
431 | |
---|
432 | |
---|
433 | |
---|
434 | |
---|
435 | |
---|
436 | |
---|
437 | |
---|
438 | |
---|
439 | |
---|
440 | |
---|
441 | |
---|
442 | |
---|
443 | <font size="-3"><p> </p></font> |
---|
444 | <hr size="1" color="#CCCCCC"/> |
---|
445 | |
---|
446 | |
---|
447 | |
---|
448 | |
---|
449 | <p><font color="gray" size="-3"> Produced by IDLdoc 2.0 on Tue Aug 29 14:50:08 2006.</font></p> |
---|
450 | |
---|
451 | </body> |
---|
452 | </html> |
---|