PLplot: plplot.d Source File

PLplot 5.10.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
plplot.d
Go to the documentation of this file.
1 // Converted to D from plplot_d.h by htod
2 module plplot;
3
4 private import std.string;
5 private import std.array;
6 private import std.algorithm;
7 private import std.stdio;
8 private import std.conv;
9
10 // improved D interface
11
12 // certain functions must be declared as C functions so that PLplot
13 // can handle them
14 extern ( C ) {
15 alias PLINT function( PLFLT, PLFLT ) def_func;
16 alias void function( PLINT, PLFLT*, PLFLT* ) fill_func;
17 alias void function( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ) pltr_func;
18 alias void function( PLINT, PLFLT*, PLFLT* ) mapform_func;
19 alias void function( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ) ct_func;
20 }
21
22 // D definition of PLcGrid and PLcGrid2
23 struct PLcGrid
24 {
25 PLFLT[] xg;
26 PLFLT[] yg;
27 PLFLT[] zg;
28 }
29 struct PLcGrid2
30 {
31 PLFLT[][] xg;
32 PLFLT[][] yg;
33 PLFLT[][] zg;
34 }
35
36 // helper function to convert D dynamic arrays in C dynamic arrays
37 private PLFLT** convert_array( PLFLT[][] a )
38 {
39 if ( !a )
40 return null;
41
42 size_t nx = a.length;
43 size_t ny = a[0].length;
44
45 PLFLT ** c_a = ( new PLFLT *[nx] ).ptr;
46 for ( size_t i = 0; i < nx; i++ )
47 {
48 assert( ny == a[i].length, "convert_array(): Array must be 2 dimensional!" );
49 c_a[i] = a[i].ptr;
50 }
51
52 return c_a;
53 }
54
55 // Process options list using current options info.
56 int plparseopts( char[][] args, PLINT mode )
57 {
58 char*[] c_args = new char*[args.length];
59 foreach ( size_t i, char[] arg; args )
60 c_args[i] = cast(char *) toStringz( arg );
61 int argc = cast(int) c_args.length;
62 return c_plparseopts( &argc, cast(char**) c_args, mode );
63 }
64
65 // simple arrow plotter.
66 void plvect( PLFLT[][] u, PLFLT[][] v, PLFLT scale, pltr_func pltr = null, PLPointer pltr_data = null )
67 {
68 PLINT nx = cast(PLINT) u.length;
69 PLINT ny = cast(PLINT) u[0].length;
70 assert( nx == v.length, "plvect(): Arrays must be of same length!" );
71 assert( ny == v[0].length, "plvect(): Arrays must be of same length!" );
72
73 c_plvect( convert_array( u ), convert_array( v ), nx, ny, scale, pltr, pltr_data );
74 }
75
76 void plvect( PLFLT[][] u, PLFLT[][] v, PLFLT scale, ref PLcGrid cgrid )
77 {
78 PLINT nx = cast(PLINT) u.length;
79 PLINT ny = cast(PLINT) u[0].length;
80 assert( nx == v.length, "plvect(): Arrays must be of same length!" );
81 assert( ny == v[0].length, "plvect(): Arrays must be of same length!" );
82
83 c_PLcGrid c;
84 c.xg = cgrid.xg.ptr;
85 c.nx = cast(PLINT) cgrid.xg.length;
86 c.yg = cgrid.yg.ptr;
87 c.ny = cast(PLINT) cgrid.yg.length;
88 c.zg = cgrid.zg.ptr;
89 c.nz = cast(PLINT) cgrid.zg.length;
90
91 c_plvect( convert_array( u ), convert_array( v ), nx, ny, scale, &pltr1, &c );
92 }
93
94 void plvect( PLFLT[][] u, PLFLT[][] v, PLFLT scale, ref PLcGrid2 cgrid2 )
95 {
96 PLINT nx = cast(PLINT) u.length;
97 PLINT ny = cast(PLINT) u[0].length;
98 assert( nx == v.length, "plvect(): Arrays must be of same length!" );
99 assert( ny == v[0].length, "plvect(): Arrays must be of same length!" );
100
101 c_PLcGrid2 c2;
102 c2.xg = convert_array( cgrid2.xg );
103 c2.yg = convert_array( cgrid2.yg );
104 c2.zg = convert_array( cgrid2.zg );
105 c2.nx = cast(PLINT) cgrid2.xg.length;
106 c2.ny = cast(PLINT) cgrid2.xg[0].length;
107 if ( cgrid2.yg )
108 {
109 assert( c2.nx == cgrid2.yg.length, "plvect(): Arrays must be of same length!" );
110 assert( c2.ny == cgrid2.yg[0].length, "plvect(): Arrays must be of same length!" );
111 }
112 if ( cgrid2.zg )
113 {
114 assert( c2.nx == cgrid2.zg.length, "plvect(): Arrays must be of same length!" );
115 assert( c2.ny == cgrid2.zg[0].length, "plvect(): Arrays must be of same length!" );
116 }
117
118 c_plvect( convert_array( u ), convert_array( v ), nx, ny, scale, &pltr2, &c2 );
119 }
120
121 void plsvect( PLFLT[] arrowx, PLFLT[] arrowy, PLBOOL fill )
122 {
123 PLINT npts = cast(PLINT) arrowx.length;
124 assert( npts == arrowy.length, "plsvect(): Arrays must be of same length!" );
125 c_plsvect( arrowx.ptr, arrowy.ptr, npts, fill );
126 }
127
128 // This functions similarly to plbox() except that the origin of the axes
129 // is placed at the user-specified point (x0, y0).
130 void plaxes( PLFLT x0, PLFLT y0, string xopt, PLFLT xtick, PLINT nxsub,
131 string yopt, PLFLT ytick, PLINT nysub )
132 {
133 c_plaxes( x0, y0, toStringz( xopt ), xtick, nxsub, toStringz( yopt ), ytick, nysub );
134 }
135
136 // Plot a histogram using x to store data values and y to store frequencies
137 void plbin( PLFLT[] x, PLFLT[] y, PLINT opt )
138 {
139 PLINT nbin = cast(PLINT) x.length;
140 assert( nbin == y.length, "plbin(): Arrays must be of same length!" );
141 c_plbin( nbin, x.ptr, y.ptr, opt );
142 }
143
144 // This draws a box around the current viewport.
145 void plbox( string xopt, PLFLT xtick, PLINT nxsub, string yopt, PLFLT ytick, PLINT nysub )
146 {
147 c_plbox( toStringz( xopt ), xtick, nxsub, toStringz( yopt ), ytick, nysub );
148 }
149
150 // This is the 3-d analogue of plbox().
151 void plbox3( string xopt, string xlabel, PLFLT xtick, PLINT nsubx,
152 string yopt, string ylabel, PLFLT ytick, PLINT nsuby,
153 string zopt, string zlabel, PLFLT ztick, PLINT nsubz )
154 {
155 c_plbox3( toStringz( xopt ), toStringz( xlabel ), xtick, nsubx,
156 toStringz( yopt ), toStringz( ylabel ), ytick, nsuby,
157 toStringz( zopt ), toStringz( zlabel ), ztick, nsubz );
158 }
159
160 // Routine for drawing continous colour legends
161 void plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height,
162 PLINT opt, PLINT position, PLFLT x, PLFLT y,
163 PLFLT x_length, PLFLT y_length,
164 PLINT bg_color, PLINT bb_color, PLINT bb_style,
165 PLFLT low_cap_color, PLFLT high_cap_color,
166 PLINT cont_color, PLFLT cont_width,
167 PLINT[] label_opts, string[] label,
168 string[] axis_opts,
169 PLFLT[] ticks, PLINT[] sub_ticks,
170 PLFLT[][] values )
171 {
172 PLINT n_labels = cast(PLINT) label_opts.length;
173 PLINT n_axes = cast(PLINT) axis_opts.length;
174 PLINT[] n_values = new PLINT[values.length];
175 for ( size_t i = 0; i < values.length; i++ )
176 {
177 n_values[i] = cast(PLINT) values[i].length;
178 }
179 immutable( char ) * *labelz = array( map!toStringz( label ) ).ptr;
180 immutable( char ) * *axis_optsz = array( map!toStringz( axis_opts ) ).ptr;
181 assert( n_labels == label.length, "plcolorbar(): Arrays must be of same length!" );
182 assert( n_labels == label_opts.length, "plcolorbar(): Arrays must be of same length!" );
183 assert( n_axes == axis_opts.length, "plcolorbar(): Arrays must be of same length!" );
184 assert( n_axes == ticks.length, "plcolorbar(): Arrays must be of same length!" );
185 assert( n_axes == sub_ticks.length, "plcolorbar(): Arrays must be of same length!" );
186
187 c_plcolorbar( p_colorbar_width, p_colorbar_height,
188 opt, position, x, y,
189 x_length, y_length,
190 bg_color, bb_color, bb_style,
191 low_cap_color, high_cap_color,
192 cont_color, cont_width,
193 n_labels, label_opts.ptr, labelz,
194 n_axes, axis_optsz,
195 ticks.ptr, sub_ticks.ptr,
196 n_values.ptr, convert_array( values ) );
197 }
198
199 // Draws a contour plot from data in f(nx,ny). Is just a front-end to
200 // plfcont, with a particular choice for f2eval and f2eval_data.
201 //
202 void plcont( PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel,
203 pltr_func pltr, PLPointer pltr_data = null )
204 {
205 PLINT nx = cast(PLINT) f.length;
206 PLINT ny = cast(PLINT) f[0].length;
207
208 c_plcont( convert_array( f ), nx, ny, kx, lx, ky, ly, clevel.ptr, cast(PLINT) clevel.length,
209 pltr, pltr_data );
210 }
211
212 void plcont( PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel,
213 ref PLcGrid cgrid )
214 {
215 PLINT nx = cast(PLINT) f.length;
216 PLINT ny = cast(PLINT) f[0].length;
217
218 c_PLcGrid c;
219 c.xg = cgrid.xg.ptr;
220 c.nx = cast(PLINT) cgrid.xg.length;
221 c.yg = cgrid.yg.ptr;
222 c.ny = cast(PLINT) cgrid.yg.length;
223 c.zg = cgrid.zg.ptr;
224 c.nz = cast(PLINT) cgrid.zg.length;
225
226 c_plcont( convert_array( f ), nx, ny, kx, lx, ky, ly, clevel.ptr, cast(PLINT) clevel.length,
227 &pltr1, &c );
228 }
229
230 void plcont( PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel,
231 ref PLcGrid2 cgrid2 )
232 {
233 PLINT nx = cast(PLINT) f.length;
234 PLINT ny = cast(PLINT) f[0].length;
235
236 c_PLcGrid2 c2;
237 c2.xg = convert_array( cgrid2.xg );
238 c2.yg = convert_array( cgrid2.yg );
239 c2.zg = convert_array( cgrid2.zg );
240 c2.nx = cast(PLINT) cgrid2.xg.length;
241 c2.ny = cast(PLINT) cgrid2.xg[0].length;
242 if ( cgrid2.yg )
243 {
244 assert( c2.nx == cgrid2.yg.length, "plcont(): Arrays must be of same length!" );
245 assert( c2.ny == cgrid2.yg[0].length, "plcont(): Arrays must be of same length!" );
246 }
247 if ( cgrid2.zg )
248 {
249 assert( c2.nx == cgrid2.zg.length, "plcont(): Arrays must be of same length!" );
250 assert( c2.ny == cgrid2.zg[0].length, "plcont(): Arrays must be of same length!" );
251 }
252
253 c_plcont( convert_array( f ), nx, ny, kx, lx, ky, ly, clevel.ptr, cast(PLINT) clevel.length,
254 &pltr2, &c2 );
255 }
256
257 // Draws a contour plot using the function evaluator f2eval and data stored
258 // by way of the f2eval_data pointer. This allows arbitrary organizations
259 // of 2d array data to be used.
260 //
261 //void plfcont(PLFLT function(PLINT , PLINT , PLPointer )f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data);
262
263 // Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i))
264 void plerrx( PLFLT[] xmin, PLFLT[] xmax, PLFLT[] y )
265 {
266 PLINT n = cast(PLINT) y.length;
267 assert( n == xmin.length, "plerrx(): Arrays must be of same length!" );
268 assert( n == xmax.length, "plerrx(): Arrays must be of same length!" );
269 c_plerrx( n, xmin.ptr, xmax.ptr, y.ptr );
270 }
271
272 // Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i))
273 void plerry( PLFLT[] x, PLFLT[] ymin, PLFLT[] ymax )
274 {
275 PLINT n = cast(PLINT) x.length;
276 assert( n == ymin.length, "plerry(): Arrays must be of same length!" );
277 assert( n == ymax.length, "plerry(): Arrays must be of same length!" );
278 c_plerry( n, x.ptr, ymin.ptr, ymax.ptr );
279 }
280
281 // Pattern fills the polygon bounded by the input points.
282 void plfill( PLFLT[] x, PLFLT[] y )
283 {
284 PLINT n = cast(PLINT) x.length;
285 assert( n == y.length, "plfill(): Arrays must be of same length!" );
286 c_plfill( n, x.ptr, y.ptr );
287 }
288
289 // Pattern fills the 3d polygon bounded by the input points.
290 void plfill3( PLFLT[] x, PLFLT[] y, PLFLT[] z )
291 {
292 PLINT n = cast(PLINT) x.length;
293 assert( n == y.length, "plfill3(): Arrays must be of same length!" );
294 assert( n == z.length, "plfill3(): Arrays must be of same length!" );
295 c_plfill3( n, x.ptr, y.ptr, z.ptr );
296 }
297
298 // Get the current device (keyword) name
299 void plgdev( out string p_dev )
300 {
301 char cdev[1024];
302 c_plgdev( cdev.ptr );
303 p_dev = to!string( cdev.ptr );
304 }
305
306 // Get the (current) output file name. Must be preallocated to >80 bytes
307 void plgfnam( out string fnam )
308 {
309 char cfnam[1024];
310 c_plgfnam( cfnam.ptr );
311 fnam = to!string( cfnam.ptr );
312 }
313
314 // Draw gradient in polygon.
315 void plgradient( PLFLT[] x, PLFLT[] y, PLFLT angle )
316 {
317 PLINT n = cast(PLINT) x.length;
318 assert( n == y.length, "plgradient(): Arrays must be of same length!" );
319 c_plgradient( n, x.ptr, y.ptr, angle );
320 }
321
322 // grid irregularly sampled data
323 void plgriddata( PLFLT[] x, PLFLT[] y, PLFLT[] z, PLFLT[] xg, PLFLT[] yg, PLFLT[][] zg, PLINT type, PLFLT data )
324 {
325 PLINT npts = cast(PLINT) x.length;
326 assert( npts == y.length, "plgriddata(): Arrays must be of same length!" );
327 assert( npts == z.length, "plgriddata(): Arrays must be of same length!" );
328
329 PLINT nxg = cast(PLINT) xg.length;
330 PLINT nyg = cast(PLINT) yg.length;
331 assert( nxg == zg.length, "plgriddata(): Arrays must be of same length!" );
332 assert( nyg == zg[0].length, "plgriddata(): Arrays must be of same length!" );
333
334 c_plgriddata( x.ptr, y.ptr, z.ptr, npts, xg.ptr, nxg, yg.ptr, nyg, convert_array( zg ), type, data );
335 }
336
337 // Get the current library version number
338 void plgver( out string p_ver )
339 {
340 char cver[1024];
341 c_plgver( cver.ptr );
342 p_ver = to!string( cver.ptr );
343 }
344
345 // Draws a histogram of n values of a variable in array data[0..n-1]
346 void plhist( PLFLT[] data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt )
347 {
348 c_plhist( cast(PLINT) data.length, data.ptr, datmin, datmax, nbin, opt );
349 }
350
351 // Simple routine for labelling graphs.
352 void pllab( string xlabel, string ylabel, string tlabel )
353 {
354 c_pllab( toStringz( xlabel ), toStringz( ylabel ), toStringz( tlabel ) );
355 }
356
357 // Routine for drawing discrete line, symbol, or cmap0 legends
358 void pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height,
359 PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT plot_width,
360 PLINT bg_color, PLINT bb_color, PLINT bb_style,
361 PLINT nrow, PLINT ncolumn,
362 PLINT[] opt_array,
363 PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing,
364 PLFLT text_justification,
365 PLINT[] text_colors, string[] text,
366 PLINT[] box_colors, PLINT[] box_patterns,
367 PLFLT[] box_scales, PLFLT[] box_line_widths,
368 PLINT[] line_colors, PLINT[] line_styles,
369 PLFLT[] line_widths,
370 PLINT[] symbol_colors, PLFLT[] symbol_scales,
371 PLINT[] symbol_numbers, string[] symbols )
372 {
373 PLINT nlegend = cast(PLINT) opt_array.length;
374 immutable( char ) * *textz = array( map!toStringz( text ) ).ptr;
375 immutable( char ) * *symbolsz = array( map!toStringz( symbols ) ).ptr;
376 assert( nlegend == text_colors.length, "pllegend(): Arrays must be of same length!" );
377 assert( nlegend == text.length, "pllegend(): Arrays must be of same length!" );
378 assert( box_colors == null || nlegend == box_colors.length, "pllegend(): Arrays must be of same length!" );
379 assert( box_patterns == null || nlegend == box_patterns.length, "pllegend(): Arrays must be of same length!" );
380 assert( box_scales == null || nlegend == box_scales.length, "pllegend(): Arrays must be of same length!" );
381 assert( box_line_widths == null || nlegend == box_line_widths.length, "pllegend(): Arrays must be of same length!" );
382 assert( line_colors == null || nlegend == line_colors.length, "pllegend(): Arrays must be of same length!" );
383 assert( line_styles == null || nlegend == line_styles.length, "pllegend(): Arrays must be of same length!" );
384 assert( line_widths == null || nlegend == line_widths.length, "pllegend(): Arrays must be of same length!" );
385 assert( symbol_colors == null || nlegend == symbol_colors.length, "pllegend(): Arrays must be of same length!" );
386 assert( symbol_scales == null || nlegend == symbol_scales.length, "pllegend(): Arrays must be of same length!" );
387 assert( symbol_numbers == null || nlegend == symbol_numbers.length, "pllegend(): Arrays must be of same length!" );
388 assert( symbols == null || nlegend == symbols.length, "pllegend(): Arrays must be of same length!" );
389 c_pllegend( p_legend_width, p_legend_height,
390 opt, position, x, y, plot_width,
391 bg_color, bb_color, bb_style,
392 nrow, ncolumn,
393 nlegend, opt_array.ptr,
394 text_offset, text_scale, text_spacing,
395 text_justification,
396 text_colors.ptr, textz,
397 box_colors.ptr, box_patterns.ptr,
398 box_scales.ptr, box_line_widths.ptr,
399 line_colors.ptr, line_styles.ptr,
400 line_widths.ptr,
401 symbol_colors.ptr, symbol_scales.ptr,
402 symbol_numbers.ptr, symbolsz );
403 }
404
405 // Draws line segments connecting a series of points.
406 void plline( PLFLT[] x, PLFLT[] y )
407 {
408 PLINT n = cast(PLINT) x.length;
409 assert( n == y.length, "plline(): Arrays must be of same length!" );
410 c_plline( n, x.ptr, y.ptr );
411 }
412
413 // Draws a line in 3 space.
414 void plline3( PLFLT[] x, PLFLT[] y, PLFLT[] z )
415 {
416 PLINT n = cast(PLINT) x.length;
417 assert( n == y.length, "plline3(): Arrays must be of same length!" );
418 assert( n == z.length, "plline3(): Arrays must be of same length!" );
419 c_plline3( n, x.ptr, y.ptr, z.ptr );
420 }
421
422 // plot continental outline in world coordinates
423 void plmap( mapform_func mapform, string type, PLFLT minlong, PLFLT maxlong,
424 PLFLT minlat, PLFLT maxlat )
425 {
426 c_plmap( mapform, toStringz( type ), minlong, maxlong, minlat, maxlat );
427 }
428
429 // Plots a mesh representation of the function z[x][y].
430 void plmesh( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt )
431 {
432 PLINT nx = cast(PLINT) z.length;
433 PLINT ny = cast(PLINT) z[0].length;
434
435 assert( nx == x.length, "plmesh(): Arrays must be of same length!" );
436 assert( ny == y.length, "plmesh(): Arrays must be of same length!" );
437
438 c_plmesh( x.ptr, y.ptr, convert_array( z ), nx, ny, opt );
439 }
440
441 // Plots a mesh representation of the function z[x][y] with contour
442 void plmeshc( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel )
443 {
444 PLINT nx = cast(PLINT) z.length;
445 PLINT ny = cast(PLINT) z[0].length;
446
447 assert( nx == x.length, "plmeshc(): Arrays must be of same length!" );
448 assert( ny == y.length, "plmeshc(): Arrays must be of same length!" );
449
450 c_plmeshc( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length );
451 }
452
453 // Prints out "text" at specified position relative to viewport
454 void plmtex( string side, PLFLT disp, PLFLT pos, PLFLT just, string text )
455 {
456 c_plmtex( toStringz( side ), disp, pos, just, toStringz( text ) );
457 }
458
459 // Prints out "text" at specified position relative to viewport (3D)
460 void plmtex3( string side, PLFLT disp, PLFLT pos, PLFLT just, string text )
461 {
462 c_plmtex3( toStringz( side ), disp, pos, just, toStringz( text ) );
463 }
464
465 // Plots a 3-d representation of the function z[x][y].
466 void plot3d( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLBOOL side )
467 {
468 PLINT nx = cast(PLINT) z.length;
469 PLINT ny = cast(PLINT) z[0].length;
470
471 assert( nx == x.length, "plot3d(): Arrays must be of same length!" );
472 assert( ny == y.length, "plot3d(): Arrays must be of same length!" );
473
474 c_plot3d( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, side );
475 }
476
477 // Plots a 3-d representation of the function z[x][y] with contour.
478 void plot3dc( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel )
479 {
480 PLINT nx = cast(PLINT) z.length;
481 PLINT ny = cast(PLINT) z[0].length;
482
483 assert( nx == x.length, "plot3dc(): Arrays must be of same length!" );
484 assert( ny == y.length, "plot3dc(): Arrays must be of same length!" );
485
486 c_plot3dc( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length );
487 }
488
489 // Plots a 3-d representation of the function z[x][y] with contour and
490 // y index limits.
491 void plot3dcl( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel,
492 PLINT ixstart, PLINT ixn, PLINT[] indexymin, PLINT[] indexymax )
493 {
494 PLINT nx = cast(PLINT) z.length;
495 PLINT ny = cast(PLINT) z[0].length;
496
497 assert( nx == x.length, "plot3dcl(): Arrays must be of same length!" );
498 assert( ny == y.length, "plot3dcl(): Arrays must be of same length!" );
499
500 c_plot3dcl( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length,
501 ixstart, ixn, indexymin.ptr, indexymax.ptr );
502 }
503
504 // Set fill pattern directly.
505 void plpat( PLINT[] inc, PLINT[] del )
506 {
507 PLINT nlin = cast(PLINT) inc.length;
508 assert( nlin == del.length, "plpat(): Arrays must be of same length!" );
509 c_plpat( nlin, inc.ptr, del.ptr );
510 }
511
512 // Plots array y against x for n points using ASCII code "code".
513 void plpoin( PLFLT[] x, PLFLT[] y, PLINT code )
514 {
515 PLINT n = cast(PLINT) x.length;
516 assert( n == y.length, "plpoin(): Arrays must be of same length!" );
517 c_plpoin( n, x.ptr, y.ptr, code );
518 }
519
520 // Draws a series of points in 3 space.
521 void plpoin3( PLFLT[] x, PLFLT[] y, PLFLT[] z, PLINT code )
522 {
523 PLINT n = cast(PLINT) x.length;
524 assert( n == y.length, "plpoin3(): Arrays must be of same length!" );
525 assert( n == z.length, "plpoin3(): Arrays must be of same length!" );
526 c_plpoin3( n, x.ptr, y.ptr, z.ptr, code );
527 }
528
529 // Plots array y against x for n points using (UTF-8) text string
530 void plstring( PLFLT[] x, PLFLT[] y, string text )
531 {
532 PLINT n = cast(PLINT) x.length;
533 assert( n == y.length, "plstring(): Arrays must be of same length!" );
534 c_plstring( n, x.ptr, y.ptr, toStringz( text ) );
535 }
536
537 // Draws a series of points (described by [UTF8] text string) in 3 space.
538 void plstring3( PLFLT[] x, PLFLT[] y, PLFLT[] z, string text )
539 {
540 PLINT n = cast(PLINT) x.length;
541 assert( n == y.length, "plstring3(): Arrays must be of same length!" );
542 assert( n == z.length, "plstring3(): Arrays must be of same length!" );
543 c_plstring3( n, x.ptr, y.ptr, z.ptr, toStringz( text ) );
544 }
545
546 // Draws a polygon in 3 space.
547 void plpoly3( PLFLT[] x, PLFLT[] y, PLFLT[] z, PLBOOL[] draw, PLBOOL ifcc )
548 {
549 PLINT n = cast(PLINT) x.length;
550 assert( n == y.length, "plpoly3(): Arrays must be of same length!" );
551 assert( n == z.length, "plpoly3(): Arrays must be of same length!" );
552 assert( n - 1 == draw.length, "plpoly3(): Array draw must be of same length then other arrays minus 1!" );
553 c_plpoly3( n, x.ptr, y.ptr, z.ptr, draw.ptr, ifcc );
554 }
555
556 // Prints out "text" at world cooordinate (x,y).
557 void plptex( PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, string text )
558 {
559 c_plptex( x, y, dx, dy, just, toStringz( text ) );
560 }
561
562 // Prints out "text" at world cooordinate (x,y,z).
563 void plptex3( PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz,
564 PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, string text )
565 {
566 c_plptex3( wx, wy, wz, dx, dy, dz, sx, sy, sz, just, toStringz( text ) );
567 }
568
569 // Set the colors for color table 0 from a cmap0 file
570 void plspal0( string filename )
571 {
572 c_plspal0( toStringz( filename ) );
573 }
574
575 // Set the colors for color table 1 from a cmap1 file
576 void plspal1( string filename, PLBOOL interpolate )
577 {
578 c_plspal1( toStringz( filename ), interpolate );
579 }
580
581 // Set color map 0 colors by 8 bit RGB values
582 void plscmap0( PLINT[] r, PLINT[] g, PLINT[] b )
583 {
584 PLINT ncol0 = cast(PLINT) r.length;
585 assert( ncol0 == g.length, "plscmap0(): Arrays must be of same length!" );
586 assert( ncol0 == b.length, "plscmap0(): Arrays must be of same length!" );
587 c_plscmap0( r.ptr, g.ptr, b.ptr, ncol0 );
588 }
589
590 // Set color map 0 colors by 8 bit RGB values and alpha values
591 void plscmap0a( PLINT[] r, PLINT[] g, PLINT[] b, PLFLT[] a )
592 {
593 PLINT ncol0 = cast(PLINT) r.length;
594 assert( ncol0 == g.length, "plscmap0a(): Arrays must be of same length!" );
595 assert( ncol0 == b.length, "plscmap0a(): Arrays must be of same length!" );
596 assert( ncol0 == a.length, "plscmap0a(): Arrays must be of same length!" );
597 c_plscmap0a( r.ptr, g.ptr, b.ptr, a.ptr, ncol0 );
598 }
599
600 // Set color map 1 colors by 8 bit RGB values
601 void plscmap1( PLINT[] r, PLINT[] g, PLINT[] b )
602 {
603 PLINT ncol1 = cast(PLINT) r.length;
604 assert( ncol1 == g.length, "plscmap1(): Arrays must be of same length!" );
605 assert( ncol1 == b.length, "plscmap1(): Arrays must be of same length!" );
606 c_plscmap1( r.ptr, g.ptr, b.ptr, ncol1 );
607 }
608
609 // Set color map 1 colors by 8 bit RGB and alpha values
610 void plscmap1a( PLINT[] r, PLINT[] g, PLINT[] b, PLFLT[] a )
611 {
612 PLINT ncol1 = cast(PLINT) r.length;
613 assert( ncol1 == g.length, "plscmap1a(): Arrays must be of same length!" );
614 assert( ncol1 == b.length, "plscmap1a(): Arrays must be of same length!" );
615 assert( ncol1 == a.length, "plscmap1a(): Arrays must be of same length!" );
616 c_plscmap1a( r.ptr, g.ptr, b.ptr, a.ptr, ncol1 );
617 }
618
619 // Set color map 1 colors using a piece-wise linear relationship between
620 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
621 void plscmap1l( PLBOOL itype, PLFLT[] intensity, PLFLT[] coord1,
622 PLFLT[] coord2, PLFLT[] coord3, PLBOOL[] alt_hue_path = null )
623 {
624 PLINT npts = cast(PLINT) intensity.length;
625 assert( npts == coord1.length, "plscmap1l(): Arrays must be of same length!" );
626 assert( npts == coord2.length, "plscmap1l(): Arrays must be of same length!" );
627 assert( npts == coord3.length, "plscmap1l(): Arrays must be of same length!" );
628 if ( alt_hue_path != null )
629 {
630 assert( npts - 1 == alt_hue_path.length, "plscmap1l(): Array alt_hue_path must be of same length then other arrays minus 1!" );
631 c_plscmap1l( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, alt_hue_path.ptr );
632 }
633 else
634 c_plscmap1l( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, null );
635 }
636
637
638 // Set color map 1 colors using a piece-wise linear relationship between
639 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
640 // Will also linear interpolate alpha values.
641 void plscmap1la( PLBOOL itype, PLFLT[] intensity, PLFLT[] coord1,
642 PLFLT[] coord2, PLFLT[] coord3, PLFLT[] a, PLBOOL[] alt_hue_path = null )
643 {
644 PLINT npts = cast(PLINT) intensity.length;
645 assert( npts == coord1.length, "plscmap1la(): Arrays must be of same length!" );
646 assert( npts == coord2.length, "plscmap1la(): Arrays must be of same length!" );
647 assert( npts == coord3.length, "plscmap1la(): Arrays must be of same length!" );
648 assert( npts == a.length, "plscmap1la(): Arrays must be of same length!" );
649 if ( alt_hue_path != null )
650 {
651 assert( npts - 1 == alt_hue_path.length, "plscmap1la(): Array alt_hue_path must be of same length then other arrays minus 1!" );
652 c_plscmap1la( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, alt_hue_path.ptr );
653 }
654 else
655 c_plscmap1la( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, null );
656 }
657
658 // Set the device (keyword) name
659 void plsdev( string devname )
660 {
661 c_plsdev( toStringz( devname ) );
662 }
663
664 // Set the output file name.
665 void plsfnam( string fnam )
666 {
667 c_plsfnam( toStringz( fnam ) );
668 }
669
670 // Shade region.
671 void plshade( PLFLT[][] a, def_func defined, PLFLT left, PLFLT right,
672 PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap,
673 PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color,
674 PLFLT max_width, PLBOOL rectangular,
675 pltr_func pltr = null, PLPointer pltr_data = null )
676 {
677 PLINT nx = cast(PLINT) a.length;
678 PLINT ny = cast(PLINT) a[0].length;
679
680 c_plshade( convert_array( a ), nx, ny, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap,
681 sh_color, sh_width, min_color, min_width, max_color, max_width, &c_plfill,
682 rectangular, pltr, pltr_data );
683 }
684
685 void plshades( PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
686 PLFLT[] clevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width,
687 PLBOOL rectangular, pltr_func pltr = null, PLPointer pltr_data = null )
688 {
689 PLINT nx = cast(PLINT) a.length;
690 PLINT ny = cast(PLINT) a[0].length;
691
692 c_plshades( convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(PLINT) clevel.length,
693 fill_width, cont_color, cont_width, &c_plfill, rectangular, pltr, pltr_data );
694 }
695
696 void plshades( PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
697 PLFLT[] clevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width,
698 PLBOOL rectangular, ref PLcGrid cgrid )
699 {
700 PLINT nx = cast(PLINT) a.length;
701 PLINT ny = cast(PLINT) a[0].length;
702
703 c_PLcGrid c;
704 c.xg = cgrid.xg.ptr;
705 c.nx = cast(PLINT) cgrid.xg.length;
706 c.yg = cgrid.yg.ptr;
707 c.ny = cast(PLINT) cgrid.yg.length;
708 c.zg = cgrid.zg.ptr;
709 c.nz = cast(PLINT) cgrid.zg.length;
710
711 c_plshades( convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(PLINT) clevel.length,
712 fill_width, cont_color, cont_width, &c_plfill, rectangular, &pltr1, &c );
713 }
714
715 void plshades( PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
716 PLFLT[] clevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width,
717 PLBOOL rectangular, ref PLcGrid2 cgrid2 )
718 {
719 PLINT nx = cast(PLINT) a.length;
720 PLINT ny = cast(PLINT) a[0].length;
721
722 c_PLcGrid2 c2;
723 c2.xg = convert_array( cgrid2.xg );
724 c2.yg = convert_array( cgrid2.yg );
725 c2.zg = convert_array( cgrid2.zg );
726 c2.nx = cast(PLINT) cgrid2.xg.length;
727 c2.ny = cast(PLINT) cgrid2.xg[0].length;
728 if ( cgrid2.yg )
729 {
730 assert( c2.nx == cgrid2.yg.length, "plcont(): Arrays must be of same length!" );
731 assert( c2.ny == cgrid2.yg[0].length, "plcont(): Arrays must be of same length!" );
732 }
733 if ( cgrid2.zg )
734 {
735 assert( c2.nx == cgrid2.zg.length, "plcont(): Arrays must be of same length!" );
736 assert( c2.ny == cgrid2.zg[0].length, "plcont(): Arrays must be of same length!" );
737 }
738
739 c_plshades( convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(PLINT) clevel.length,
740 fill_width, cont_color, cont_width, &c_plfill, rectangular, &pltr2, &c2 );
741 }
742
743 // Initialize PLplot, passing the device name and windows/page settings.
744 void plstart( string devname, PLINT nx, PLINT ny )
745 {
746 c_plstart( toStringz( devname ), nx, ny );
747 }
748
749 // Create 1d stripchart
750 void plstripc( PLINT* id, string xspec, string yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump,
751 PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLBOOL y_ascl, PLBOOL acc,
752 PLINT colbox, PLINT collab, PLINT[] colline, PLINT[] styline, string[] legline,
753 string labx, string laby, string labtop )
754 {
755 assert( 4 == colline.length, "plstripc(): Arrays must be of length 4!" );
756 assert( 4 == styline.length, "plstripc(): Arrays must be of length 4!" );
757 assert( 4 == legline.length, "plstripc(): Arrays must be of length 4!" );
758
759 immutable( char ) * *leglinez = array( map!toStringz( legline ) ).ptr;
760 //for ( int i = 0; i < 4; i++ )
761 //{
762 // leglinez[i] = toStringz( legline[i] );
763 //}
764
765 c_plstripc( id, toStringz( xspec ), toStringz( yspec ), xmin, xmax, xjump, ymin, ymax,
766 xlpos, ylpos, y_ascl, acc, colbox, collab, colline.ptr, styline.ptr, leglinez,
767 toStringz( labx ), toStringz( laby ), toStringz( labtop ) );
768 }
769
770 // plots a 2d image (or a matrix too large for plshade() )
771 void plimagefr( PLFLT[][] idata, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
772 PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax,
773 pltr_func pltr = null, PLPointer pltr_data = null )
774 {
775 PLINT nx = cast(PLINT) idata.length;
776 PLINT ny = cast(PLINT) idata[0].length;
777
778 c_plimagefr( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
779 valuemin, valuemax, pltr, pltr_data );
780 }
781
782 // plots a 2d image (or a matrix too large for plshade() )
783 void plimagefr( PLFLT[][] idata, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
784 PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, PLcGrid cgrid )
785 {
786 PLINT nx = cast(PLINT) idata.length;
787 PLINT ny = cast(PLINT) idata[0].length;
788
789 c_PLcGrid c;
790 c.xg = cgrid.xg.ptr;
791 c.nx = cast(PLINT) cgrid.xg.length;
792 c.yg = cgrid.yg.ptr;
793 c.ny = cast(PLINT) cgrid.yg.length;
794 c.zg = cgrid.zg.ptr;
795 c.nz = cast(PLINT) cgrid.zg.length;
796
797 c_plimagefr( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
798 valuemin, valuemax, &pltr1, &c );
799 }
800
801 // plots a 2d image (or a matrix too large for plshade() )
802 void plimagefr( PLFLT[][] idata, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
803 PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, PLcGrid2 cgrid2 )
804 {
805 PLINT nx = cast(PLINT) idata.length;
806 PLINT ny = cast(PLINT) idata[0].length;
807
808 c_PLcGrid2 c2;
809 c2.xg = convert_array( cgrid2.xg );
810 c2.yg = convert_array( cgrid2.yg );
811 c2.zg = convert_array( cgrid2.zg );
812 c2.nx = cast(PLINT) cgrid2.xg.length;
813 c2.ny = cast(PLINT) cgrid2.xg[0].length;
814 if ( cgrid2.yg )
815 {
816 assert( c2.nx == cgrid2.yg.length, "plcont(): Arrays must be of same length!" );
817 assert( c2.ny == cgrid2.yg[0].length, "plcont(): Arrays must be of same length!" );
818 }
819 if ( cgrid2.zg )
820 {
821 assert( c2.nx == cgrid2.zg.length, "plcont(): Arrays must be of same length!" );
822 assert( c2.ny == cgrid2.zg[0].length, "plcont(): Arrays must be of same length!" );
823 }
824
825 c_plimagefr( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
826 valuemin, valuemax, &pltr2, &c2 );
827 }
828
829 // plots a 2d image (or a matrix too large for plshade() ) - colors
830 // automatically scaled
831 void plimage( PLFLT[][] idata, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
832 PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax )
833 {
834 PLINT nx = cast(PLINT) idata.length;
835 PLINT ny = cast(PLINT) idata[0].length;
836
837 c_plimage( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax,
838 Dymin, Dymax );
839 }
840
841 // Set up a new line style
842 void plstyl( PLINT[] mark, PLINT[] space )
843 {
844 PLINT nms = cast(PLINT) mark.length;
845 assert( nms == space.length, "plstyl(): Arrays must be of same length!" );
846 c_plstyl( nms, mark.ptr, space.ptr );
847 }
848
849 // Plots the 3d surface representation of the function z[x][y].
850 void plsurf3d( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel = null )
851 {
852 PLINT nx = cast(PLINT) z.length;
853 PLINT ny = cast(PLINT) z[0].length;
854 assert( nx == x.length, "plsurf3d(): Arrays must be of same length!" );
855 assert( ny == y.length, "plsurf3d(): Arrays must be of same length!" );
856
857 if ( clevel )
858 c_plsurf3d( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length );
859 else
860 c_plsurf3d( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, null, 0 );
861 }
862
863 // Plots the 3d surface representation of the function z[x][y] with y
864 // index limits.
865 void plsurf3dl( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel,
866 PLINT ixstart, PLINT ixn, PLINT[] indexymin, PLINT[] indexymax )
867 {
868 PLINT nx = cast(PLINT) z.length;
869 PLINT ny = cast(PLINT) z[0].length;
870 assert( nx == x.length, "plsurf3d(): Arrays must be of same length!" );
871 assert( ny == y.length, "plsurf3d(): Arrays must be of same length!" );
872
873 c_plsurf3dl( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length,
874 ixstart, ixn, indexymin.ptr, indexymax.ptr );
875 }
876
877 // Plots array y against x for n points using Hershey symbol "code"
878 void plsym( PLFLT[] x, PLFLT[] y, PLINT code )
879 {
880 PLINT n = cast(PLINT) x.length;
881 assert( n == y.length, "plsym(): Arrays must be of same length!" );
882 c_plsym( n, x.ptr, y.ptr, code );
883 }
884
885 // Set the format for date / time labels
886 void pltimefmt( string fmt )
887 {
888 c_pltimefmt( toStringz( fmt ) );
889 }
890
891 //--------------------------------------------------------------------------
892 // Functions for use from C or C++ only
893 //--------------------------------------------------------------------------
894
895 // Returns a list of file-oriented device names and their menu strings
896 //void plgFileDevs(char ***p_menustr, char ***p_devname, int *p_ndev);
897
898 // Returns a list of all device names and their menu strings
899 //void plgDevs(char ***p_menustr, char ***p_devname, int *p_ndev);
900
901 // Set the function pointer for the keyboard event handler
902 //void plsKeyEH(void function(PLGraphicsIn *, void *, int *)KeyEH, void *KeyEH_data);
903
904 // Set the function pointer for the (mouse) button event handler
905 //void plsButtonEH(void function(PLGraphicsIn *, void *, int *)ButtonEH, void *ButtonEH_data);
906
907 // Sets an optional user bop handler
908 //void plsbopH(void function(void *, int *)handler, void *handler_data);
909
910 // Sets an optional user eop handler
911 //void plseopH(void function(void *, int *)handler, void *handler_data);
912
913 // Set the variables to be used for storing error info
914 //void plsError(PLINT *errcode, char *errmsg)
915 //{
916 //}
917
918 // Sets an optional user exit handler.
919 //void plsexit(int function(char *)handler);
920
921 // Sets an optional user abort handler.
922 //void plsabort(void function(char *)handler);
923
924 // Function evaluators
925
926 // Does a lookup from a 2d function array. Array is of type (PLFLT **),
927 // and is column dominant (normal C ordering).
928 //PLFLT plf2eval2(PLINT ix, PLINT iy, PLPointer plf2eval_data);
929
930 // Does a lookup from a 2d function array. Array is of type (PLFLT *),
931 // and is column dominant (normal C ordering).
932 //PLFLT plf2eval(PLINT ix, PLINT iy, PLPointer plf2eval_data);
933
934 // Does a lookup from a 2d function array. Array is of type (PLFLT *),
935 // and is row dominant (Fortran ordering).
936 //PLFLT plf2evalr(PLINT ix, PLINT iy, PLPointer plf2eval_data);
937
938 // Command line parsing utilities
939
940 // Merge user option table into internal info structure.
941 //int plMergeOpts(PLOptionTable *options, char *name, char **notes);
942
943 // Set the strings used in usage and syntax messages.
944 //void plSetUsage(char *program_string, char *usage_string);
945
946 // Process input strings, treating them as an option and argument pair.
947 // The first is for the external API, the second the work routine declared
948 // here for backward compatibilty.
949 int plsetopt( string opt, string optarg )
950 {
951 return c_plsetopt( toStringz( opt ), toStringz( optarg ) );
952 }
953
954 // Miscellaneous
955
956 // Get the escape character for text strings.
957 //void plgesc(char *p_esc);
958
959 // Front-end to driver escape function.
960 //void pl_cmd(PLINT op, void *ptr);
961
962 // Return full pathname for given file if executable
963 //int plFindName(char *p);
964
965 // Looks for the specified executable file according to usual search path.
966 //char * plFindCommand(char *fn);
967
968 // Gets search name for file by concatenating the dir, subdir, and file
969 // name, allocating memory as needed.
970 //void plGetName(char *dir, char *subdir, char *filename, char **filespec);
971
972 // Prompts human to input an integer in response to given message.
973 //PLINT plGetInt(char *s);
974
975 // Prompts human to input a float in response to given message.
976 //PLFLT plGetFlt(char *s);
977
978 // Find the maximum and minimum of a 2d matrix allocated with plAllc2dGrid().
979 void plMinMax2dGrid( PLFLT[][] f, out PLFLT fmax, out PLFLT fmin )
980 {
981 plMinMax2dGrid( convert_array( f ), cast(PLINT) f.length, cast(PLINT) f[0].length, &fmax, &fmin );
982 }
983
984 // Wait for graphics input event and translate to world coordinates
985 //int plGetCursor(PLGraphicsIn *gin);
986
987 // Translates relative device coordinates to world coordinates.
988 //int plTranslateCursor(PLGraphicsIn *gin);
989
990
991
992 extern ( C ) :
993
994 alias double PLFLT;
995
996 // This is apparently portable if stdint.h exists.
997 // A reasonable back-up in case stdint.h does not exist on the platform.
998 alias uint PLUNICODE;
999 alias int PLINT;
1000
1001 // For identifying logical (boolean) arguments
1002 alias PLINT PLBOOL;
1003
1004 // For passing user data, as with X's XtPointer
1005 alias void* PLPointer;
1006
1007 //--------------------------------------------------------------------------
1008 // Complex data types and other good stuff
1009 //--------------------------------------------------------------------------
1010
1011 // Switches for escape function call.
1012 // Some of these are obsolete but are retained in order to process
1013 // old metafiles.
1014
1015 const PLESC_SET_RGB = 1;
1016 const PLESC_ALLOC_NCOL = 2;
1017 const PLESC_SET_LPB = 3;
1018 const PLESC_EXPOSE = 4;
1019 const PLESC_RESIZE = 5;
1020 const PLESC_REDRAW = 6;
1021 const PLESC_TEXT = 7;
1022 const PLESC_GRAPH = 8;
1023 const PLESC_FILL = 9;
1024 const PLESC_DI = 10;
1025 const PLESC_FLUSH = 11;
1026 const PLESC_EH = 12;
1027 const PLESC_GETC = 13;
1028 const PLESC_SWIN = 14;
1029 const PLESC_DOUBLEBUFFERING = 15;
1030 const PLESC_XORMOD = 16;
1031 const PLESC_SET_COMPRESSION = 17;
1032 const PLESC_CLEAR = 18;
1033 const PLESC_DASH = 19;
1034 const PLESC_HAS_TEXT = 20;
1035 const PLESC_IMAGE = 21;
1036 const PLESC_IMAGEOPS = 22;
1037 const PLESC_PL2DEVCOL = 23;
1038 const PLESC_DEV2PLCOL = 24;
1039 const PLESC_SETBGFG = 25;
1040 const PLESC_DEVINIT = 26;
1041
1042 // image operations
1043 const ZEROW2B = 1;
1044 const ZEROW2D = 2;
1045 const ONEW2B = 3;
1046 const ONEW2D = 4;
1047
1048 // Window parameter tags
1049 const PLSWIN_DEVICE = 1;
1050 const PLSWIN_WORLD = 2;
1051
1052 // Axis label tags
1053 const PL_X_AXIS = 1; // The x-axis
1054 const PL_Y_AXIS = 2; // The y-axis
1055 const PL_Z_AXIS = 3; // The z-axis
1056
1057 // PLplot Option table & support constants
1058
1059 // Option-specific settings
1060 const PL_OPT_ENABLED = 0x0001;
1061 const PL_OPT_ARG = 0x0002;
1062 const PL_OPT_NODELETE = 0x0004;
1063 const PL_OPT_INVISIBLE = 0x0008;
1064 const PL_OPT_DISABLED = 0x0010;
1065
1066 // Option-processing settings -- mutually exclusive
1067 const PL_OPT_FUNC = 0x0100;
1068 const PL_OPT_BOOL = 0x0200;
1069 const PL_OPT_INT = 0x0400;
1070 const PL_OPT_FLOAT = 0x0800;
1071 const PL_OPT_STRING = 0x1000;
1072
1073 // Global mode settings
1074 // These override per-option settings
1075 const PL_PARSE_PARTIAL = 0x0000;
1076 const PL_PARSE_FULL = 0x0001;
1077 const PL_PARSE_QUIET = 0x0002;
1078
1079 // processing
1080 const PL_PARSE_NODELETE = 0x0004;
1081 const PL_PARSE_SHOWALL = 0x0008;
1082 const PL_PARSE_OVERRIDE = 0x0010;
1083 const PL_PARSE_NOPROGRAM = 0x0020;
1084 const PL_PARSE_NODASH = 0x0040;
1085 const PL_PARSE_SKIP = 0x0080;
1086
1087 // FCI (font characterization integer) related constants.
1088 const PL_FCI_MARK = 0x80000000;
1089 const PL_FCI_IMPOSSIBLE = 0x00000000;
1090 const PL_FCI_HEXDIGIT_MASK = 0xf;
1091 const PL_FCI_HEXPOWER_MASK = 0x7;
1092
1093 // These define hexpower values corresponding to each font attribute.
1094 const PL_FCI_HEXPOWER_IMPOSSIBLE = 0xf;
1095 const PL_FCI_FAMILY = 0x0;
1096 const PL_FCI_STYLE = 0x1;
1097
1098 // These are legal values for font family attribute
1099 const PL_FCI_WEIGHT = 0x2;
1100 const PL_FCI_SANS = 0x0;
1101 const PL_FCI_SERIF = 0x1;
1102 const PL_FCI_MONO = 0x2;
1103 const PL_FCI_SCRIPT = 0x3;
1104
1105 // These are legal values for font style attribute
1106 const PL_FCI_SYMBOL = 0x4;
1107 const PL_FCI_UPRIGHT = 0x0;
1108 const PL_FCI_ITALIC = 0x1;
1109
1110 // These are legal values for font weight attribute
1111 const PL_FCI_MEDIUM = 0x0;
1112 const PL_FCI_BOLD = 0x1;
1113 const PL_FCI_OBLIQUE = 0x2;
1114
1115 // Obsolete names
1116
1117 // Option table definition
1118
1119 struct _N1
1120 {
1121 string opt;
1122 int function( char *, char *, void * ) handler;
1123 void *client_data;
1124 void *var;
1125 int mode;
1126 string syntax;
1127 string desc;
1128 }
1129 alias _N1 PLOptionTable;
1130
1131 // PLplot Graphics Input structure
1132
1133
1134 const PL_MAXKEY = 16;
1135 struct _N2
1136 {
1137 int type;
1138 uint state;
1139 uint keysym;
1140 uint button;
1141 PLINT subwindow;
1142 char [16] string;
1143 int pX;
1144 int pY;
1145 PLFLT dX;
1146 PLFLT dY;
1147 PLFLT wX;
1148 PLFLT wY;
1149 }
1150 alias _N2 PLGraphicsIn;
1151
1152 // Structure for describing the plot window
1153
1154
1155 const PL_MAXWINDOWS = 64;
1156 struct _N3
1157 {
1158 PLFLT dxmi;
1159 PLFLT dxma;
1160 PLFLT dymi;
1161 PLFLT dyma;
1162 PLFLT wxmi;
1163 PLFLT wxma;
1164 PLFLT wymi;
1165 PLFLT wyma;
1166 }
1167 alias _N3 PLWindow;
1168
1169 // Structure for doing display-oriented operations via escape commands
1170 // May add other attributes in time
1171
1172 struct _N4
1173 {
1174 uint x;
1175 uint y;
1176 uint width;
1177 uint height;
1178 }
1179 alias _N4 PLDisplay;
1180
1181 // Macro used (in some cases) to ignore value of argument
1182 // I don't plan on changing the value so you can hard-code it
1183
1184 const int PL_NOTSET = -42;
1185
1186 // See plcont.c for examples of the following
1187
1188 //
1189 // PLfGrid is for passing (as a pointer to the first element) an arbitrarily
1190 // dimensioned array. The grid dimensions MUST be stored, with a maximum of 3
1191 // dimensions assumed for now.
1192 //
1193
1194 struct _N5
1195 {
1196 PLFLT *f;
1197 PLINT nx;
1198 PLINT ny;
1199 PLINT nz;
1200 }
1201 alias _N5 PLfGrid;
1202
1203 //
1204 // PLfGrid2 is for passing (as an array of pointers) a 2d function array. The
1205 // grid dimensions are passed for possible bounds checking.
1206 //
1207
1208 struct _N6
1209 {
1210 PLFLT **f;
1211 PLINT nx;
1212 PLINT ny;
1213 }
1214 alias _N6 PLfGrid2;
1215
1216 //
1217 // NOTE: a PLfGrid3 is a good idea here but there is no way to exploit it yet
1218 // so I'll leave it out for now.
1219 //
1220
1221 //
1222 // PLcGrid is for passing (as a pointer to the first element) arbitrarily
1223 // dimensioned coordinate transformation arrays. The grid dimensions MUST be
1224 // stored, with a maximum of 3 dimensions assumed for now.
1225 //
1226
1227 struct _N7
1228 {
1229 PLFLT *xg;
1230 PLFLT *yg;
1231 PLFLT *zg;
1232 PLINT nx;
1233 PLINT ny;
1234 PLINT nz;
1235 }
1236 alias _N7 c_PLcGrid;
1237
1238 //
1239 // PLcGrid2 is for passing (as arrays of pointers) 2d coordinate
1240 // transformation arrays. The grid dimensions are passed for possible bounds
1241 // checking.
1242 //
1243
1244 struct _N8
1245 {
1246 PLFLT **xg;
1247 PLFLT **yg;
1248 PLFLT **zg;
1249 PLINT nx;
1250 PLINT ny;
1251 }
1252 alias _N8 c_PLcGrid2;
1253
1254 //
1255 // NOTE: a PLcGrid3 is a good idea here but there is no way to exploit it yet
1256 // so I'll leave it out for now.
1257 //
1258
1259 // PLColor is the usual way to pass an rgb color value.
1260
1261 struct _N9
1262 {
1263 ubyte r;
1264 ubyte g;
1265 ubyte b;
1266 PLFLT a;
1267 char *name;
1268 }
1269 alias _N9 PLColor;
1270
1271 // PLControlPt is how cmap1 control points are represented.
1272
1273 struct _N10
1274 {
1275 PLFLT h;
1276 PLFLT l;
1277 PLFLT s;
1278 PLFLT p;
1279 PLFLT a;
1280 int alt_hue_path;
1281 }
1282 alias _N10 PLControlPt;
1283
1284 // A PLBufferingCB is a control block for interacting with devices
1285 // that support double buffering.
1286
1287 struct _N11
1288 {
1289 PLINT cmd;
1290 PLINT result;
1291 }
1292 alias _N11 PLBufferingCB;
1293
1294 const PLESC_DOUBLEBUFFERING_ENABLE = 1;
1295 const PLESC_DOUBLEBUFFERING_DISABLE = 2;
1296
1297 const PLESC_DOUBLEBUFFERING_QUERY = 3;
1298
1299 //--------------------------------------------------------------------------* * BRAINDEAD-ness
1300 //
1301 // Some systems allow the Fortran & C namespaces to clobber each other.
1302 // For PLplot to work from Fortran on these systems, we must name the the
1303 // externally callable C functions something other than their Fortran entry
1304 // names. In order to make this as easy as possible for the casual user,
1305 // yet reversible to those who abhor my solution, I have done the
1306 // following:
1307 //
1308 // The C-language bindings are actually different from those
1309 // described in the manual. Macros are used to convert the
1310 // documented names to the names used in this package. The
1311 // user MUST include plplot.h in order to get the name
1312 // redefinition correct.
1313 //
1314 // Sorry to have to resort to such an ugly kludge, but it is really the
1315 // best way to handle the situation at present. If all available
1316 // compilers offer a way to correct this stupidity, then perhaps we can
1317 // eventually reverse it.
1318 //
1319 // If you feel like screaming at someone (I sure do), please
1320 // direct it at your nearest system vendor who has a braindead shared
1321 // C/Fortran namespace. Some vendors do offer compiler switches that
1322 // change the object names, but then everybody who wants to use the
1323 // package must throw these same switches, leading to no end of trouble.
1324 //
1325 // Note that this definition should not cause any noticable effects except
1326 // when debugging PLplot calls, in which case you will need to remember
1327 // the real function names (same as before but with a 'c_' prepended).
1328 //
1329 // Also, to avoid macro conflicts, the BRAINDEAD part must not be expanded
1330 // in the stub routines.
1331 //
1332 // Aside: the reason why a shared Fortran/C namespace is deserving of the
1333 // BRAINDEAD characterization is that it completely precludes the the kind
1334 // of universal API that is attempted (more or less) with PLplot, without
1335 // Herculean efforts (e.g. remapping all of the C bindings by macros as
1336 // done here). The vendors of such a scheme, in order to allow a SINGLE
1337 // type of argument to be passed transparently between C and Fortran,
1338 // namely, a pointer to a conformable data type, have slammed the door on
1339 // insertion of stub routines to handle the conversions needed for other
1340 // data types. Intelligent linkers could solve this problem, but these are
1341 // not anywhere close to becoming universal. So meanwhile, one must live
1342 // with either stub routines for the inevitable data conversions, or a
1343 // different API. The former is what is used here, but is made far more
1344 // difficult in a braindead shared Fortran/C namespace.
1345 //--------------------------------------------------------------------------
1346
1347
1348
1349
1350 alias c_pl_setcontlabelformat pl_setcontlabelformat;
1351 alias c_pl_setcontlabelparam pl_setcontlabelparam;
1352 alias c_pladv pladv;
1353 //alias c_plaxes plaxes;
1354 //alias c_plbin plbin;
1355 alias c_plbop plbop;
1356 //alias c_plbox plbox;
1357 //alias c_plbox3 plbox3;
1358 alias c_plbtime plbtime;
1359 alias c_plslabelfunc plslabelfunc;
1360 alias c_plcalc_world plcalc_world;
1361 alias c_plarc plarc;
1362 alias c_plclear plclear;
1363 alias c_plcol0 plcol0;
1364 alias c_plcol1 plcol1;
1365 //alias c_plcolorbar plcolorbar;
1366 alias c_plconfigtime plconfigtime;
1367 //alias c_plcont plcont;
1368 alias c_plcpstrm plcpstrm;
1369 alias c_plctime plctime;
1370 alias c_plend plend;
1371 alias c_plend1 plend1;
1372 alias c_plenv plenv;
1373 alias c_plenv0 plenv0;
1374 alias c_pleop pleop;
1375 //alias c_plerrx plerrx;
1376 //alias c_plerry plerry;
1377 alias c_plfamadv plfamadv;
1378 //alias c_plfill plfill;
1379 //alias c_plfill3 plfill3;
1380 alias c_plflush plflush;
1381 alias c_plfont plfont;
1382 alias c_plfontld plfontld;
1383 alias c_plgchr plgchr;
1384 alias c_plgcol0 plgcol0;
1385 alias c_plgcolbg plgcolbg;
1386 alias c_plgcol0a plgcol0a;
1387 alias c_plgcolbga plgcolbga;
1388 alias c_plgcompression plgcompression;
1389 //alias c_plgdev plgdev;
1390 alias c_plgdidev plgdidev;
1391 alias c_plgdiori plgdiori;
1392 alias c_plgdiplt plgdiplt;
1393 alias c_plgfam plgfam;
1394 alias c_plgfci plgfci;
1395 //alias c_plgfnam plgfnam;
1396 alias c_plgfont plgfont;
1397 alias c_plglevel plglevel;
1398 alias c_plgpage plgpage;
1399 alias c_plgradient plgrdient;
1400 alias c_plgra plgra;
1401 //alias c_plgriddata plgriddata;
1402 alias c_plgspa plgspa;
1403 alias c_plgstrm plgstrm;
1404 //alias c_plgver plgver;
1405 alias c_plgvpd plgvpd;
1406 alias c_plgvpw plgvpw;
1407 alias c_plgxax plgxax;
1408 alias c_plgyax plgyax;
1409 alias c_plgzax plgzax;
1410 //alias c_plhist plhist;
1411 alias c_plhls plhls;
1412 alias c_plhlsrgb plhlsrgb;
1413 //alias c_plimage plimage;
1414 //alias c_plimagefr plimagefr;
1415 alias c_plinit plinit;
1416 alias c_pljoin pljoin;
1417 //alias c_pllab pllab;
1418 //alias c_pllegend pllegend;
1419 alias c_pllightsource pllightsource;
1420 //alias c_plline plline;
1421 alias c_plpath plpath;
1422 //alias c_plline3 plline3;
1423 alias c_pllsty pllsty;
1424 //alias c_plmap plmap;
1425 alias c_plmeridians plmeridians;
1426 //alias c_plmesh plmesh;
1427 //alias c_plmeshc plmeshc;
1428 alias c_plmkstrm plmkstrm;
1429 //alias c_plmtex plmtex;
1430 //alias c_plmtex3 plmtex3;
1431 //alias c_plot3d plot3d;
1432 //alias c_plot3dc plot3dc;
1433 //alias c_plot3dcl plot3dcl;
1434 //alias c_plparseopts plparseopts;
1435 //alias c_plpat plpat;
1436 //alias c_plpoin plpoin;
1437 //alias c_plpoin3 plpoin3;
1438 //alias c_plpoly3 plpoly3;
1439 alias c_plprec plprec;
1440 alias c_plpsty plpsty;
1441 //alias c_plptex plptex;
1442 //alias c_plptex3 plptex3;
1443 alias c_plrandd plrandd;
1444 alias c_plreplot plreplot;
1445 alias c_plrgb plrgb;
1446 alias c_plrgb1 plrgb1;
1447 alias c_plrgbhls plrgbhls;
1448 alias c_plschr plschr;
1449 //alias c_plscmap0 plscmap0;
1450 //alias c_plscmap0a plscmap0a;
1451 alias c_plscmap0n plscmap0n;
1452 //alias c_plscmap1 plscmap1;
1453 //alias c_plscmap1a plscmap1a;
1454 //alias c_plscmap1l plscmap1l;
1455 //alias c_plscmap1la plscmap1la;
1456 alias c_plscmap1n plscmap1n;
1457 alias c_plscmap1_range plscmap1_range;
1458 alias c_plscol0 plscol0;
1459 alias c_plscol0a plscol0a;
1460 alias c_plscolbg plscolbg;
1461 alias c_plscolbga plscolbga;
1462 alias c_plscolor plscolor;
1463 alias c_plscompression plscompression;
1464 // alias c_plsdev plsdev;
1465 alias c_plsdidev plsdidev;
1466 alias c_plsdimap plsdimap;
1467 alias c_plsdiori plsdiori;
1468 alias c_plsdiplt plsdiplt;
1469 alias c_plsdiplz plsdiplz;
1470 alias c_plseed plseed;
1471 alias c_plsesc plsesc;
1472 //alias c_plsetopt plsetopt;
1473 alias c_plsfam plsfam;
1474 alias c_plsfci plsfci;
1475 // alias c_plsfnam plsfnam;
1476 alias c_plsfont plsfont;
1477 //alias c_plshade plshade;
1478 //alias c_plshades plshades;
1479 alias c_plsmaj plsmaj;
1480 alias c_plsmem plsmem;
1481 alias c_plsmin plsmin;
1482 alias c_plsori plsori;
1483 alias c_plspage plspage;
1484 // alias c_plspal0 plspal0;
1485 // alias c_plspal1 plspal1;
1486 alias c_plspause plspause;
1487 alias c_plsstrm plsstrm;
1488 alias c_plssub plssub;
1489 alias c_plssym plssym;
1490 alias c_plstar plstar;
1491 //alias c_plstart plstart;
1492 alias c_plstransform plstransform;
1493 alias c_plstripa plstripa;
1494 //alias c_plstripc plstripc;
1495 alias c_plstripd plstripd;
1496 //alias c_plstring plstring;
1497 //alias c_plstring3 plstring3;
1498 //alias c_plstyl plstyl;
1499 //alias c_plsurf3d plsurf3d;
1500 //alias c_plsurf3dl plsurf3dl;
1501 //alias c_plsvect plsvect;
1502 alias c_plsvpa plsvpa;
1503 alias c_plsxax plsxax;
1504 alias c_plsyax plsyax;
1505 //alias c_plsym plsym;
1506 alias c_plszax plszax;
1507 alias c_pltext pltext;
1508 //alias c_pltimefmt pltimefmt;
1509 alias c_plvasp plvasp;
1510 //alias c_plvect plvect;
1511 alias c_plvpas plvpas;
1512 alias c_plvpor plvpor;
1513 alias c_plvsta plvsta;
1514 alias c_plw3d plw3d;
1515 alias c_plwidth plwidth;
1516 alias c_plwind plwind;
1517
1518 alias c_plxormod plxormod;
1519
1520
1521 // Redefine some old function names for backward compatibility
1522
1523
1524 alias pleop plclr;
1525 alias plbop plpage;
1526 alias plcol0 plcol;
1527 alias plfcont plcontf;
1528 alias plAlloc2dGrid Alloc2dGrid;
1529 alias plFree2dGrid Free2dGrid;
1530 alias plMinMax2dGrid MinMax2dGrid;
1531 alias plgvpd plP_gvpd;
1532 alias plgvpw plP_gvpw;
1533
1534
1535 //--------------------------------------------------------------------------* * Function Prototypes
1536 //--------------------------------------------------------------------------
1537
1538
1539 // All void types
1540 // C routines callable from stub routines come first
1541
1542 // set the format of the contour labels
1543 void c_pl_setcontlabelformat( PLINT lexp, PLINT sigdig );
1544
1545 // set offset and spacing of contour labels
1546 void c_pl_setcontlabelparam( PLFLT offset, PLFLT size, PLFLT spacing, PLINT active );
1547
1548 // Advance to subpage "page", or to the next one if "page" = 0.
1549 void c_pladv( PLINT page );
1550
1551 // simple arrow plotter.
1552 void c_plvect( PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale,
1553 void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data );
1554 void c_plsvect( PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLBOOL fill );
1555
1556 // This functions similarly to plbox() except that the origin of the axes
1557 // is placed at the user-specified point (x0, y0).
1558 void c_plaxes( PLFLT x0, PLFLT y0, const char *xopt, PLFLT xtick, PLINT nxsub,
1559 const char *yopt, PLFLT ytick, PLINT nysub );
1560
1561 // Flags for plbin() - opt argument
1562 const PL_BIN_DEFAULT = 0;
1563 const PL_BIN_CENTRED = 1;
1564 const PL_BIN_NOEXPAND = 2;
1565 const PL_BIN_NOEMPTY = 4;
1566
1567 // Plot a histogram using x to store data values and y to store frequencies
1568 void c_plbin( PLINT nbin, PLFLT *x, PLFLT *y, PLINT opt );
1569
1570 // Start new page. Should only be used with pleop().
1571 void c_plbop();
1572
1573 // This draws a box around the current viewport.
1574 void c_plbox( const char *xopt, PLFLT xtick, PLINT nxsub, const char *yopt, PLFLT ytick, PLINT nysub );
1575
1576 // This is the 3-d analogue of plbox().
1577 void c_plbox3( const char *xopt, const char *xlabel, PLFLT xtick, PLINT nsubx, const char *yopt,
1578 const char *ylabel, PLFLT ytick, PLINT nsuby, const char *zopt, const char *zlabel,
1579 PLFLT ztick, PLINT nsubz );
1580
1581 // Calculate broken-down time from continuous time for current stream.
1582 void c_plbtime( PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec, PLFLT ctime );
1583
1584 // Setup a user-provided custom labeling function
1585 void c_plslabelfunc( void function( PLINT, PLFLT, char*, PLINT, PLPointer ) labelfunc,
1586 PLPointer label_data );
1587
1588 // Calculate world coordinates and subpage from relative device coordinates.
1589 void c_plcalc_world( PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window );
1590
1591 // Plot an arc
1592 void c_plarc( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2,
1593 PLFLT rotate, PLBOOL fill );
1594
1595 // Clear current subpage.
1596 void c_plclear();
1597
1598 // Set color, map 0. Argument is integer between 0 and 15.
1599 void c_plcol0( PLINT icol0 );
1600
1601 // Set color, map 1. Argument is a float between 0. and 1.
1602 void c_plcol1( PLFLT col1 );
1603
1604
1605 // Configure transformation between continuous and broken-down time (and
1606 // vice versa) for current stream.
1607 void c_plconfigtime( PLFLT scale, PLFLT offset1, PLFLT offset2, PLINT ccontrol, PLBOOL ifbtime_offset,
1608 PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec );
1609
1610 // Draws a contour plot from data in f(nx,ny). Is just a front-end to
1611 // plfcont, with a particular choice for f2eval and f2eval_data.
1612 //
1613 void c_plcont( PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly,
1614 PLFLT *clevel, PLINT nlevel,
1615 void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data );
1616
1617 // Draws a contour plot using the function evaluator f2eval and data stored
1618 // by way of the f2eval_data pointer. This allows arbitrary organizations
1619 // of 2d array data to be used.
1620 //
1621 void plfcont( PLFLT function( PLINT, PLINT, PLPointer ) f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny,
1622 PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel,
1623 void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data );
1624
1625 // Copies state parameters from the reference stream to the current stream.
1626 void c_plcpstrm( PLINT iplsr, PLBOOL flags );
1627
1628 // Calculate continuous time from broken-down time for current stream.
1629 void c_plctime( PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec, PLFLT *ctime );
1630
1631 // Converts input values from relative device coordinates to relative plot
1632 // coordinates.
1633 void pldid2pc( PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax );
1634
1635 // Converts input values from relative plot coordinates to relative
1636 // device coordinates.
1637 void pldip2dc( PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax );
1638
1639 // End a plotting session for all open streams.
1640 void c_plend();
1641
1642 // End a plotting session for the current stream only.
1643 void c_plend1();
1644
1645 // Simple interface for defining viewport and window.
1646 void c_plenv( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis );
1647
1648 // similar to plenv() above, but in multiplot mode does not advance the subpage,
1649 // instead the current subpage is cleared
1650 void c_plenv0( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis );
1651
1652 // End current page. Should only be used with plbop().
1653 void c_pleop();
1654
1655 // Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i))
1656 void c_plerrx( PLINT n, PLFLT *xmin, PLFLT *xmax, PLFLT *y );
1657
1658 // Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i))
1659 void c_plerry( PLINT n, PLFLT *x, PLFLT *ymin, PLFLT *ymax );
1660
1661 // Advance to the next family file on the next new page
1662 void c_plfamadv();
1663
1664 // Pattern fills the polygon bounded by the input points.
1665 void c_plfill( PLINT n, PLFLT *x, PLFLT *y );
1666
1667 // Pattern fills the 3d polygon bounded by the input points.
1668 void c_plfill3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z );
1669
1670 // Flushes the output stream. Use sparingly, if at all.
1671 void c_plflush();
1672
1673 // Sets the global font flag to 'ifont'.
1674 void c_plfont( PLINT ifont );
1675
1676 // Load specified font set.
1677 void c_plfontld( PLINT fnt );
1678
1679 // Get character default height and current (scaled) height
1680 void c_plgchr( PLFLT *p_def, PLFLT *p_ht );
1681
1682 // Returns 8 bit RGB values for given color from color map 0
1683 void c_plgcol0( PLINT icol0, PLINT *r, PLINT *g, PLINT *b );
1684
1685 // Returns 8 bit RGB values for given color from color map 0 and alpha value
1686 void c_plgcol0a( PLINT icol0, PLINT *r, PLINT *g, PLINT *b, PLFLT *a );
1687
1688 // Returns the background color by 8 bit RGB value
1689 void c_plgcolbg( PLINT *r, PLINT *g, PLINT *b );
1690
1691 // Returns the background color by 8 bit RGB value and alpha value
1692 void c_plgcolbga( PLINT *r, PLINT *g, PLINT *b, PLFLT *a );
1693
1694 // Returns the current compression setting
1695 void c_plgcompression( PLINT *compression );
1696
1697 // Get the current device (keyword) name
1698 void c_plgdev( char *p_dev );
1699
1700 // Retrieve current window into device space
1701 void c_plgdidev( PLFLT *p_mar, PLFLT *p_aspect, PLFLT *p_jx, PLFLT *p_jy );
1702
1703 // Get plot orientation
1704 void c_plgdiori( PLFLT *p_rot );
1705
1706 // Retrieve current window into plot space
1707 void c_plgdiplt( PLFLT *p_xmin, PLFLT *p_ymin, PLFLT *p_xmax, PLFLT *p_ymax );
1708
1709 // Get FCI (font characterization integer)
1710
1711 void c_plgfci( PLUNICODE *pfci );
1712
1713 // Get family file parameters
1714
1715 void c_plgfam( PLINT *p_fam, PLINT *p_num, PLINT *p_bmax );
1716
1717 // Get the (current) output file name. Must be preallocated to >80 bytes
1718 void c_plgfnam( char *fnam );
1719
1720 // Get the current font family, style and weight
1721 void c_plgfont( PLINT *p_family, PLINT *p_style, PLINT *p_weight );
1722
1723 // Get the (current) run level.
1724 void c_plglevel( PLINT *p_level );
1725
1726 // Get output device parameters.
1727 void c_plgpage( PLFLT *p_xp, PLFLT *p_yp, PLINT *p_xleng, PLINT *p_yleng,
1728 PLINT *p_xoff, PLINT *p_yoff );
1729
1730 // Switches to graphics screen.
1731 void c_plgra();
1732
1733 // Draw gradient in polygon.
1734 void c_plgradient( PLINT n, PLFLT *x, PLFLT *y, PLFLT angle );
1735
1736 // grid irregularly sampled data
1737 void c_plgriddata( PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, PLFLT *xg, PLINT nptsx,
1738 PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data );
1739
1740 // type of gridding algorithm for plgriddata()
1741 const GRID_CSA = 1;
1742 const GRID_DTLI = 2;
1743 const GRID_NNI = 3;
1744 const GRID_NNIDW = 4;
1745 const GRID_NNLI = 5;
1746 const GRID_NNAIDW = 6;
1747
1748 // Get subpage boundaries in absolute coordinates
1749 void c_plgspa( PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax );
1750
1751 // Get current stream number.
1752 void c_plgstrm( PLINT *p_strm );
1753
1754 // Get the current library version number
1755 void c_plgver( char *p_ver );
1756
1757 // Get viewport boundaries in normalized device coordinates
1758 void c_plgvpd( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax );
1759
1760 // Get viewport boundaries in world coordinates
1761 void c_plgvpw( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax );
1762
1763 // Get x axis labeling parameters
1764 void c_plgxax( PLINT *p_digmax, PLINT *p_digits );
1765
1766 // Get y axis labeling parameters
1767 void c_plgyax( PLINT *p_digmax, PLINT *p_digits );
1768
1769 // Get z axis labeling parameters
1770 void c_plgzax( PLINT *p_digmax, PLINT *p_digits );
1771
1772 // Flags for plhist() - opt argument; note: some flags are passed to
1773 // plbin() for the actual plotting
1774 const PL_HIST_DEFAULT = 0;
1775 const PL_HIST_NOSCALING = 1;
1776 const PL_HIST_IGNORE_OUTLIERS = 2;
1777 const PL_HIST_NOEXPAND = 8;
1778 const PL_HIST_NOEMPTY = 16;
1779
1780 // Draws a histogram of n values of a variable in array data[0..n-1]
1781 void c_plhist( PLINT n, PLFLT *data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt );
1782
1783 // Set current color (map 0) by hue, lightness, and saturation.
1784 void c_plhls( PLFLT h, PLFLT l, PLFLT s );
1785
1786 // Functions for converting between HLS and RGB color space
1787 void c_plhlsrgb( PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b );
1788
1789 // Initializes PLplot, using preset or default options
1790 void c_plinit();
1791
1792 // Draws a line segment from (x1, y1) to (x2, y2).
1793 void c_pljoin( PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 );
1794
1795 // Simple routine for labelling graphs.
1796 void c_pllab( const char *xlabel, const char *ylabel, const char *tlabel );
1797
1798 // Flags used for position argument of both pllegend and plcolorbar
1799 const PL_POSITION_LEFT = 1;
1800 const PL_POSITION_RIGHT = 2;
1801 const PL_POSITION_TOP = 4;
1802 const PL_POSITION_BOTTOM = 8;
1803 const PL_POSITION_INSIDE = 16;
1804 const PL_POSITION_OUTSIDE = 32;
1805 const PL_POSITION_VIEWPORT = 64;
1806 const PL_POSITION_SUBPAGE = 128;
1807
1808 // Flags for pllegend
1809 const PL_LEGEND_NONE = 1;
1810 const PL_LEGEND_COLOR_BOX = 2;
1811 const PL_LEGEND_LINE = 4;
1812 const PL_LEGEND_SYMBOL = 8;
1813 const PL_LEGEND_TEXT_LEFT = 16;
1814 const PL_LEGEND_BACKGROUND = 32;
1815 const PL_LEGEND_BOUNDING_BOX = 64;
1816 const PL_LEGEND_ROW_MAJOR = 128;
1817
1818 // Flags for plcolorbar
1819 const PL_COLORBAR_LABEL_LEFT = 1;
1820 const PL_COLORBAR_LABEL_RIGHT = 2;
1821 const PL_COLORBAR_LABEL_TOP = 4;
1822 const PL_COLORBAR_LABEL_BOTTOM = 8;
1823 const PL_COLORBAR_IMAGE = 16;
1824 const PL_COLORBAR_SHADE = 32;
1825 const PL_COLORBAR_GRADIENT = 64;
1826 const PL_COLORBAR_CAP_NONE = 128;
1827 const PL_COLORBAR_CAP_LOW = 256;
1828 const PL_COLORBAR_CAP_HIGH = 512;
1829 const PL_COLORBAR_SHADE_LABEL = 1024;
1830 const PL_COLORBAR_ORIENT_RIGHT = 2048;
1831 const PL_COLORBAR_ORIENT_TOP = 4096;
1832 const PL_COLORBAR_ORIENT_LEFT = 8192;
1833 const PL_COLORBAR_ORIENT_BOTTOM = 16384;
1834 const PL_COLORBAR_BACKGROUND = 32768;
1835 const PL_COLORBAR_BOUNDING_BOX = 65536;
1836
1837
1838 // Routine for drawing discrete line, symbol, or cmap0 legends
1839 void c_pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height,
1840 PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT plot_width,
1841 PLINT bg_color, PLINT bb_color, PLINT bb_style,
1842 PLINT nrow, PLINT ncolumn,
1843 PLINT nlegend, PLINT *opt_array,
1844 PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing,
1845 PLFLT text_justification,
1846 PLINT *text_colors, const char **text,
1847 PLINT *box_colors, PLINT *box_patterns,
1848 PLFLT *box_scales, PLFLT *box_line_widths,
1849 PLINT *line_colors, PLINT *line_styles,
1850 PLFLT *line_widths,
1851 PLINT *symbol_colors, PLFLT *symbol_scales,
1852 PLINT *symbol_numbers, const char **symbols );
1853
1854 // Routine for drawing continous colour legends
1855 void c_plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height,
1856 PLINT opt, PLINT position, PLFLT x, PLFLT y,
1857 PLFLT x_length, PLFLT y_length,
1858 PLINT bg_color, PLINT bb_color, PLINT bb_style,
1859 PLFLT low_cap_color, PLFLT high_cap_color,
1860 PLINT cont_color, PLFLT cont_width,
1861 PLINT n_labels, const PLINT *label_opts, const char **label,
1862 PLINT n_axes, const char ** axis_opts,
1863 const PLFLT *ticks, const PLINT *sub_ticks,
1864 const PLINT *n_values, const PLFLT **values );
1865
1866 // Sets position of the light source
1867 void c_pllightsource( PLFLT x, PLFLT y, PLFLT z );
1868
1869 // Draws line segments connecting a series of points.
1870 void c_plline( PLINT n, PLFLT *x, PLFLT *y );
1871
1872 // Draws a line in 3 space.
1873 void c_plline3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z );
1874
1875 // Set line style.
1876 void c_pllsty( PLINT lin );
1877
1878 // plot continental outline in world coordinates
1879 void c_plmap( void function( PLINT, PLFLT *, PLFLT* ) mapform, const char *type, PLFLT minlong,
1880 PLFLT maxlong, PLFLT minlat, PLFLT maxlat );
1881
1882 // Plot the latitudes and longitudes on the background.
1883 void c_plmeridians( void function( PLINT, PLFLT *, PLFLT* ) mapform, PLFLT dlong, PLFLT dlat,
1884 PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat );
1885
1886 // Plots a mesh representation of the function z[x][y].
1887 void c_plmesh( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt );
1888
1889 // Plots a mesh representation of the function z[x][y] with contour
1890 void c_plmeshc( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt,
1891 PLFLT *clevel, PLINT nlevel );
1892
1893 // Creates a new stream and makes it the default.
1894 void c_plmkstrm( PLINT *p_strm );
1895
1896 // Prints out "text" at specified position relative to viewport
1897 void c_plmtex( const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text );
1898
1899 // Prints out "text" at specified position relative to viewport (3D)
1900 void c_plmtex3( const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text );
1901
1902 // Plots a 3-d representation of the function z[x][y].
1903 void c_plot3d( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLBOOL side );
1904
1905 // Plots a 3-d representation of the function z[x][y] with contour.
1906 void c_plot3dc( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt,
1907 PLFLT *clevel, PLINT nlevel );
1908
1909 // Plots a 3-d representation of the function z[x][y] with contour and
1910 // y index limits.
1911 void c_plot3dcl( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt,
1912 PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn,
1913 PLINT *indexymin, PLINT *indexymax );
1914
1915 //
1916 // definitions for the opt argument in plot3dc() and plsurf3d()
1917 //
1918 // DRAW_LINEX *must* be 1 and DRAW_LINEY *must* be 2, because of legacy code!
1919 //
1920 const DRAW_LINEX = 1 << 0; // draw lines parallel to the X axis
1921 const DRAW_LINEY = 1 << 1; // draw lines parallel to the Y axis
1922 const DRAW_LINEXY = DRAW_LINEX | DRAW_LINEY; // draw lines parallel to both the X and Y axis
1923 const MAG_COLOR = 1 << 2; // draw the mesh with a color dependent of the magnitude
1924 const BASE_CONT = 1 << 3; // draw contour plot at bottom xy plane
1925 const TOP_CONT = 1 << 4; // draw contour plot at top xy plane
1926 const SURF_CONT = 1 << 5; // draw contour plot at surface
1927 const DRAW_SIDES = 1 << 6; // draw sides
1928 const FACETED = 1 << 7; // draw outline for each square that makes up the surface
1929 const MESH = 1 << 8; // draw mesh
1930
1931 //
1932 // valid options for plot3dc():
1933 //
1934 // DRAW_SIDES, BASE_CONT, TOP_CONT (not yet),
1935 // MAG_COLOR, DRAW_LINEX, DRAW_LINEY, DRAW_LINEXY.
1936 //
1937 // valid options for plsurf3d():
1938 //
1939 // MAG_COLOR, BASE_CONT, SURF_CONT, FACETED, DRAW_SIDES.
1940 //
1941
1942 // Set fill pattern directly.
1943 void c_plpat( PLINT nlin, PLINT *inc, PLINT *del );
1944
1945 // Draw a line connecting two points, accounting for coordinate transforms
1946 void c_plpath( PLINT n, PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 );
1947
1948 // Plots array y against x for n points using ASCII code "code".
1949 void c_plpoin( PLINT n, PLFLT *x, PLFLT *y, PLINT code );
1950
1951 // Draws a series of points in 3 space.
1952 void c_plpoin3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT code );
1953
1954 // Draws a polygon in 3 space.
1955 void c_plpoly3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLBOOL *draw, PLBOOL ifcc );
1956
1957 // Plots array y against x for n points using (UTF-8) text string
1958 void c_plstring( PLINT n, PLFLT *x, PLFLT *y, const char *text );
1959
1960 // Draws a series of points (described by [UTF8] text string) in 3 space.
1961 void c_plstring3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, const char * text );
1962
1963 // Set the floating point precision (in number of places) in numeric labels.
1964 void c_plprec( PLINT setp, PLINT prec );
1965
1966 // Set fill pattern, using one of the predefined patterns.
1967 void c_plpsty( PLINT patt );
1968
1969 // Prints out "text" at world cooordinate (x,y).
1970 void c_plptex( PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, const char *text );
1971
1972 // Prints out "text" at world cooordinate (x,y,z).
1973 void c_plptex3( PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz, PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, const char *text );
1974
1975 // Random number generator based on Mersenne Twister.
1976 // Obtain real random number in range [0,1].
1977 PLFLT c_plrandd();
1978
1979 // Replays contents of plot buffer to current device/file.
1980 void c_plreplot();
1981
1982 // Set line color by red, green, blue from 0. to 1.
1983
1984 void c_plrgb( PLFLT r, PLFLT g, PLFLT b );
1985
1986 // Set line color by 8 bit RGB values.
1987
1988 void c_plrgb1( PLINT r, PLINT g, PLINT b );
1989
1990 // Functions for converting between HLS and RGB color space
1991
1992 void c_plrgbhls( PLFLT r, PLFLT g, PLFLT b, PLFLT *p_h, PLFLT *p_l, PLFLT *p_s );
1993
1994 // Set character height.
1995
1996 void c_plschr( PLFLT def, PLFLT scale );
1997
1998 // Set color map 0 colors by 8 bit RGB values
1999 void c_plscmap0( PLINT *r, PLINT *g, PLINT *b, PLINT ncol0 );
2000
2001 // Set color map 0 colors by 8 bit RGB values and alpha values
2002 void c_plscmap0a( PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol0 );
2003
2004 // Set number of colors in cmap 0
2005 void c_plscmap0n( PLINT ncol0 );
2006
2007 // Set color map 1 colors by 8 bit RGB values
2008 void c_plscmap1( PLINT *r, PLINT *g, PLINT *b, PLINT ncol1 );
2009
2010 // Set color map 1 colors by 8 bit RGB and alpha values
2011 void c_plscmap1a( PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol1 );
2012
2013 // Set color map 1 colors using a piece-wise linear relationship between
2014 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
2015 void c_plscmap1l( PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLBOOL *alt_hue_path );
2016
2017 // Set color map 1 colors using a piece-wise linear relationship between
2018 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
2019 // Will also linear interpolate alpha values.
2020 void c_plscmap1la( PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLFLT *a, PLBOOL *alt_hue_path );
2021
2022 // Set number of colors in cmap 1
2023 void c_plscmap1n( PLINT ncol1 );
2024
2025 // Set the color map 1 range used in continuous plots
2026 void c_plscmap1_range( PLFLT min_color, PLFLT max_color );
2027
2028 // Get the color map 1 range used in continuous plots
2029 void c_plgcmap1_range( PLFLT *min_color, PLFLT *max_color );
2030
2031 // Set a given color from color map 0 by 8 bit RGB value
2032 void c_plscol0( PLINT icol0, PLINT r, PLINT g, PLINT b );
2033
2034 // Set a given color from color map 0 by 8 bit RGB value
2035 void c_plscol0a( PLINT icol0, PLINT r, PLINT g, PLINT b, PLFLT a );
2036
2037 // Set the background color by 8 bit RGB value
2038 void c_plscolbg( PLINT r, PLINT g, PLINT b );
2039
2040 // Set the background color by 8 bit RGB value and alpha value
2041 void c_plscolbga( PLINT r, PLINT g, PLINT b, PLFLT a );
2042
2043 // Used to globally turn color output on/off
2044 void c_plscolor( PLINT color );
2045
2046 // Set the compression level
2047
2048 void c_plscompression( PLINT compression );
2049
2050 // Set the device (keyword) name
2051 void c_plsdev( const char *devname );
2052
2053 // Set window into device space using margin, aspect ratio, and
2054 // justification
2055
2056 void c_plsdidev( PLFLT mar, PLFLT aspect, PLFLT jx, PLFLT jy );
2057
2058 // Set up transformation from metafile coordinates.
2059
2060 void c_plsdimap( PLINT dimxmin, PLINT dimxmax, PLINT dimymin, PLINT dimymax, PLFLT dimxpmm, PLFLT dimypmm );
2061
2062 // Set plot orientation, specifying rotation in units of pi/2.
2063
2064 void c_plsdiori( PLFLT rot );
2065
2066 // Set window into plot space
2067
2068 void c_plsdiplt( PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax );
2069
2070 // Set window into plot space incrementally (zoom)
2071 void c_plsdiplz( PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax );
2072
2073 // Set seed for internal random number generator
2074 void c_plseed( uint s );
2075
2076 // Set the escape character for text strings.
2077 void c_plsesc( char esc );
2078
2079 // Set family file parameters
2080
2081 void c_plsfam( PLINT fam, PLINT num, PLINT bmax );
2082
2083 // Set FCI (font characterization integer)
2084
2085 void c_plsfci( PLUNICODE fci );
2086
2087 // Set the output file name.
2088 void c_plsfnam( const char *fnam );
2089
2090 // Set the current font family, style and weight
2091
2092 void c_plsfont( PLINT family, PLINT style, PLINT weight );
2093
2094 // Shade region.
2095 void c_plshade( PLFLT **a, PLINT nx, PLINT ny, PLINT function( PLFLT, PLFLT ) defined, PLFLT left,
2096 PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap,
2097 PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color,
2098 PLFLT max_width, void function( PLINT, PLFLT *, PLFLT* ) fill, PLBOOL rectangular,
2099 void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data );
2100
2101 void c_plshades( PLFLT **a, PLINT nx, PLINT ny, PLINT function( PLFLT, PLFLT ) defined, PLFLT xmin,
2102 PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT *clevel, PLINT nlevel, PLFLT fill_width,
2103 PLINT cont_color, PLFLT cont_width, void function( PLINT, PLFLT *, PLFLT* ) fill,
2104 PLBOOL rectangular, void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr,
2105 PLPointer pltr_data );
2106
2107 void plfshade( PLFLT function( PLINT, PLINT, PLPointer ) f2eval, PLPointer f2eval_data, PLFLT function( PLINT, PLINT, PLPointer ) c2eval, PLPointer c2eval_data, PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color, PLFLT max_width, void function( PLINT, PLFLT *, PLFLT * ) fill, PLBOOL rectangular, void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data );
2108
2109 // Set up lengths of major tick marks.
2110
2111 void c_plsmaj( PLFLT def, PLFLT scale );
2112
2113 // Set the memory area to be plotted (with the 'mem' driver)
2114
2115 void c_plsmem( PLINT maxx, PLINT maxy, void *plotmem );
2116
2117 // Set up lengths of minor tick marks.
2118
2119 void c_plsmin( PLFLT def, PLFLT scale );
2120
2121 // Set orientation. Must be done before calling plinit.
2122
2123 void c_plsori( PLINT ori );
2124
2125 // Set output device parameters. Usually ignored by the driver.
2126 void c_plspage( PLFLT xp, PLFLT yp, PLINT xleng, PLINT yleng, PLINT xoff, PLINT yoff );
2127
2128 // Set the colors for color table 0 from a cmap0 file
2129 void c_plspal0( const char* filename );
2130
2131 // Set the colors for color table 1 from a cmap1 file
2132 void c_plspal1( const char *filename, PLBOOL interpolate );
2133
2134 // Set the pause (on end-of-page) status
2135 void c_plspause( PLBOOL pause );
2136
2137 // Set stream number.
2138
2139 void c_plsstrm( PLINT strm );
2140
2141 // Set the number of subwindows in x and y
2142
2143 void c_plssub( PLINT nx, PLINT ny );
2144
2145 // Set symbol height.
2146
2147 void c_plssym( PLFLT def, PLFLT scale );
2148
2149 // Initialize PLplot, passing in the windows/page settings.
2150 void c_plstar( PLINT nx, PLINT ny );
2151
2152 // Initialize PLplot, passing the device name and windows/page settings.
2153 void c_plstart( const char *devname, PLINT nx, PLINT ny );
2154
2155 // Set the coordinate transform
2156 void c_plstransform( ct_func coordinate_transform = null, PLPointer coordinate_transform_data = null );
2157
2158 // Add a point to a stripchart.
2159 void c_plstripa( PLINT id, PLINT pen, PLFLT x, PLFLT y );
2160
2161 // Create 1d stripchart
2162 void c_plstripc( PLINT *id, const char *xspec, const char *yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLBOOL y_ascl, PLBOOL acc, PLINT colbox, PLINT collab, PLINT *colline, PLINT *styline, const char **legline, const char *labx, const char *laby, const char *labtop );
2163
2164 // Deletes and releases memory used by a stripchart.
2165 void c_plstripd( PLINT id );
2166
2167 // plots a 2d image (or a matrix too large for plshade() )
2168 void c_plimagefr( PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
2169 PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax,
2170 void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data );
2171
2172 // plots a 2d image (or a matrix too large for plshade() ) - colors
2173 // automatically scaled
2174 void c_plimage( PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
2175 PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax );
2176
2177 // Set up a new line style
2178 void c_plstyl( PLINT nms, PLINT *mark, PLINT *space );
2179
2180 // Plots the 3d surface representation of the function z[x][y].
2181 void c_plsurf3d( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt,
2182 PLFLT *clevel, PLINT nlevel );
2183
2184 // Plots the 3d surface representation of the function z[x][y] with y
2185 // index limits.
2186 void c_plsurf3dl( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel,
2187 PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT *indexymax );
2188
2189 // Sets the edges of the viewport to the specified absolute coordinates
2190 void c_plsvpa( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax );
2191
2192 // Set x axis labeling parameters
2193 void c_plsxax( PLINT digmax, PLINT digits );
2194
2195 // Set inferior X window
2196 void plsxwin( PLINT window_id );
2197
2198 // Set y axis labeling parameters
2199 void c_plsyax( PLINT digmax, PLINT digits );
2200
2201 // Plots array y against x for n points using Hershey symbol "code"
2202 void c_plsym( PLINT n, PLFLT *x, PLFLT *y, PLINT code );
2203
2204 // Set z axis labeling parameters
2205
2206 void c_plszax( PLINT digmax, PLINT digits );
2207
2208 // Switches to text screen.
2209
2210 void c_pltext();
2211
2212 // Set the format for date / time labels
2213 void c_pltimefmt( const char *fmt );
2214
2215 // Sets the edges of the viewport with the given aspect ratio, leaving
2216 // room for labels.
2217
2218 void c_plvasp( PLFLT aspect );
2219
2220 // Creates the largest viewport of the specified aspect ratio that fits
2221 // within the specified normalized subpage coordinates.
2222
2223 void c_plvpas( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT aspect );
2224
2225 // Creates a viewport with the specified normalized subpage coordinates.
2226
2227 void c_plvpor( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax );
2228
2229 // Defines a "standard" viewport with seven character heights for
2230 // the left margin and four character heights everywhere else.
2231
2232 void c_plvsta();
2233
2234 // Set up a window for three-dimensional plotting.
2235
2236 void c_plw3d( PLFLT basex, PLFLT basey, PLFLT height, PLFLT xmin0, PLFLT xmax0, PLFLT ymin0, PLFLT ymax0, PLFLT zmin0, PLFLT zmax0, PLFLT alt, PLFLT az );
2237
2238 // Set pen width.
2239
2240 void c_plwidth( PLFLT width );
2241
2242 // Set up world coordinates of the viewport boundaries (2d plots).
2243
2244 void c_plwind( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax );
2245
2246 // set xor mode; mode = 1-enter, 0-leave, status = 0 if not interactive device
2247
2248 void c_plxormod( PLBOOL mode, PLBOOL *status );
2249
2250 //--------------------------------------------------------------------------* * Functions for use from C or C++ only
2251 //--------------------------------------------------------------------------
2252
2253 // Returns a list of file-oriented device names and their menu strings
2254
2255 void plgFileDevs( char ***p_menustr, char ***p_devname, int *p_ndev );
2256
2257 // Returns a list of all device names and their menu strings
2258
2259 void plgDevs( char ***p_menustr, char ***p_devname, int *p_ndev );
2260
2261 // Set the function pointer for the keyboard event handler
2262
2263 void plsKeyEH( void function( PLGraphicsIn *, void *, int * ) KeyEH, void *KeyEH_data );
2264
2265 // Set the function pointer for the (mouse) button event handler
2266
2267 void plsButtonEH( void function( PLGraphicsIn *, void *, int * ) ButtonEH, void *ButtonEH_data );
2268
2269 // Sets an optional user bop handler
2270
2271 void plsbopH( void function( void *, int * ) handler, void *handler_data );
2272
2273 // Sets an optional user eop handler
2274
2275 void plseopH( void function( void *, int * ) handler, void *handler_data );
2276
2277 // Set the variables to be used for storing error info
2278
2279 void plsError( PLINT *errcode, const char *errmsg );
2280
2281 // Sets an optional user exit handler.
2282
2283 void plsexit( int function( const char * ) handler );
2284
2285 // Sets an optional user abort handler.
2286
2287 void plsabort( void function( const char * ) handler );
2288
2289 // Transformation routines
2290
2291 // Identity transformation.
2292 void pltr0( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data );
2293
2294 // Does linear interpolation from singly dimensioned coord arrays.
2295 void pltr1( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data );
2296
2297 // Does linear interpolation from doubly dimensioned coord arrays
2298 // (column dominant, as per normal C 2d arrays).
2299 void pltr2( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data );
2300
2301 // Just like pltr2() but uses pointer arithmetic to get coordinates from
2302 // 2d grid tables.
2303 void pltr2p( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data );
2304
2305 // Identity transformation for plots from Fortran.
2306 void pltr0f( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data );
2307
2308 // Does linear interpolation from doubly dimensioned coord arrays
2309 // (row dominant, i.e. Fortran ordering).
2310 void pltr2f( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data );
2311
2312 // Function evaluators
2313
2314 // Does a lookup from a 2d function array. Array is of type (PLFLT **),
2315 // and is column dominant (normal C ordering).
2316
2317 PLFLT plf2eval2( PLINT ix, PLINT iy, PLPointer plf2eval_data );
2318
2319 // Does a lookup from a 2d function array. Array is of type (PLFLT *),
2320 // and is column dominant (normal C ordering).
2321
2322 PLFLT plf2eval( PLINT ix, PLINT iy, PLPointer plf2eval_data );
2323
2324 // Does a lookup from a 2d function array. Array is of type (PLFLT *),
2325 // and is row dominant (Fortran ordering).
2326
2327 PLFLT plf2evalr( PLINT ix, PLINT iy, PLPointer plf2eval_data );
2328
2329 // Command line parsing utilities
2330 // Clear internal option table info structure.
2331 void plClearOpts();
2332
2333 // Reset internal option table info structure.
2334 void plResetOpts();
2335
2336 // Merge user option table into internal info structure.
2337
2338 int plMergeOpts( PLOptionTable *options, const char *name, const char **notes );
2339
2340 // Set the strings used in usage and syntax messages.
2341
2342 void plSetUsage( const char *program_string, const char *usage_string );
2343
2344 // Process input strings, treating them as an option and argument pair.
2345 // The first is for the external API, the second the work routine declared
2346 // here for backward compatibilty.
2347 int c_plsetopt( const char *opt, const char *optarg );
2348
2349 int plSetOpt( const char *opt, const char *optarg );
2350
2351 // Process options list using current options info.
2352 int c_plparseopts( int *p_argc, const char **argv, PLINT mode );
2353
2354 // Print usage & syntax message.
2355
2356 void plOptUsage();
2357
2358 // Miscellaneous
2359
2360 // Get the escape character for text strings.
2361
2362 void plgesc( char *p_esc );
2363
2364 // Front-end to driver escape function.
2365
2366 void pl_cmd( PLINT op, void *ptr );
2367
2368 // Return full pathname for given file if executable
2369
2370 int plFindName( char *p );
2371
2372 // Looks for the specified executable file according to usual search path.
2373
2374 char * plFindCommand( const char *fn );
2375
2376 // Gets search name for file by concatenating the dir, subdir, and file
2377 // name, allocating memory as needed.
2378
2379 void plGetName( const char *dir, const char *subdir, const char *filename, char **filespec );
2380
2381 // Prompts human to input an integer in response to given message.
2382
2383 PLINT plGetInt( const char *s );
2384
2385 // Prompts human to input a float in response to given message.
2386
2387 PLFLT plGetFlt( const char *s );
2388
2389 // Nice way to allocate space for a vectored 2d grid
2390
2391 // Allocates a block of memory for use as a 2-d grid of PLFLT's.
2392
2393 void plAlloc2dGrid( PLFLT ***f, PLINT nx, PLINT ny );
2394
2395 // Frees a block of memory allocated with plAlloc2dGrid().
2396
2397 void plFree2dGrid( PLFLT **f, PLINT nx, PLINT ny );
2398
2399 // Find the maximum and minimum of a 2d matrix allocated with plAllc2dGrid().
2400 void plMinMax2dGrid( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmax, PLFLT *fmin );
2401
2402 // Wait for graphics input event and translate to world coordinates
2403
2404 int plGetCursor( PLGraphicsIn *gin );
2405
2406 // Translates relative device coordinates to world coordinates.
2407
2408 int plTranslateCursor( PLGraphicsIn *gin );
2409