PLplot  5.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
plplotcanvas.c
Go to the documentation of this file.
1 // plplotcanvas - a GCW API and associated GnomeCanvas widget
2 //
3 // Copyright (C) 2004, 2005 Thomas J. Duck
4 // All rights reserved.
5 //
6 // Thomas J. Duck <tom.duck@dal.ca>
7 // Department of Physics and Atmospheric Science,
8 // Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5
9 //
10 //
11 // NOTICE
12 //
13 // This library is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation; either
16 // version 2.1 of the License, or (at your option) any later version.
17 //
18 // This library is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 // Lesser General Public License for more details.
22 //
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with this library; if not, write to the Free Software
25 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
26 // USA
27 //
28 //
29 // DESCRIPTION
30 //
31 // This module provides the PlplotCanvas widget which is derived from
32 // GnomeCanvas (see
33 // http://developer.gnome.org/doc/API/2.0/libgnomecanvas/index.html) .
34 //
35 //
36 
37 #include "plplotcanvas.h"
38 
39 
40 //--------------------------------------------------------------------------
41 // PlplotCanvas API
42 
43 static GObjectClass *parent_class = NULL;
44 
46 {
47  parent_class->dispose( G_OBJECT( self ) );
48 }
49 
51 {
52  // Flush the plplot buffers and close the stream
53  plsstrm( self->Nstream ); // Select stream before plplot call
54  plend1();
55 
56  // Call parent's finalize impletmentation
57  parent_class->finalize( G_OBJECT( self ) );
58 }
59 
60 static void plplot_canvas_init( PlplotCanvas *self )
61 {
62  char text_buffer[1000];
63  PLINT Nstream;
64 
65  plP_getinitdriverlist( text_buffer );
66  if ( text_buffer[0] != '\0' )
67  {
68  plmkstrm( &Nstream );
69  self->Nstream = (gint) Nstream;
70  }
71  else
72  self->Nstream = 0;
73 }
74 
76 {
77  parent_class = g_type_class_peek( G_TYPE_OBJECT );
78  GObjectClass* gobject_class = G_OBJECT_CLASS( klass );
79  gobject_class->dispose = (void *) plplot_canvas_dispose;
80  gobject_class->finalize = (void *) plplot_canvas_finalize;
81 }
82 
84 {
85  plscol0( 0, 255, 255, 255 ); // Change the plplot background color to white
86  plscol0( 15, 0, 0, 0 );
87 
88  // Use the hack variable to tell the driver to expect a PLESC_DEVINIT
89  // escape call to finish the driver initialization
90  //
91  plsc->hack = 1;
92 
93  plsdev( "gcw" ); // Set the device
94  plinit(); // Initialize the device
95  plP_esc( PLESC_DEVINIT, (void *) self ); // Install into the driver
96 }
97 
99 {
100  static GType this_type = 0;
101 
102  if ( !this_type )
103  {
104  static const GTypeInfo this_info = {
105  sizeof ( PlplotCanvasClass ),
106  NULL,
107  NULL,
108  (GClassInitFunc) plplot_canvas_class_init,
109  NULL,
110  NULL,
111  sizeof ( PlplotCanvas ),
112  0,
113  (GInstanceInitFunc) plplot_canvas_init,
114  };
115 
116  this_type = g_type_register_static( GNOME_TYPE_CANVAS, "PlplotCanvas",
117  &this_info, 0 );
118  }
119  return this_type;
120 }
121 
123 {
124  PlplotCanvas *canvas;
125 
126  canvas = PLPLOT_CANVAS( g_object_new( PLPLOT_TYPE_CANVAS, "aa", TRUE, NULL ) );
127 
128  plplot_canvas_devinit( canvas );
129 
130  return canvas;
131 }
132 
134 {
135  return self->Nstream;
136 }
137 
138 void plplot_canvas_set_size( PlplotCanvas* self, gint width, gint height )
139 {
140  plsstrm( self->Nstream ); // Select stream before plplot call
141  gcw_set_canvas_size( GNOME_CANVAS( self ), (PLINT) width, (PLINT) height );
142 }
143 
145 {
146  plsstrm( self->Nstream ); // Select stream before plplot call
147  gcw_set_canvas_zoom( GNOME_CANVAS( self ), (PLFLT) zoom );
148 }
149 
150 void plplot_canvas_use_text( PlplotCanvas* self, gboolean use_text )
151 {
152  plsstrm( self->Nstream ); // Select stream before plplot call
153  gcw_use_text( (PLINT) use_text );
154 }
155 
156 void plplot_canvas_use_pixmap( PlplotCanvas* self, gboolean use_pixmap )
157 {
158  plsstrm( self->Nstream ); // Select stream before plplot call
159  gcw_use_pixmap( (PLINT) use_pixmap );
160 }
161 
162 void plplot_canvas_use_persistence( PlplotCanvas* self, gboolean use_persistence )
163 {
164  plsstrm( self->Nstream ); // Select stream before plplot call
165  gcw_use_persistence( (PLINT) use_persistence );
166 }
167 
168 
169 //--------------------------------------------------------------------------
170 // Plplot wrappers - last updated 29 January 2005
171 //
172 // This should be kept up-to-date with plplot.h
173 //
174 //--------------------------------------------------------------------------
175 
176 // set the format of the contour labels
177 
179 {
180  plsstrm( self->Nstream );
181  pl_setcontlabelformat( lexp, sigdig );
182 }
183 
184 // set offset and spacing of contour labels
185 
186 void plplot_canvas_setcontlabelparam( PlplotCanvas* self, PLFLT offset, PLFLT size, PLFLT spacing, PLINT active )
187 {
188  plsstrm( self->Nstream );
189  pl_setcontlabelparam( offset, size, spacing, active );
190 }
191 
192 // Advance to subpage "page", or to the next one if "page" = 0.
193 
195 {
196  plsstrm( self->Nstream );
197  pladv( page );
198 }
199 
200 // simple arrow plotter.
201 
202 void plplot_canvas_vect( PlplotCanvas* self, PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data )
203 {
204  plsstrm( self->Nstream );
205  plvect( u, v, nx, ny, scale, pltr, pltr_data );
206 }
207 
208 void plplot_canvas_svect( PlplotCanvas* self, PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLINT fill )
209 {
210  plsstrm( self->Nstream );
211  plsvect( arrowx, arrowy, npts, fill );
212 }
213 
214 // This functions similarly to plbox() except that the origin of the axes
215 // is placed at the user-specified point (x0, y0).
216 
217 void plplot_canvas_axes( PlplotCanvas* self, PLFLT x0, PLFLT y0, const char *xopt, PLFLT xtick, PLINT nxsub, const char *yopt, PLFLT ytick, PLINT nysub )
218 {
219  plsstrm( self->Nstream );
220  plaxes( x0, y0, xopt, xtick, nxsub, yopt, ytick, nysub );
221 }
222 
223 // Plot a histogram using x to store data values and y to store frequencies
224 
225 void plplot_canvas_bin( PlplotCanvas* self, PLINT nbin, PLFLT *x, PLFLT *y, PLINT center )
226 {
227  plsstrm( self->Nstream );
228  plbin( nbin, x, y, center );
229 }
230 
231 // Start new page. Should only be used with pleop().
232 
234 {
235  plsstrm( self->Nstream );
236  plbop();
237 }
238 
239 // This draws a box around the current viewport.
240 
241 void plplot_canvas_box( PlplotCanvas* self, const char *xopt, PLFLT xtick, PLINT nxsub, const char *yopt, PLFLT ytick, PLINT nysub )
242 {
243  plsstrm( self->Nstream );
244  plbox( xopt, xtick, nxsub, yopt, ytick, nysub );
245 }
246 
247 // This is the 3-d analogue of plbox().
248 
249 void plplot_canvas_box3( PlplotCanvas* self, const char *xopt, const char *xlabel, PLFLT xtick, PLINT nsubx, const char *yopt, const char *ylabel, PLFLT ytick, PLINT nsuby, const char *zopt, const char *zlabel, PLFLT ztick, PLINT nsubz )
250 {
251  plsstrm( self->Nstream );
252  plbox3( xopt, xlabel, xtick, nsubx, yopt, ylabel, ytick, nsuby, zopt, zlabel, ztick, nsubz );
253 }
254 
255 // Calculate world coordinates and subpage from relative device coordinates.
256 
258 {
259  plsstrm( self->Nstream );
260  plcalc_world( rx, ry, wx, wy, window );
261 }
262 
263 // Clear current subpage.
264 
266 {
267  plsstrm( self->Nstream );
268  plclear();
269 }
270 
271 // Set color, map 0. Argument is integer between 0 and 15.
272 
274 {
275  plsstrm( self->Nstream );
276  plcol0( icol0 );
277 }
278 
279 // Set color, map 1. Argument is a float between 0. and 1.
280 
282 {
283  plsstrm( self->Nstream );
284  plcol1( col1 );
285 }
286 
287 // Draws a contour plot from data in f(nx,ny). Is just a front-end to
288 // plfcont, with a particular choice for f2eval and f2eval_data.
289 //
290 
291 void plplot_canvas_cont( PlplotCanvas* self, PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data )
292 {
293  plsstrm( self->Nstream );
294  plcont( f, nx, ny, kx, lx, ky, ly, clevel, nlevel, pltr, pltr_data );
295 }
296 
297 // Draws a contour plot using the function evaluator f2eval and data stored
298 // by way of the f2eval_data pointer. This allows arbitrary organizations
299 // of 2d array data to be used.
300 //
301 
302 void plplot_canvas_fcont( PlplotCanvas* self, PLFLT ( *f2eval )( PLINT, PLINT, PLPointer ), PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data )
303 {
304  plsstrm( self->Nstream );
305  plfcont( f2eval, f2eval_data, nx, ny, kx, lx, ky, ly, clevel, nlevel, pltr, pltr_data );
306 }
307 
308 // /\* Copies state parameters from the reference stream to the current stream. *\/
309 
310 // void plplot_canvas_cpstrm(PlplotCanvas* self, PLINT iplsr, PLINT flags) {
311 // plsstrm(self->Nstream);
312 // plcpstrm(iplsr, flags);
313 // }
314 
315 // Converts input values from relative device coordinates to relative plot
316 // coordinates.
317 
319 {
320  plsstrm( self->Nstream );
321  pldid2pc( xmin, ymin, xmax, ymax );
322 }
323 
324 // Converts input values from relative plot coordinates to relative
325 // device coordinates.
326 
328 {
329  plsstrm( self->Nstream );
330  pldip2dc( xmin, ymin, xmax, ymax );
331 }
332 
333 // /\* End a plotting session for all open streams. *\/
334 
335 // void plplot_canvas_end(PlplotCanvas* self) {
336 // plsstrm(self->Nstream);
337 // plend();
338 // }
339 
340 // /\* End a plotting session for the current stream only. *\/
341 
342 // void plplot_canvas_end1(PlplotCanvas* self) {
343 // plsstrm(self->Nstream);
344 // plend1();
345 // }
346 
347 // /\* Simple interface for defining viewport and window. *\/
348 
349 // void plplot_canvas_env(PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis) {
350 // plsstrm(self->Nstream);
351 // plenv(xmin, xmax, ymin, ymax, just, axis);
352 // }
353 
354 // /\* similar to plenv() above, but in multiplot mode does not advance the subpage,
355 // instead the current subpage is cleared *\/
356 
357 // void plplot_canvas_env0(PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis) {
358 // plsstrm(self->Nstream);
359 // plenv0(xmin, xmax, ymin, ymax, just, axis);
360 // }
361 
362 // End current page. Should only be used with plbop().
363 
365 {
366  plsstrm( self->Nstream );
367  pleop();
368 }
369 
370 // Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i))
371 
373 {
374  plsstrm( self->Nstream );
375  plerrx( n, xmin, xmax, y );
376 }
377 
378 // Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i))
379 
381 {
382  plsstrm( self->Nstream );
383  plerry( n, x, ymin, ymax );
384 }
385 
386 // /\* Advance to the next family file on the next new page *\/
387 
388 // void plplot_canvas_famadv(PlplotCanvas* self) {
389 // plsstrm(self->Nstream);
390 // plfamadv();
391 // }
392 
393 // Pattern fills the polygon bounded by the input points.
394 
396 {
397  plsstrm( self->Nstream );
398  plfill( n, x, y );
399 }
400 
401 // Pattern fills the 3d polygon bounded by the input points.
402 
404 {
405  plsstrm( self->Nstream );
406  plfill3( n, x, y, z );
407 }
408 
409 // /\* Flushes the output stream. Use sparingly, if at all. *\/
410 
411 // void plplot_canvas_flush(PlplotCanvas* self) {
412 // plsstrm(self->Nstream);
413 // plflush();
414 // }
415 
416 // Sets the global font flag to 'ifont'.
417 
419 {
420  plsstrm( self->Nstream );
421  plfont( ifont );
422 }
423 
424 // Load specified font set.
425 
427 {
428  plsstrm( self->Nstream );
429  plfontld( fnt );
430 }
431 
432 // Get character default height and current (scaled) height
433 
434 void plplot_canvas_gchr( PlplotCanvas* self, PLFLT *p_def, PLFLT *p_ht )
435 {
436  plsstrm( self->Nstream );
437  plgchr( p_def, p_ht );
438 }
439 
440 // Returns 8 bit RGB values for given color from color map 0
441 
442 void plplot_canvas_gcol0( PlplotCanvas* self, PLINT icol0, PLINT *r, PLINT *g, PLINT *b )
443 {
444  plsstrm( self->Nstream );
445  plgcol0( icol0, r, g, b );
446 }
447 
448 // Returns the background color by 8 bit RGB value
449 
451 {
452  plsstrm( self->Nstream );
453  plgcolbg( r, g, b );
454 }
455 
456 // Returns the current compression setting
457 
458 void plplot_canvas_gcompression( PlplotCanvas* self, PLINT *compression )
459 {
460  plsstrm( self->Nstream );
461  plgcompression( compression );
462 }
463 
464 // Get the current device (keyword) name
465 
466 void plplot_canvas_gdev( PlplotCanvas* self, char *p_dev )
467 {
468  plsstrm( self->Nstream );
469  plgdev( p_dev );
470 }
471 
472 // Retrieve current window into device space
473 
474 void plplot_canvas_gdidev( PlplotCanvas* self, PLFLT *p_mar, PLFLT *p_aspect, PLFLT *p_jx, PLFLT *p_jy )
475 {
476  plsstrm( self->Nstream );
477  plgdidev( p_mar, p_aspect, p_jx, p_jy );
478 }
479 
480 // Get plot orientation
481 
483 {
484  plsstrm( self->Nstream );
485  plgdiori( p_rot );
486 }
487 
488 // Retrieve current window into plot space
489 
490 void plplot_canvas_gdiplt( PlplotCanvas* self, PLFLT *p_xmin, PLFLT *p_ymin, PLFLT *p_xmax, PLFLT *p_ymax )
491 {
492  plsstrm( self->Nstream );
493  plgdiplt( p_xmin, p_ymin, p_xmax, p_ymax );
494 }
495 
496 // Get FCI (font characterization integer)
497 
499 {
500  plsstrm( self->Nstream );
501  plgfci( pfci );
502 }
503 
504 // /\* Get family file parameters *\/
505 
506 // void plplot_canvas_gfam(PlplotCanvas* self, PLINT *p_fam, PLINT *p_num, PLINT *p_bmax) {
507 // plsstrm(self->Nstream);
508 // plgfam(p_fam, p_num, p_bmax);
509 // }
510 
511 // Get the (current) output file name. Must be preallocated to >80 bytes
512 
513 void plplot_canvas_gfnam( PlplotCanvas* self, char *fnam )
514 {
515  plsstrm( self->Nstream );
516  plgfnam( fnam );
517 }
518 
519 // Get the (current) run level.
520 
521 void plplot_canvas_glevel( PlplotCanvas* self, PLINT *p_level )
522 {
523  plsstrm( self->Nstream );
524  plglevel( p_level );
525 }
526 
527 // Get output device parameters.
528 
529 void plplot_canvas_gpage( PlplotCanvas* self, PLFLT *p_xp, PLFLT *p_yp, PLINT *p_xleng, PLINT *p_yleng, PLINT *p_xoff, PLINT *p_yoff )
530 {
531  plsstrm( self->Nstream );
532  plgpage( p_xp, p_yp, p_xleng, p_yleng, p_xoff, p_yoff );
533 }
534 
535 // /\* Switches to graphics screen. *\/
536 
537 // void plplot_canvas_gra(PlplotCanvas* self) {
538 // plsstrm(self->Nstream);
539 // plgra();
540 // }
541 
542 // grid irregularly sampled data
543 
544 void plplot_canvas_griddata( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data )
545 {
546  plsstrm( self->Nstream );
547  plgriddata( x, y, z, npts, xg, nptsx, yg, nptsy, zg, type, data );
548 }
549 
550 // Get subpage boundaries in absolute coordinates
551 
553 {
554  plsstrm( self->Nstream );
555  plgspa( xmin, xmax, ymin, ymax );
556 }
557 
558 // /\* Get current stream number. *\/
559 
560 // void plplot_canvas_gstrm(PlplotCanvas* self, PLINT *p_strm) {
561 // plsstrm(self->Nstream);
562 // plgstrm(p_strm);
563 // }
564 
565 // Get the current library version number
566 
567 void plplot_canvas_gver( PlplotCanvas* self, char *p_ver )
568 {
569  plsstrm( self->Nstream );
570  plgver( p_ver );
571 }
572 
573 // Get viewport boundaries in normalized device coordinates
574 
575 void plplot_canvas_gvpd( PlplotCanvas* self, PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax )
576 {
577  plsstrm( self->Nstream );
578  plgvpd( p_xmin, p_xmax, p_ymin, p_ymax );
579 }
580 
581 // Get viewport boundaries in world coordinates
582 
583 void plplot_canvas_gvpw( PlplotCanvas* self, PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax )
584 {
585  plsstrm( self->Nstream );
586  plgvpw( p_xmin, p_xmax, p_ymin, p_ymax );
587 }
588 
589 // Get x axis labeling parameters
590 
591 void plplot_canvas_gxax( PlplotCanvas* self, PLINT *p_digmax, PLINT *p_digits )
592 {
593  plsstrm( self->Nstream );
594  plgxax( p_digmax, p_digits );
595 }
596 
597 // Get y axis labeling parameters
598 
599 void plplot_canvas_gyax( PlplotCanvas* self, PLINT *p_digmax, PLINT *p_digits )
600 {
601  plsstrm( self->Nstream );
602  plgyax( p_digmax, p_digits );
603 }
604 
605 // Get z axis labeling parameters
606 
607 void plplot_canvas_gzax( PlplotCanvas* self, PLINT *p_digmax, PLINT *p_digits )
608 {
609  plsstrm( self->Nstream );
610  plgzax( p_digmax, p_digits );
611 }
612 
613 // Draws a histogram of n values of a variable in array data[0..n-1]
614 
615 void plplot_canvas_hist( PlplotCanvas* self, PLINT n, PLFLT *data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT oldwin )
616 {
617  plsstrm( self->Nstream );
618  plhist( n, data, datmin, datmax, nbin, oldwin );
619 }
620 
621 // Set current color (map 0) by hue, lightness, and saturation.
622 
623 #ifdef PL_DEPRECATED
624 void plplot_canvas_hls( PlplotCanvas* self, PLFLT h, PLFLT l, PLFLT s )
625 {
626  plsstrm( self->Nstream );
627  plhls( h, l, s );
628 }
629 #endif // PL_DEPRECATED
630 
631 // /\* Initializes PLplot, using preset or default options *\/
632 
633 // void plplot_canvas_plinit(PlplotCanvas* self) {
634 // plsstrm(self->Nstream);
635 // plinit();
636 // }
637 
638 // Draws a line segment from (x1, y1) to (x2, y2).
639 
640 void plplot_canvas_join( PlplotCanvas* self, PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 )
641 {
642  plsstrm( self->Nstream );
643  pljoin( x1, y1, x2, y2 );
644 }
645 
646 // Simple routine for labelling graphs.
647 
648 void plplot_canvas_lab( PlplotCanvas* self, const char *xlabel, const char *ylabel, const char *tlabel )
649 {
650  plsstrm( self->Nstream );
651  pllab( xlabel, ylabel, tlabel );
652 }
653 
654 // Sets position of the light source
655 
657 {
658  plsstrm( self->Nstream );
659  pllightsource( x, y, z );
660 }
661 
662 // Draws line segments connecting a series of points.
663 
665 {
666  plsstrm( self->Nstream );
667  plline( n, x, y );
668 }
669 
670 // Draws a line in 3 space.
671 
673 {
674  plsstrm( self->Nstream );
675  plline3( n, x, y, z );
676 }
677 
678 // Set line style.
679 
681 {
682  plsstrm( self->Nstream );
683  pllsty( lin );
684 }
685 
686 // plot continental outline in world coordinates
687 
688 void plplot_canvas_map( PlplotCanvas* self, void ( *mapform )( PLINT, PLFLT *, PLFLT * ), char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat )
689 {
690  plsstrm( self->Nstream );
691  plmap( mapform, type, minlong, maxlong, minlat, maxlat );
692 }
693 
694 // Plot the latitudes and longitudes on the background.
695 
696 void plplot_canvas_meridians( PlplotCanvas* self, void ( *mapform )( PLINT, PLFLT *, PLFLT * ), PLFLT dlong, PLFLT dlat, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat )
697 {
698  plsstrm( self->Nstream );
699  plmeridians( mapform, dlong, dlat, minlong, maxlong, minlat, maxlat );
700 }
701 
702 // Plots a mesh representation of the function z[x][y].
703 
704 void plplot_canvas_mesh( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt )
705 {
706  plsstrm( self->Nstream );
707  plmesh( x, y, z, nx, ny, opt );
708 }
709 
710 // Plots a mesh representation of the function z[x][y] with contour
711 
712 void plplot_canvas_meshc( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel )
713 {
714  plsstrm( self->Nstream );
715  plmeshc( x, y, z, nx, ny, opt, clevel, nlevel );
716 }
717 
718 // /\* Creates a new stream and makes it the default. *\/
719 
720 // void plplot_canvas_plmkstrm(PlplotCanvas* self, PLINT *p_strm) {
721 // plsstrm(self->Nstream);
722 // plmkstrm(p_strm);
723 // }
724 
725 // Prints out "text" at specified position relative to viewport
726 
727 void plplot_canvas_mtex( PlplotCanvas* self, const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text )
728 {
729  plsstrm( self->Nstream );
730  plmtex( side, disp, pos, just, text );
731 }
732 
733 // Plots a 3-d representation of the function z[x][y].
734 
735 void plplot_canvas_plot3d( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLINT side )
736 {
737  plsstrm( self->Nstream );
738  plot3d( x, y, z, nx, ny, opt, side );
739 }
740 
741 // Plots a 3-d representation of the function z[x][y] with contour.
742 
743 void plplot_canvas_plot3dc( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel )
744 {
745  plsstrm( self->Nstream );
746  plot3dc( x, y, z, nx, ny, opt, clevel, nlevel );
747 }
748 
749 // Plots a 3-d representation of the function z[x][y] with contour and
750 // y index limits.
751 
752 void plplot_canvas_plot3dcl( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT*indexymax )
753 {
754  plsstrm( self->Nstream );
755  plot3dcl( x, y, z, nx, ny, opt, clevel, nlevel, ixstart, ixn, indexymin, indexymax );
756 }
757 
758 // Set fill pattern directly.
759 
760 void plplot_canvas_pat( PlplotCanvas* self, PLINT nlin, PLINT *inc, PLINT *del )
761 {
762  plsstrm( self->Nstream );
763  plpat( nlin, inc, del );
764 }
765 
766 // Plots array y against x for n points using ASCII code "code".
767 
768 void plplot_canvas_poin( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y, PLINT code )
769 {
770  plsstrm( self->Nstream );
771  plpoin( n, x, y, code );
772 }
773 
774 // Draws a series of points in 3 space.
775 
776 void plplot_canvas_poin3( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT code )
777 {
778  plsstrm( self->Nstream );
779  plpoin3( n, x, y, z, code );
780 }
781 
782 // Draws a polygon in 3 space.
783 
784 void plplot_canvas_poly3( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT *draw, PLINT ifcc )
785 {
786  plsstrm( self->Nstream );
787  plpoly3( n, x, y, z, draw, ifcc );
788 }
789 
790 // Set the floating point precision (in number of places) in numeric labels.
791 
792 void plplot_canvas_prec( PlplotCanvas* self, PLINT setp, PLINT prec )
793 {
794  plsstrm( self->Nstream );
795  plprec( setp, prec );
796 }
797 
798 // Set fill pattern, using one of the predefined patterns.
799 
801 {
802  plsstrm( self->Nstream );
803  plpsty( patt );
804 }
805 
806 // Prints out "text" at world cooordinate (x,y).
807 
808 void plplot_canvas_ptex( PlplotCanvas* self, PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, const char *text )
809 {
810  plsstrm( self->Nstream );
811  plptex( x, y, dx, dy, just, text );
812 }
813 
814 // Replays contents of plot buffer to current device/file.
815 
817 {
818  plsstrm( self->Nstream );
819  plreplot();
820 }
821 
822 #ifdef PL_DEPRECATED
823 // Set line color by red, green, blue from 0. to 1.
824 
825 void plplot_canvas_rgb( PlplotCanvas* self, PLFLT r, PLFLT g, PLFLT b )
826 {
827  plsstrm( self->Nstream );
828  plrgb( r, g, b );
829 }
830 
831 // Set line color by 8 bit RGB values.
832 
833 void plplot_canvas_rgb1( PlplotCanvas* self, PLINT r, PLINT g, PLINT b )
834 {
835  plsstrm( self->Nstream );
836  plrgb1( r, g, b );
837 }
838 #endif // PL_DEPRECATED
839 
840 // Set character height.
841 
842 void plplot_canvas_schr( PlplotCanvas* self, PLFLT def, PLFLT scale )
843 {
844  plsstrm( self->Nstream );
845  plschr( def, scale );
846 }
847 
848 // Set color map 0 colors by 8 bit RGB values
849 
850 void plplot_canvas_scmap0( PlplotCanvas* self, PLINT *r, PLINT *g, PLINT *b, PLINT ncol0 )
851 {
852  plsstrm( self->Nstream );
853  plscmap0( r, g, b, ncol0 );
854 }
855 
856 // Set number of colors in cmap 0
857 
859 {
860  plsstrm( self->Nstream );
861  plscmap0n( ncol0 );
862 }
863 
864 // Set color map 1 colors by 8 bit RGB values
865 
866 void plplot_canvas_scmap1( PlplotCanvas* self, PLINT *r, PLINT *g, PLINT *b, PLINT ncol1 )
867 {
868  plsstrm( self->Nstream );
869  plscmap1( r, g, b, ncol1 );
870 }
871 
872 // Set color map 1 colors using a piece-wise linear relationship between
873 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
874 
875 void plplot_canvas_scmap1l( PlplotCanvas* self, PLINT itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLINT *alt_hue_path )
876 {
877  plsstrm( self->Nstream );
878  plscmap1l( itype, npts, intensity, coord1, coord2, coord3, alt_hue_path );
879 }
880 
881 // Set number of colors in cmap 1
882 
884 {
885  plsstrm( self->Nstream );
886  plscmap1n( ncol1 );
887 }
888 
889 // Set a given color from color map 0 by 8 bit RGB value
890 
891 void plplot_canvas_scol0( PlplotCanvas* self, PLINT icol0, PLINT r, PLINT g, PLINT b )
892 {
893  plsstrm( self->Nstream );
894  plscol0( icol0, r, g, b );
895 }
896 
897 // Set the background color by 8 bit RGB value
898 
900 {
901  plsstrm( self->Nstream );
902  plscolbg( r, g, b );
903 }
904 
905 // Used to globally turn color output on/off
906 
908 {
909  plsstrm( self->Nstream );
910  plscolor( color );
911 }
912 
913 // Set the compression level
914 
916 {
917  plsstrm( self->Nstream );
918  plscompression( compression );
919 }
920 
921 // /\* Set the device (keyword) name *\/
922 
923 // void plplot_canvas_plsdev(PlplotCanvas* self, const char *devname) {
924 // plsstrm(self->Nstream);
925 // plsdev(devname);
926 // }
927 
928 // Set window into device space using margin, aspect ratio, and
929 // justification
930 
931 void plplot_canvas_sdidev( PlplotCanvas* self, PLFLT mar, PLFLT aspect, PLFLT jx, PLFLT jy )
932 {
933  plsstrm( self->Nstream );
934  plsdidev( mar, aspect, jx, jy );
935 }
936 
937 // Set up transformation from metafile coordinates.
938 
939 void plplot_canvas_sdimap( PlplotCanvas* self, PLINT dimxmin, PLINT dimxmax, PLINT dimymin, PLINT dimymax, PLFLT dimxpmm, PLFLT dimypmm )
940 {
941  plsstrm( self->Nstream );
942  plsdimap( dimxmin, dimxmax, dimymin, dimymax, dimxpmm, dimypmm );
943 }
944 
945 // Set plot orientation, specifying rotation in units of pi/2.
946 
948 {
949  plsstrm( self->Nstream );
950  plsdiori( rot );
951 }
952 
953 // Set window into plot space
954 
956 {
957  plsstrm( self->Nstream );
958  plsdiplt( xmin, ymin, xmax, ymax );
959 }
960 
961 // Set window into plot space incrementally (zoom)
962 
964 {
965  plsstrm( self->Nstream );
966  plsdiplz( xmin, ymin, xmax, ymax );
967 }
968 
969 // Set the escape character for text strings.
970 
971 void plplot_canvas_sesc( PlplotCanvas* self, char esc )
972 {
973  plsstrm( self->Nstream );
974  plsesc( esc );
975 }
976 
977 // /\* Set family file parameters *\/
978 
979 // void plplot_canvas_sfam(PlplotCanvas* self, PLINT fam, PLINT num, PLINT bmax) {
980 // plsstrm(self->Nstream);
981 // plsfam(fam, num, bmax);
982 // }
983 
984 // Set FCI (font characterization integer)
985 
987 {
988  plsstrm( self->Nstream );
989  plsfci( fci );
990 }
991 
992 // Set the output file name.
993 
994 void plplot_canvas_sfnam( PlplotCanvas* self, const char *fnam )
995 {
996  plsstrm( self->Nstream );
997  plsfnam( fnam );
998 }
999 
1000 // Shade region.
1001 
1002 void plplot_canvas_shade( PlplotCanvas* self, PLFLT **a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, PLINT min_color, PLINT min_width, PLINT max_color, PLINT max_width, void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data )
1003 {
1004  plsstrm( self->Nstream );
1005  plshade( a, nx, ny, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, fill, rectangular, pltr, pltr_data );
1006 }
1007 
1008 void plplot_canvas_shade1( PlplotCanvas* self, PLFLT *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, PLINT min_color, PLINT min_width, PLINT max_color, PLINT max_width, void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data )
1009 {
1010  plsstrm( self->Nstream );
1011  plshade1( a, nx, ny, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, fill, rectangular, pltr, pltr_data );
1012 }
1013 
1014 void plplot_canvas_shades( PlplotCanvas* self, PLFLT **a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT *clevel, PLINT nlevel, PLINT fill_width, PLINT cont_color, PLINT cont_width, void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data )
1015 {
1016  plsstrm( self->Nstream );
1017  plshades( a, nx, ny, defined, xmin, xmax, ymin, ymax, clevel, nlevel, fill_width, cont_color, cont_width, fill, rectangular, pltr, pltr_data );
1018 }
1019 
1020 void plplot_canvas_fshade( PlplotCanvas* self, PLFLT ( *f2eval )( PLINT, PLINT, PLPointer ), PLPointer f2eval_data, PLFLT ( *c2eval )( PLINT, PLINT, PLPointer ), 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, PLINT sh_width, PLINT min_color, PLINT min_width, PLINT max_color, PLINT max_width, void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data )
1021 {
1022  plsstrm( self->Nstream );
1023  plfshade( f2eval, f2eval_data, c2eval, c2eval_data, nx, ny, left, right, bottom, top, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, fill, rectangular, pltr, pltr_data );
1024 }
1025 
1026 // Set up lengths of major tick marks.
1027 
1028 void plplot_canvas_smaj( PlplotCanvas* self, PLFLT def, PLFLT scale )
1029 {
1030  plsstrm( self->Nstream );
1031  plsmaj( def, scale );
1032 }
1033 
1034 // /\* Set the memory area to be plotted (with the 'mem' driver) *\/
1035 
1036 // void plplot_canvas_smem(PlplotCanvas* self, PLINT maxx, PLINT maxy, void *plotmem) {
1037 // plsstrm(self->Nstream);
1038 // plsmem(maxx, maxy, plotmem);
1039 // }
1040 
1041 // Set up lengths of minor tick marks.
1042 
1043 void plplot_canvas_smin( PlplotCanvas* self, PLFLT def, PLFLT scale )
1044 {
1045  plsstrm( self->Nstream );
1046  plsmin( def, scale );
1047 }
1048 
1049 // /\* Set orientation. Must be done before calling plinit. *\/
1050 
1051 // void plplot_canvas_sori(PlplotCanvas* self, PLINT ori) {
1052 // plsstrm(self->Nstream);
1053 // plsori(ori);
1054 // }
1055 
1056 // Set output device parameters. Usually ignored by the driver.
1057 
1058 void plplot_canvas_spage( PlplotCanvas* self, PLFLT xp, PLFLT yp, PLINT xleng, PLINT yleng, PLINT xoff, PLINT yoff )
1059 {
1060  plsstrm( self->Nstream );
1061  plspage( xp, yp, xleng, yleng, xoff, yoff );
1062 }
1063 
1064 // /\* Set the pause (on end-of-page) status *\/
1065 
1066 // void plplot_canvas_spause(PlplotCanvas* self, PLINT pause) {
1067 // plsstrm(self->Nstream);
1068 // plspause(pause);
1069 // }
1070 
1071 // /\* Set stream number. *\/
1072 
1073 // void plplot_canvas_sstrm(PlplotCanvas* self, PLINT strm) {
1074 // plsstrm(self->Nstream);
1075 // plsstrm(strm);
1076 // }
1077 
1078 // Set the number of subwindows in x and y
1079 
1081 {
1082  plsstrm( self->Nstream );
1083  plssub( nx, ny );
1084 }
1085 
1086 // Set symbol height.
1087 
1088 void plplot_canvas_ssym( PlplotCanvas* self, PLFLT def, PLFLT scale )
1089 {
1090  plsstrm( self->Nstream );
1091  plssym( def, scale );
1092 }
1093 
1094 // /\* Initialize PLplot, passing in the windows/page settings. *\/
1095 
1096 // void plplot_canvas_star(PlplotCanvas* self, PLINT nx, PLINT ny) {
1097 // plsstrm(self->Nstream);
1098 // plstar(nx, ny);
1099 // }
1100 
1101 // /\* Initialize PLplot, passing the device name and windows/page settings. *\/
1102 
1103 // void plplot_canvas_start(PlplotCanvas* self, const char *devname, PLINT nx, PLINT ny) {
1104 // plsstrm(self->Nstream);
1105 // plstart(devname, nx, ny);
1106 // }
1107 
1108 // /\* Add a point to a stripchart. *\/
1109 
1110 // void plplot_canvas_stripa(PlplotCanvas* self, PLINT id, PLINT pen, PLFLT x, PLFLT y) {
1111 // plsstrm(self->Nstream);
1112 // plstripa(id, pen, x, y);
1113 // }
1114 
1115 // /\* Create 1d stripchart *\/
1116 
1117 // void plplot_canvas_stripc(PlplotCanvas* self, PLINT *id, char *xspec, char *yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLINT y_ascl, PLINT acc, PLINT colbox, PLINT collab, PLINT colline[], PLINT styline[], char *legline[], char *labx, char *laby, char *labtop) {
1118 // plsstrm(self->Nstream);
1119 // plstripc(id, xspec, yspec, xmin, xmax, xjump, ymin, ymax, xlpos, ylpos, y_ascl, acc, colbox, collab, colline, styline, legline, labx, laby, labtop);
1120 // }
1121 
1122 // /\* Deletes and releases memory used by a stripchart. *\/
1123 
1124 // void plplot_canvas_stripd(PlplotCanvas* self, PLINT id) {
1125 // plsstrm(self->Nstream);
1126 // plstripd(id);
1127 // }
1128 
1129 // plots a 2d image (or a matrix too large for plshade() )
1130 
1131 void plplot_canvas_image( PlplotCanvas* self, PLFLT **data, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax )
1132 {
1133  plsstrm( self->Nstream );
1134  plimage( data, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, Dymin, Dymax );
1135 }
1136 
1137 // Set up a new line style
1138 
1139 void plplot_canvas_styl( PlplotCanvas* self, PLINT nms, PLINT *mark, PLINT *space )
1140 {
1141  plsstrm( self->Nstream );
1142  plstyl( nms, mark, space );
1143 }
1144 
1145 // Plots the 3d surface representation of the function z[x][y].
1146 
1147 void plplot_canvas_surf3d( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel )
1148 {
1149  plsstrm( self->Nstream );
1150  plsurf3d( x, y, z, nx, ny, opt, clevel, nlevel );
1151 }
1152 
1153 // Plots the 3d surface representation of the function z[x][y] with y
1154 // index limits.
1155 
1156 void plplot_canvas_surf3dl( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT*indexymax )
1157 {
1158  plsstrm( self->Nstream );
1159  plsurf3dl( x, y, z, nx, ny, opt, clevel, nlevel, ixstart, ixn, indexymin, indexymax );
1160 }
1161 
1162 // Sets the edges of the viewport to the specified absolute coordinates
1163 
1164 void plplot_canvas_svpa( PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax )
1165 {
1166  plsstrm( self->Nstream );
1167  plsvpa( xmin, xmax, ymin, ymax );
1168 }
1169 
1170 // Set x axis labeling parameters
1171 
1172 void plplot_canvas_sxax( PlplotCanvas* self, PLINT digmax, PLINT digits )
1173 {
1174  plsstrm( self->Nstream );
1175  plsxax( digmax, digits );
1176 }
1177 
1178 // Set inferior X window
1179 
1180 void plplot_canvas_sxwin( PlplotCanvas* self, PLINT window_id )
1181 {
1182  plsstrm( self->Nstream );
1183  plsxwin( window_id );
1184 }
1185 
1186 // Set y axis labeling parameters
1187 
1188 void plplot_canvas_syax( PlplotCanvas* self, PLINT digmax, PLINT digits )
1189 {
1190  plsstrm( self->Nstream );
1191  plsyax( digmax, digits );
1192 }
1193 
1194 // Plots array y against x for n points using Hershey symbol "code"
1195 
1196 void plplot_canvas_sym( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y, PLINT code )
1197 {
1198  plsstrm( self->Nstream );
1199  plsym( n, x, y, code );
1200 }
1201 
1202 // Set z axis labeling parameters
1203 
1204 void plplot_canvas_szax( PlplotCanvas* self, PLINT digmax, PLINT digits )
1205 {
1206  plsstrm( self->Nstream );
1207  plszax( digmax, digits );
1208 }
1209 
1210 // Switches to text screen.
1211 
1213 {
1214  plsstrm( self->Nstream );
1215  pltext();
1216 }
1217 
1218 // Sets the edges of the viewport with the given aspect ratio, leaving
1219 // room for labels.
1220 
1222 {
1223  plsstrm( self->Nstream );
1224  plvasp( aspect );
1225 }
1226 
1227 // Creates the largest viewport of the specified aspect ratio that fits
1228 // within the specified normalized subpage coordinates.
1229 
1230 void plplot_canvas_vpas( PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT aspect )
1231 {
1232  plsstrm( self->Nstream );
1233  plvpas( xmin, xmax, ymin, ymax, aspect );
1234 }
1235 
1236 // Creates a viewport with the specified normalized subpage coordinates.
1237 
1238 void plplot_canvas_vpor( PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax )
1239 {
1240  plsstrm( self->Nstream );
1241  plvpor( xmin, xmax, ymin, ymax );
1242 }
1243 
1244 // Defines a "standard" viewport with seven character heights for
1245 // the left margin and four character heights everywhere else.
1246 
1248 {
1249  plsstrm( self->Nstream );
1250  plvsta();
1251 }
1252 
1253 // Set up a window for three-dimensional plotting.
1254 
1255 void plplot_canvas_w3d( PlplotCanvas* self, PLFLT basex, PLFLT basey, PLFLT height, PLFLT xmin0, PLFLT xmax0, PLFLT ymin0, PLFLT ymax0, PLFLT zmin0, PLFLT zmax0, PLFLT alt, PLFLT az )
1256 {
1257  plsstrm( self->Nstream );
1258  plw3d( basex, basey, height, xmin0, xmax0, ymin0, ymax0, zmin0, zmax0, alt, az );
1259 }
1260 
1261 // Set pen width.
1262 
1264 {
1265  plsstrm( self->Nstream );
1266  plwidth( width );
1267 }
1268 
1269 // Set up world coordinates of the viewport boundaries (2d plots).
1270 
1271 void plplot_canvas_wind( PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax )
1272 {
1273  plsstrm( self->Nstream );
1274  plwind( xmin, xmax, ymin, ymax );
1275 }
1276 
1277 // set xor mode; mode = 1-enter, 0-leave, status = 0 if not interactive device
1278 
1279 void plplot_canvas_xormod( PlplotCanvas* self, PLINT mode, PLINT *status )
1280 {
1281  plsstrm( self->Nstream );
1282  plxormod( mode, status );
1283 }
1284