PLplot
5.10.0
|
00001 // Converted to D from plplot_d.h by htod 00002 module plplot; 00003 00004 private import std.string; 00005 private import std.array; 00006 private import std.algorithm; 00007 private import std.stdio; 00008 private import std.conv; 00009 00010 // improved D interface 00011 00012 // certain functions must be declared as C functions so that PLplot 00013 // can handle them 00014 extern ( C ) { 00015 alias PLINT function( PLFLT, PLFLT ) def_func; 00016 alias void function( PLINT, PLFLT*, PLFLT* ) fill_func; 00017 alias void function( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ) pltr_func; 00018 alias void function( PLINT, PLFLT*, PLFLT* ) mapform_func; 00019 alias void function( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ) ct_func; 00020 } 00021 00022 // D definition of PLcGrid and PLcGrid2 00023 struct PLcGrid 00024 { 00025 PLFLT[] xg; 00026 PLFLT[] yg; 00027 PLFLT[] zg; 00028 } 00029 struct PLcGrid2 00030 { 00031 PLFLT[][] xg; 00032 PLFLT[][] yg; 00033 PLFLT[][] zg; 00034 } 00035 00036 // helper function to convert D dynamic arrays in C dynamic arrays 00037 private PLFLT** convert_array( PLFLT[][] a ) 00038 { 00039 if ( !a ) 00040 return null; 00041 00042 size_t nx = a.length; 00043 size_t ny = a[0].length; 00044 00045 PLFLT ** c_a = ( new PLFLT *[nx] ).ptr; 00046 for ( size_t i = 0; i < nx; i++ ) 00047 { 00048 assert( ny == a[i].length, "convert_array(): Array must be 2 dimensional!" ); 00049 c_a[i] = a[i].ptr; 00050 } 00051 00052 return c_a; 00053 } 00054 00055 // Process options list using current options info. 00056 int plparseopts( char[][] args, PLINT mode ) 00057 { 00058 char*[] c_args = new char*[args.length]; 00059 foreach ( size_t i, char[] arg; args ) 00060 c_args[i] = cast(char *) toStringz( arg ); 00061 int argc = cast(int) c_args.length; 00062 return c_plparseopts( &argc, cast(char**) c_args, mode ); 00063 } 00064 00065 // simple arrow plotter. 00066 void plvect( PLFLT[][] u, PLFLT[][] v, PLFLT scale, pltr_func pltr = null, PLPointer pltr_data = null ) 00067 { 00068 PLINT nx = cast(PLINT) u.length; 00069 PLINT ny = cast(PLINT) u[0].length; 00070 assert( nx == v.length, "plvect(): Arrays must be of same length!" ); 00071 assert( ny == v[0].length, "plvect(): Arrays must be of same length!" ); 00072 00073 c_plvect( convert_array( u ), convert_array( v ), nx, ny, scale, pltr, pltr_data ); 00074 } 00075 00076 void plvect( PLFLT[][] u, PLFLT[][] v, PLFLT scale, ref PLcGrid cgrid ) 00077 { 00078 PLINT nx = cast(PLINT) u.length; 00079 PLINT ny = cast(PLINT) u[0].length; 00080 assert( nx == v.length, "plvect(): Arrays must be of same length!" ); 00081 assert( ny == v[0].length, "plvect(): Arrays must be of same length!" ); 00082 00083 c_PLcGrid c; 00084 c.xg = cgrid.xg.ptr; 00085 c.nx = cast(PLINT) cgrid.xg.length; 00086 c.yg = cgrid.yg.ptr; 00087 c.ny = cast(PLINT) cgrid.yg.length; 00088 c.zg = cgrid.zg.ptr; 00089 c.nz = cast(PLINT) cgrid.zg.length; 00090 00091 c_plvect( convert_array( u ), convert_array( v ), nx, ny, scale, &pltr1, &c ); 00092 } 00093 00094 void plvect( PLFLT[][] u, PLFLT[][] v, PLFLT scale, ref PLcGrid2 cgrid2 ) 00095 { 00096 PLINT nx = cast(PLINT) u.length; 00097 PLINT ny = cast(PLINT) u[0].length; 00098 assert( nx == v.length, "plvect(): Arrays must be of same length!" ); 00099 assert( ny == v[0].length, "plvect(): Arrays must be of same length!" ); 00100 00101 c_PLcGrid2 c2; 00102 c2.xg = convert_array( cgrid2.xg ); 00103 c2.yg = convert_array( cgrid2.yg ); 00104 c2.zg = convert_array( cgrid2.zg ); 00105 c2.nx = cast(PLINT) cgrid2.xg.length; 00106 c2.ny = cast(PLINT) cgrid2.xg[0].length; 00107 if ( cgrid2.yg ) 00108 { 00109 assert( c2.nx == cgrid2.yg.length, "plvect(): Arrays must be of same length!" ); 00110 assert( c2.ny == cgrid2.yg[0].length, "plvect(): Arrays must be of same length!" ); 00111 } 00112 if ( cgrid2.zg ) 00113 { 00114 assert( c2.nx == cgrid2.zg.length, "plvect(): Arrays must be of same length!" ); 00115 assert( c2.ny == cgrid2.zg[0].length, "plvect(): Arrays must be of same length!" ); 00116 } 00117 00118 c_plvect( convert_array( u ), convert_array( v ), nx, ny, scale, &pltr2, &c2 ); 00119 } 00120 00121 void plsvect( PLFLT[] arrowx, PLFLT[] arrowy, PLBOOL fill ) 00122 { 00123 PLINT npts = cast(PLINT) arrowx.length; 00124 assert( npts == arrowy.length, "plsvect(): Arrays must be of same length!" ); 00125 c_plsvect( arrowx.ptr, arrowy.ptr, npts, fill ); 00126 } 00127 00128 // This functions similarly to plbox() except that the origin of the axes 00129 // is placed at the user-specified point (x0, y0). 00130 void plaxes( PLFLT x0, PLFLT y0, string xopt, PLFLT xtick, PLINT nxsub, 00131 string yopt, PLFLT ytick, PLINT nysub ) 00132 { 00133 c_plaxes( x0, y0, toStringz( xopt ), xtick, nxsub, toStringz( yopt ), ytick, nysub ); 00134 } 00135 00136 // Plot a histogram using x to store data values and y to store frequencies 00137 void plbin( PLFLT[] x, PLFLT[] y, PLINT opt ) 00138 { 00139 PLINT nbin = cast(PLINT) x.length; 00140 assert( nbin == y.length, "plbin(): Arrays must be of same length!" ); 00141 c_plbin( nbin, x.ptr, y.ptr, opt ); 00142 } 00143 00144 // This draws a box around the current viewport. 00145 void plbox( string xopt, PLFLT xtick, PLINT nxsub, string yopt, PLFLT ytick, PLINT nysub ) 00146 { 00147 c_plbox( toStringz( xopt ), xtick, nxsub, toStringz( yopt ), ytick, nysub ); 00148 } 00149 00150 // This is the 3-d analogue of plbox(). 00151 void plbox3( string xopt, string xlabel, PLFLT xtick, PLINT nsubx, 00152 string yopt, string ylabel, PLFLT ytick, PLINT nsuby, 00153 string zopt, string zlabel, PLFLT ztick, PLINT nsubz ) 00154 { 00155 c_plbox3( toStringz( xopt ), toStringz( xlabel ), xtick, nsubx, 00156 toStringz( yopt ), toStringz( ylabel ), ytick, nsuby, 00157 toStringz( zopt ), toStringz( zlabel ), ztick, nsubz ); 00158 } 00159 00160 // Routine for drawing continous colour legends 00161 void plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, 00162 PLINT opt, PLINT position, PLFLT x, PLFLT y, 00163 PLFLT x_length, PLFLT y_length, 00164 PLINT bg_color, PLINT bb_color, PLINT bb_style, 00165 PLFLT low_cap_color, PLFLT high_cap_color, 00166 PLINT cont_color, PLFLT cont_width, 00167 PLINT[] label_opts, string[] label, 00168 string[] axis_opts, 00169 PLFLT[] ticks, PLINT[] sub_ticks, 00170 PLFLT[][] values ) 00171 { 00172 PLINT n_labels = cast(PLINT) label_opts.length; 00173 PLINT n_axes = cast(PLINT) axis_opts.length; 00174 PLINT[] n_values = new PLINT[values.length]; 00175 for ( size_t i = 0; i < values.length; i++ ) 00176 { 00177 n_values[i] = cast(PLINT) values[i].length; 00178 } 00179 immutable( char ) * *labelz = array( map!toStringz( label ) ).ptr; 00180 immutable( char ) * *axis_optsz = array( map!toStringz( axis_opts ) ).ptr; 00181 assert( n_labels == label.length, "plcolorbar(): Arrays must be of same length!" ); 00182 assert( n_labels == label_opts.length, "plcolorbar(): Arrays must be of same length!" ); 00183 assert( n_axes == axis_opts.length, "plcolorbar(): Arrays must be of same length!" ); 00184 assert( n_axes == ticks.length, "plcolorbar(): Arrays must be of same length!" ); 00185 assert( n_axes == sub_ticks.length, "plcolorbar(): Arrays must be of same length!" ); 00186 00187 c_plcolorbar( p_colorbar_width, p_colorbar_height, 00188 opt, position, x, y, 00189 x_length, y_length, 00190 bg_color, bb_color, bb_style, 00191 low_cap_color, high_cap_color, 00192 cont_color, cont_width, 00193 n_labels, label_opts.ptr, labelz, 00194 n_axes, axis_optsz, 00195 ticks.ptr, sub_ticks.ptr, 00196 n_values.ptr, convert_array( values ) ); 00197 } 00198 00199 // Draws a contour plot from data in f(nx,ny). Is just a front-end to 00200 // plfcont, with a particular choice for f2eval and f2eval_data. 00201 // 00202 void plcont( PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel, 00203 pltr_func pltr, PLPointer pltr_data = null ) 00204 { 00205 PLINT nx = cast(PLINT) f.length; 00206 PLINT ny = cast(PLINT) f[0].length; 00207 00208 c_plcont( convert_array( f ), nx, ny, kx, lx, ky, ly, clevel.ptr, cast(PLINT) clevel.length, 00209 pltr, pltr_data ); 00210 } 00211 00212 void plcont( PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel, 00213 ref PLcGrid cgrid ) 00214 { 00215 PLINT nx = cast(PLINT) f.length; 00216 PLINT ny = cast(PLINT) f[0].length; 00217 00218 c_PLcGrid c; 00219 c.xg = cgrid.xg.ptr; 00220 c.nx = cast(PLINT) cgrid.xg.length; 00221 c.yg = cgrid.yg.ptr; 00222 c.ny = cast(PLINT) cgrid.yg.length; 00223 c.zg = cgrid.zg.ptr; 00224 c.nz = cast(PLINT) cgrid.zg.length; 00225 00226 c_plcont( convert_array( f ), nx, ny, kx, lx, ky, ly, clevel.ptr, cast(PLINT) clevel.length, 00227 &pltr1, &c ); 00228 } 00229 00230 void plcont( PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel, 00231 ref PLcGrid2 cgrid2 ) 00232 { 00233 PLINT nx = cast(PLINT) f.length; 00234 PLINT ny = cast(PLINT) f[0].length; 00235 00236 c_PLcGrid2 c2; 00237 c2.xg = convert_array( cgrid2.xg ); 00238 c2.yg = convert_array( cgrid2.yg ); 00239 c2.zg = convert_array( cgrid2.zg ); 00240 c2.nx = cast(PLINT) cgrid2.xg.length; 00241 c2.ny = cast(PLINT) cgrid2.xg[0].length; 00242 if ( cgrid2.yg ) 00243 { 00244 assert( c2.nx == cgrid2.yg.length, "plcont(): Arrays must be of same length!" ); 00245 assert( c2.ny == cgrid2.yg[0].length, "plcont(): Arrays must be of same length!" ); 00246 } 00247 if ( cgrid2.zg ) 00248 { 00249 assert( c2.nx == cgrid2.zg.length, "plcont(): Arrays must be of same length!" ); 00250 assert( c2.ny == cgrid2.zg[0].length, "plcont(): Arrays must be of same length!" ); 00251 } 00252 00253 c_plcont( convert_array( f ), nx, ny, kx, lx, ky, ly, clevel.ptr, cast(PLINT) clevel.length, 00254 &pltr2, &c2 ); 00255 } 00256 00257 // Draws a contour plot using the function evaluator f2eval and data stored 00258 // by way of the f2eval_data pointer. This allows arbitrary organizations 00259 // of 2d array data to be used. 00260 // 00261 //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); 00262 00263 // Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i)) 00264 void plerrx( PLFLT[] xmin, PLFLT[] xmax, PLFLT[] y ) 00265 { 00266 PLINT n = cast(PLINT) y.length; 00267 assert( n == xmin.length, "plerrx(): Arrays must be of same length!" ); 00268 assert( n == xmax.length, "plerrx(): Arrays must be of same length!" ); 00269 c_plerrx( n, xmin.ptr, xmax.ptr, y.ptr ); 00270 } 00271 00272 // Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i)) 00273 void plerry( PLFLT[] x, PLFLT[] ymin, PLFLT[] ymax ) 00274 { 00275 PLINT n = cast(PLINT) x.length; 00276 assert( n == ymin.length, "plerry(): Arrays must be of same length!" ); 00277 assert( n == ymax.length, "plerry(): Arrays must be of same length!" ); 00278 c_plerry( n, x.ptr, ymin.ptr, ymax.ptr ); 00279 } 00280 00281 // Pattern fills the polygon bounded by the input points. 00282 void plfill( PLFLT[] x, PLFLT[] y ) 00283 { 00284 PLINT n = cast(PLINT) x.length; 00285 assert( n == y.length, "plfill(): Arrays must be of same length!" ); 00286 c_plfill( n, x.ptr, y.ptr ); 00287 } 00288 00289 // Pattern fills the 3d polygon bounded by the input points. 00290 void plfill3( PLFLT[] x, PLFLT[] y, PLFLT[] z ) 00291 { 00292 PLINT n = cast(PLINT) x.length; 00293 assert( n == y.length, "plfill3(): Arrays must be of same length!" ); 00294 assert( n == z.length, "plfill3(): Arrays must be of same length!" ); 00295 c_plfill3( n, x.ptr, y.ptr, z.ptr ); 00296 } 00297 00298 // Get the current device (keyword) name 00299 void plgdev( out string p_dev ) 00300 { 00301 char cdev[1024]; 00302 c_plgdev( cdev.ptr ); 00303 p_dev = to!string( cdev.ptr ); 00304 } 00305 00306 // Get the (current) output file name. Must be preallocated to >80 bytes 00307 void plgfnam( out string fnam ) 00308 { 00309 char cfnam[1024]; 00310 c_plgfnam( cfnam.ptr ); 00311 fnam = to!string( cfnam.ptr ); 00312 } 00313 00314 // Draw gradient in polygon. 00315 void plgradient( PLFLT[] x, PLFLT[] y, PLFLT angle ) 00316 { 00317 PLINT n = cast(PLINT) x.length; 00318 assert( n == y.length, "plgradient(): Arrays must be of same length!" ); 00319 c_plgradient( n, x.ptr, y.ptr, angle ); 00320 } 00321 00322 // grid irregularly sampled data 00323 void plgriddata( PLFLT[] x, PLFLT[] y, PLFLT[] z, PLFLT[] xg, PLFLT[] yg, PLFLT[][] zg, PLINT type, PLFLT data ) 00324 { 00325 PLINT npts = cast(PLINT) x.length; 00326 assert( npts == y.length, "plgriddata(): Arrays must be of same length!" ); 00327 assert( npts == z.length, "plgriddata(): Arrays must be of same length!" ); 00328 00329 PLINT nxg = cast(PLINT) xg.length; 00330 PLINT nyg = cast(PLINT) yg.length; 00331 assert( nxg == zg.length, "plgriddata(): Arrays must be of same length!" ); 00332 assert( nyg == zg[0].length, "plgriddata(): Arrays must be of same length!" ); 00333 00334 c_plgriddata( x.ptr, y.ptr, z.ptr, npts, xg.ptr, nxg, yg.ptr, nyg, convert_array( zg ), type, data ); 00335 } 00336 00337 // Get the current library version number 00338 void plgver( out string p_ver ) 00339 { 00340 char cver[1024]; 00341 c_plgver( cver.ptr ); 00342 p_ver = to!string( cver.ptr ); 00343 } 00344 00345 // Draws a histogram of n values of a variable in array data[0..n-1] 00346 void plhist( PLFLT[] data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt ) 00347 { 00348 c_plhist( cast(PLINT) data.length, data.ptr, datmin, datmax, nbin, opt ); 00349 } 00350 00351 // Simple routine for labelling graphs. 00352 void pllab( string xlabel, string ylabel, string tlabel ) 00353 { 00354 c_pllab( toStringz( xlabel ), toStringz( ylabel ), toStringz( tlabel ) ); 00355 } 00356 00357 // Routine for drawing discrete line, symbol, or cmap0 legends 00358 void pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height, 00359 PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT plot_width, 00360 PLINT bg_color, PLINT bb_color, PLINT bb_style, 00361 PLINT nrow, PLINT ncolumn, 00362 PLINT[] opt_array, 00363 PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, 00364 PLFLT text_justification, 00365 PLINT[] text_colors, string[] text, 00366 PLINT[] box_colors, PLINT[] box_patterns, 00367 PLFLT[] box_scales, PLFLT[] box_line_widths, 00368 PLINT[] line_colors, PLINT[] line_styles, 00369 PLFLT[] line_widths, 00370 PLINT[] symbol_colors, PLFLT[] symbol_scales, 00371 PLINT[] symbol_numbers, string[] symbols ) 00372 { 00373 PLINT nlegend = cast(PLINT) opt_array.length; 00374 immutable( char ) * *textz = array( map!toStringz( text ) ).ptr; 00375 immutable( char ) * *symbolsz = array( map!toStringz( symbols ) ).ptr; 00376 assert( nlegend == text_colors.length, "pllegend(): Arrays must be of same length!" ); 00377 assert( nlegend == text.length, "pllegend(): Arrays must be of same length!" ); 00378 assert( box_colors == null || nlegend == box_colors.length, "pllegend(): Arrays must be of same length!" ); 00379 assert( box_patterns == null || nlegend == box_patterns.length, "pllegend(): Arrays must be of same length!" ); 00380 assert( box_scales == null || nlegend == box_scales.length, "pllegend(): Arrays must be of same length!" ); 00381 assert( box_line_widths == null || nlegend == box_line_widths.length, "pllegend(): Arrays must be of same length!" ); 00382 assert( line_colors == null || nlegend == line_colors.length, "pllegend(): Arrays must be of same length!" ); 00383 assert( line_styles == null || nlegend == line_styles.length, "pllegend(): Arrays must be of same length!" ); 00384 assert( line_widths == null || nlegend == line_widths.length, "pllegend(): Arrays must be of same length!" ); 00385 assert( symbol_colors == null || nlegend == symbol_colors.length, "pllegend(): Arrays must be of same length!" ); 00386 assert( symbol_scales == null || nlegend == symbol_scales.length, "pllegend(): Arrays must be of same length!" ); 00387 assert( symbol_numbers == null || nlegend == symbol_numbers.length, "pllegend(): Arrays must be of same length!" ); 00388 assert( symbols == null || nlegend == symbols.length, "pllegend(): Arrays must be of same length!" ); 00389 c_pllegend( p_legend_width, p_legend_height, 00390 opt, position, x, y, plot_width, 00391 bg_color, bb_color, bb_style, 00392 nrow, ncolumn, 00393 nlegend, opt_array.ptr, 00394 text_offset, text_scale, text_spacing, 00395 text_justification, 00396 text_colors.ptr, textz, 00397 box_colors.ptr, box_patterns.ptr, 00398 box_scales.ptr, box_line_widths.ptr, 00399 line_colors.ptr, line_styles.ptr, 00400 line_widths.ptr, 00401 symbol_colors.ptr, symbol_scales.ptr, 00402 symbol_numbers.ptr, symbolsz ); 00403 } 00404 00405 // Draws line segments connecting a series of points. 00406 void plline( PLFLT[] x, PLFLT[] y ) 00407 { 00408 PLINT n = cast(PLINT) x.length; 00409 assert( n == y.length, "plline(): Arrays must be of same length!" ); 00410 c_plline( n, x.ptr, y.ptr ); 00411 } 00412 00413 // Draws a line in 3 space. 00414 void plline3( PLFLT[] x, PLFLT[] y, PLFLT[] z ) 00415 { 00416 PLINT n = cast(PLINT) x.length; 00417 assert( n == y.length, "plline3(): Arrays must be of same length!" ); 00418 assert( n == z.length, "plline3(): Arrays must be of same length!" ); 00419 c_plline3( n, x.ptr, y.ptr, z.ptr ); 00420 } 00421 00422 // plot continental outline in world coordinates 00423 void plmap( mapform_func mapform, string type, PLFLT minlong, PLFLT maxlong, 00424 PLFLT minlat, PLFLT maxlat ) 00425 { 00426 c_plmap( mapform, toStringz( type ), minlong, maxlong, minlat, maxlat ); 00427 } 00428 00429 // Plots a mesh representation of the function z[x][y]. 00430 void plmesh( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt ) 00431 { 00432 PLINT nx = cast(PLINT) z.length; 00433 PLINT ny = cast(PLINT) z[0].length; 00434 00435 assert( nx == x.length, "plmesh(): Arrays must be of same length!" ); 00436 assert( ny == y.length, "plmesh(): Arrays must be of same length!" ); 00437 00438 c_plmesh( x.ptr, y.ptr, convert_array( z ), nx, ny, opt ); 00439 } 00440 00441 // Plots a mesh representation of the function z[x][y] with contour 00442 void plmeshc( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel ) 00443 { 00444 PLINT nx = cast(PLINT) z.length; 00445 PLINT ny = cast(PLINT) z[0].length; 00446 00447 assert( nx == x.length, "plmeshc(): Arrays must be of same length!" ); 00448 assert( ny == y.length, "plmeshc(): Arrays must be of same length!" ); 00449 00450 c_plmeshc( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length ); 00451 } 00452 00453 // Prints out "text" at specified position relative to viewport 00454 void plmtex( string side, PLFLT disp, PLFLT pos, PLFLT just, string text ) 00455 { 00456 c_plmtex( toStringz( side ), disp, pos, just, toStringz( text ) ); 00457 } 00458 00459 // Prints out "text" at specified position relative to viewport (3D) 00460 void plmtex3( string side, PLFLT disp, PLFLT pos, PLFLT just, string text ) 00461 { 00462 c_plmtex3( toStringz( side ), disp, pos, just, toStringz( text ) ); 00463 } 00464 00465 // Plots a 3-d representation of the function z[x][y]. 00466 void plot3d( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLBOOL side ) 00467 { 00468 PLINT nx = cast(PLINT) z.length; 00469 PLINT ny = cast(PLINT) z[0].length; 00470 00471 assert( nx == x.length, "plot3d(): Arrays must be of same length!" ); 00472 assert( ny == y.length, "plot3d(): Arrays must be of same length!" ); 00473 00474 c_plot3d( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, side ); 00475 } 00476 00477 // Plots a 3-d representation of the function z[x][y] with contour. 00478 void plot3dc( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel ) 00479 { 00480 PLINT nx = cast(PLINT) z.length; 00481 PLINT ny = cast(PLINT) z[0].length; 00482 00483 assert( nx == x.length, "plot3dc(): Arrays must be of same length!" ); 00484 assert( ny == y.length, "plot3dc(): Arrays must be of same length!" ); 00485 00486 c_plot3dc( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length ); 00487 } 00488 00489 // Plots a 3-d representation of the function z[x][y] with contour and 00490 // y index limits. 00491 void plot3dcl( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel, 00492 PLINT ixstart, PLINT ixn, PLINT[] indexymin, PLINT[] indexymax ) 00493 { 00494 PLINT nx = cast(PLINT) z.length; 00495 PLINT ny = cast(PLINT) z[0].length; 00496 00497 assert( nx == x.length, "plot3dcl(): Arrays must be of same length!" ); 00498 assert( ny == y.length, "plot3dcl(): Arrays must be of same length!" ); 00499 00500 c_plot3dcl( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length, 00501 ixstart, ixn, indexymin.ptr, indexymax.ptr ); 00502 } 00503 00504 // Set fill pattern directly. 00505 void plpat( PLINT[] inc, PLINT[] del ) 00506 { 00507 PLINT nlin = cast(PLINT) inc.length; 00508 assert( nlin == del.length, "plpat(): Arrays must be of same length!" ); 00509 c_plpat( nlin, inc.ptr, del.ptr ); 00510 } 00511 00512 // Plots array y against x for n points using ASCII code "code". 00513 void plpoin( PLFLT[] x, PLFLT[] y, PLINT code ) 00514 { 00515 PLINT n = cast(PLINT) x.length; 00516 assert( n == y.length, "plpoin(): Arrays must be of same length!" ); 00517 c_plpoin( n, x.ptr, y.ptr, code ); 00518 } 00519 00520 // Draws a series of points in 3 space. 00521 void plpoin3( PLFLT[] x, PLFLT[] y, PLFLT[] z, PLINT code ) 00522 { 00523 PLINT n = cast(PLINT) x.length; 00524 assert( n == y.length, "plpoin3(): Arrays must be of same length!" ); 00525 assert( n == z.length, "plpoin3(): Arrays must be of same length!" ); 00526 c_plpoin3( n, x.ptr, y.ptr, z.ptr, code ); 00527 } 00528 00529 // Plots array y against x for n points using (UTF-8) text string 00530 void plstring( PLFLT[] x, PLFLT[] y, string text ) 00531 { 00532 PLINT n = cast(PLINT) x.length; 00533 assert( n == y.length, "plstring(): Arrays must be of same length!" ); 00534 c_plstring( n, x.ptr, y.ptr, toStringz( text ) ); 00535 } 00536 00537 // Draws a series of points (described by [UTF8] text string) in 3 space. 00538 void plstring3( PLFLT[] x, PLFLT[] y, PLFLT[] z, string text ) 00539 { 00540 PLINT n = cast(PLINT) x.length; 00541 assert( n == y.length, "plstring3(): Arrays must be of same length!" ); 00542 assert( n == z.length, "plstring3(): Arrays must be of same length!" ); 00543 c_plstring3( n, x.ptr, y.ptr, z.ptr, toStringz( text ) ); 00544 } 00545 00546 // Draws a polygon in 3 space. 00547 void plpoly3( PLFLT[] x, PLFLT[] y, PLFLT[] z, PLBOOL[] draw, PLBOOL ifcc ) 00548 { 00549 PLINT n = cast(PLINT) x.length; 00550 assert( n == y.length, "plpoly3(): Arrays must be of same length!" ); 00551 assert( n == z.length, "plpoly3(): Arrays must be of same length!" ); 00552 assert( n - 1 == draw.length, "plpoly3(): Array draw must be of same length then other arrays minus 1!" ); 00553 c_plpoly3( n, x.ptr, y.ptr, z.ptr, draw.ptr, ifcc ); 00554 } 00555 00556 // Prints out "text" at world cooordinate (x,y). 00557 void plptex( PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, string text ) 00558 { 00559 c_plptex( x, y, dx, dy, just, toStringz( text ) ); 00560 } 00561 00562 // Prints out "text" at world cooordinate (x,y,z). 00563 void plptex3( PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz, 00564 PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, string text ) 00565 { 00566 c_plptex3( wx, wy, wz, dx, dy, dz, sx, sy, sz, just, toStringz( text ) ); 00567 } 00568 00569 // Set the colors for color table 0 from a cmap0 file 00570 void plspal0( string filename ) 00571 { 00572 c_plspal0( toStringz( filename ) ); 00573 } 00574 00575 // Set the colors for color table 1 from a cmap1 file 00576 void plspal1( string filename, PLBOOL interpolate ) 00577 { 00578 c_plspal1( toStringz( filename ), interpolate ); 00579 } 00580 00581 // Set color map 0 colors by 8 bit RGB values 00582 void plscmap0( PLINT[] r, PLINT[] g, PLINT[] b ) 00583 { 00584 PLINT ncol0 = cast(PLINT) r.length; 00585 assert( ncol0 == g.length, "plscmap0(): Arrays must be of same length!" ); 00586 assert( ncol0 == b.length, "plscmap0(): Arrays must be of same length!" ); 00587 c_plscmap0( r.ptr, g.ptr, b.ptr, ncol0 ); 00588 } 00589 00590 // Set color map 0 colors by 8 bit RGB values and alpha values 00591 void plscmap0a( PLINT[] r, PLINT[] g, PLINT[] b, PLFLT[] a ) 00592 { 00593 PLINT ncol0 = cast(PLINT) r.length; 00594 assert( ncol0 == g.length, "plscmap0a(): Arrays must be of same length!" ); 00595 assert( ncol0 == b.length, "plscmap0a(): Arrays must be of same length!" ); 00596 assert( ncol0 == a.length, "plscmap0a(): Arrays must be of same length!" ); 00597 c_plscmap0a( r.ptr, g.ptr, b.ptr, a.ptr, ncol0 ); 00598 } 00599 00600 // Set color map 1 colors by 8 bit RGB values 00601 void plscmap1( PLINT[] r, PLINT[] g, PLINT[] b ) 00602 { 00603 PLINT ncol1 = cast(PLINT) r.length; 00604 assert( ncol1 == g.length, "plscmap1(): Arrays must be of same length!" ); 00605 assert( ncol1 == b.length, "plscmap1(): Arrays must be of same length!" ); 00606 c_plscmap1( r.ptr, g.ptr, b.ptr, ncol1 ); 00607 } 00608 00609 // Set color map 1 colors by 8 bit RGB and alpha values 00610 void plscmap1a( PLINT[] r, PLINT[] g, PLINT[] b, PLFLT[] a ) 00611 { 00612 PLINT ncol1 = cast(PLINT) r.length; 00613 assert( ncol1 == g.length, "plscmap1a(): Arrays must be of same length!" ); 00614 assert( ncol1 == b.length, "plscmap1a(): Arrays must be of same length!" ); 00615 assert( ncol1 == a.length, "plscmap1a(): Arrays must be of same length!" ); 00616 c_plscmap1a( r.ptr, g.ptr, b.ptr, a.ptr, ncol1 ); 00617 } 00618 00619 // Set color map 1 colors using a piece-wise linear relationship between 00620 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. 00621 void plscmap1l( PLBOOL itype, PLFLT[] intensity, PLFLT[] coord1, 00622 PLFLT[] coord2, PLFLT[] coord3, PLBOOL[] alt_hue_path = null ) 00623 { 00624 PLINT npts = cast(PLINT) intensity.length; 00625 assert( npts == coord1.length, "plscmap1l(): Arrays must be of same length!" ); 00626 assert( npts == coord2.length, "plscmap1l(): Arrays must be of same length!" ); 00627 assert( npts == coord3.length, "plscmap1l(): Arrays must be of same length!" ); 00628 if ( alt_hue_path != null ) 00629 { 00630 assert( npts - 1 == alt_hue_path.length, "plscmap1l(): Array alt_hue_path must be of same length then other arrays minus 1!" ); 00631 c_plscmap1l( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, alt_hue_path.ptr ); 00632 } 00633 else 00634 c_plscmap1l( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, null ); 00635 } 00636 00637 00638 // Set color map 1 colors using a piece-wise linear relationship between 00639 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. 00640 // Will also linear interpolate alpha values. 00641 void plscmap1la( PLBOOL itype, PLFLT[] intensity, PLFLT[] coord1, 00642 PLFLT[] coord2, PLFLT[] coord3, PLFLT[] a, PLBOOL[] alt_hue_path = null ) 00643 { 00644 PLINT npts = cast(PLINT) intensity.length; 00645 assert( npts == coord1.length, "plscmap1la(): Arrays must be of same length!" ); 00646 assert( npts == coord2.length, "plscmap1la(): Arrays must be of same length!" ); 00647 assert( npts == coord3.length, "plscmap1la(): Arrays must be of same length!" ); 00648 assert( npts == a.length, "plscmap1la(): Arrays must be of same length!" ); 00649 if ( alt_hue_path != null ) 00650 { 00651 assert( npts - 1 == alt_hue_path.length, "plscmap1la(): Array alt_hue_path must be of same length then other arrays minus 1!" ); 00652 c_plscmap1la( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, alt_hue_path.ptr ); 00653 } 00654 else 00655 c_plscmap1la( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, null ); 00656 } 00657 00658 // Set the device (keyword) name 00659 void plsdev( string devname ) 00660 { 00661 c_plsdev( toStringz( devname ) ); 00662 } 00663 00664 // Set the output file name. 00665 void plsfnam( string fnam ) 00666 { 00667 c_plsfnam( toStringz( fnam ) ); 00668 } 00669 00670 // Shade region. 00671 void plshade( PLFLT[][] a, def_func defined, PLFLT left, PLFLT right, 00672 PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, 00673 PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color, 00674 PLFLT max_width, PLBOOL rectangular, 00675 pltr_func pltr = null, PLPointer pltr_data = null ) 00676 { 00677 PLINT nx = cast(PLINT) a.length; 00678 PLINT ny = cast(PLINT) a[0].length; 00679 00680 c_plshade( convert_array( a ), nx, ny, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap, 00681 sh_color, sh_width, min_color, min_width, max_color, max_width, &c_plfill, 00682 rectangular, pltr, pltr_data ); 00683 } 00684 00685 void plshades( PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 00686 PLFLT[] clevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width, 00687 PLBOOL rectangular, pltr_func pltr = null, PLPointer pltr_data = null ) 00688 { 00689 PLINT nx = cast(PLINT) a.length; 00690 PLINT ny = cast(PLINT) a[0].length; 00691 00692 c_plshades( convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(PLINT) clevel.length, 00693 fill_width, cont_color, cont_width, &c_plfill, rectangular, pltr, pltr_data ); 00694 } 00695 00696 void plshades( PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 00697 PLFLT[] clevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width, 00698 PLBOOL rectangular, ref PLcGrid cgrid ) 00699 { 00700 PLINT nx = cast(PLINT) a.length; 00701 PLINT ny = cast(PLINT) a[0].length; 00702 00703 c_PLcGrid c; 00704 c.xg = cgrid.xg.ptr; 00705 c.nx = cast(PLINT) cgrid.xg.length; 00706 c.yg = cgrid.yg.ptr; 00707 c.ny = cast(PLINT) cgrid.yg.length; 00708 c.zg = cgrid.zg.ptr; 00709 c.nz = cast(PLINT) cgrid.zg.length; 00710 00711 c_plshades( convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(PLINT) clevel.length, 00712 fill_width, cont_color, cont_width, &c_plfill, rectangular, &pltr1, &c ); 00713 } 00714 00715 void plshades( PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 00716 PLFLT[] clevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width, 00717 PLBOOL rectangular, ref PLcGrid2 cgrid2 ) 00718 { 00719 PLINT nx = cast(PLINT) a.length; 00720 PLINT ny = cast(PLINT) a[0].length; 00721 00722 c_PLcGrid2 c2; 00723 c2.xg = convert_array( cgrid2.xg ); 00724 c2.yg = convert_array( cgrid2.yg ); 00725 c2.zg = convert_array( cgrid2.zg ); 00726 c2.nx = cast(PLINT) cgrid2.xg.length; 00727 c2.ny = cast(PLINT) cgrid2.xg[0].length; 00728 if ( cgrid2.yg ) 00729 { 00730 assert( c2.nx == cgrid2.yg.length, "plcont(): Arrays must be of same length!" ); 00731 assert( c2.ny == cgrid2.yg[0].length, "plcont(): Arrays must be of same length!" ); 00732 } 00733 if ( cgrid2.zg ) 00734 { 00735 assert( c2.nx == cgrid2.zg.length, "plcont(): Arrays must be of same length!" ); 00736 assert( c2.ny == cgrid2.zg[0].length, "plcont(): Arrays must be of same length!" ); 00737 } 00738 00739 c_plshades( convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(PLINT) clevel.length, 00740 fill_width, cont_color, cont_width, &c_plfill, rectangular, &pltr2, &c2 ); 00741 } 00742 00743 // Initialize PLplot, passing the device name and windows/page settings. 00744 void plstart( string devname, PLINT nx, PLINT ny ) 00745 { 00746 c_plstart( toStringz( devname ), nx, ny ); 00747 } 00748 00749 // Create 1d stripchart 00750 void plstripc( PLINT* id, string xspec, string yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, 00751 PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLBOOL y_ascl, PLBOOL acc, 00752 PLINT colbox, PLINT collab, PLINT[] colline, PLINT[] styline, string[] legline, 00753 string labx, string laby, string labtop ) 00754 { 00755 assert( 4 == colline.length, "plstripc(): Arrays must be of length 4!" ); 00756 assert( 4 == styline.length, "plstripc(): Arrays must be of length 4!" ); 00757 assert( 4 == legline.length, "plstripc(): Arrays must be of length 4!" ); 00758 00759 immutable( char ) * *leglinez = array( map!toStringz( legline ) ).ptr; 00760 //for ( int i = 0; i < 4; i++ ) 00761 //{ 00762 // leglinez[i] = toStringz( legline[i] ); 00763 //} 00764 00765 c_plstripc( id, toStringz( xspec ), toStringz( yspec ), xmin, xmax, xjump, ymin, ymax, 00766 xlpos, ylpos, y_ascl, acc, colbox, collab, colline.ptr, styline.ptr, leglinez, 00767 toStringz( labx ), toStringz( laby ), toStringz( labtop ) ); 00768 } 00769 00770 // plots a 2d image (or a matrix too large for plshade() ) 00771 void plimagefr( PLFLT[][] idata, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 00772 PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, 00773 pltr_func pltr = null, PLPointer pltr_data = null ) 00774 { 00775 PLINT nx = cast(PLINT) idata.length; 00776 PLINT ny = cast(PLINT) idata[0].length; 00777 00778 c_plimagefr( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, 00779 valuemin, valuemax, pltr, pltr_data ); 00780 } 00781 00782 // plots a 2d image (or a matrix too large for plshade() ) 00783 void plimagefr( PLFLT[][] idata, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 00784 PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, PLcGrid cgrid ) 00785 { 00786 PLINT nx = cast(PLINT) idata.length; 00787 PLINT ny = cast(PLINT) idata[0].length; 00788 00789 c_PLcGrid c; 00790 c.xg = cgrid.xg.ptr; 00791 c.nx = cast(PLINT) cgrid.xg.length; 00792 c.yg = cgrid.yg.ptr; 00793 c.ny = cast(PLINT) cgrid.yg.length; 00794 c.zg = cgrid.zg.ptr; 00795 c.nz = cast(PLINT) cgrid.zg.length; 00796 00797 c_plimagefr( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, 00798 valuemin, valuemax, &pltr1, &c ); 00799 } 00800 00801 // plots a 2d image (or a matrix too large for plshade() ) 00802 void plimagefr( PLFLT[][] idata, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 00803 PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, PLcGrid2 cgrid2 ) 00804 { 00805 PLINT nx = cast(PLINT) idata.length; 00806 PLINT ny = cast(PLINT) idata[0].length; 00807 00808 c_PLcGrid2 c2; 00809 c2.xg = convert_array( cgrid2.xg ); 00810 c2.yg = convert_array( cgrid2.yg ); 00811 c2.zg = convert_array( cgrid2.zg ); 00812 c2.nx = cast(PLINT) cgrid2.xg.length; 00813 c2.ny = cast(PLINT) cgrid2.xg[0].length; 00814 if ( cgrid2.yg ) 00815 { 00816 assert( c2.nx == cgrid2.yg.length, "plcont(): Arrays must be of same length!" ); 00817 assert( c2.ny == cgrid2.yg[0].length, "plcont(): Arrays must be of same length!" ); 00818 } 00819 if ( cgrid2.zg ) 00820 { 00821 assert( c2.nx == cgrid2.zg.length, "plcont(): Arrays must be of same length!" ); 00822 assert( c2.ny == cgrid2.zg[0].length, "plcont(): Arrays must be of same length!" ); 00823 } 00824 00825 c_plimagefr( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, 00826 valuemin, valuemax, &pltr2, &c2 ); 00827 } 00828 00829 // plots a 2d image (or a matrix too large for plshade() ) - colors 00830 // automatically scaled 00831 void plimage( PLFLT[][] idata, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 00832 PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax ) 00833 { 00834 PLINT nx = cast(PLINT) idata.length; 00835 PLINT ny = cast(PLINT) idata[0].length; 00836 00837 c_plimage( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, 00838 Dymin, Dymax ); 00839 } 00840 00841 // Set up a new line style 00842 void plstyl( PLINT[] mark, PLINT[] space ) 00843 { 00844 PLINT nms = cast(PLINT) mark.length; 00845 assert( nms == space.length, "plstyl(): Arrays must be of same length!" ); 00846 c_plstyl( nms, mark.ptr, space.ptr ); 00847 } 00848 00849 // Plots the 3d surface representation of the function z[x][y]. 00850 void plsurf3d( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel = null ) 00851 { 00852 PLINT nx = cast(PLINT) z.length; 00853 PLINT ny = cast(PLINT) z[0].length; 00854 assert( nx == x.length, "plsurf3d(): Arrays must be of same length!" ); 00855 assert( ny == y.length, "plsurf3d(): Arrays must be of same length!" ); 00856 00857 if ( clevel ) 00858 c_plsurf3d( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length ); 00859 else 00860 c_plsurf3d( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, null, 0 ); 00861 } 00862 00863 // Plots the 3d surface representation of the function z[x][y] with y 00864 // index limits. 00865 void plsurf3dl( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel, 00866 PLINT ixstart, PLINT ixn, PLINT[] indexymin, PLINT[] indexymax ) 00867 { 00868 PLINT nx = cast(PLINT) z.length; 00869 PLINT ny = cast(PLINT) z[0].length; 00870 assert( nx == x.length, "plsurf3d(): Arrays must be of same length!" ); 00871 assert( ny == y.length, "plsurf3d(): Arrays must be of same length!" ); 00872 00873 c_plsurf3dl( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length, 00874 ixstart, ixn, indexymin.ptr, indexymax.ptr ); 00875 } 00876 00877 // Plots array y against x for n points using Hershey symbol "code" 00878 void plsym( PLFLT[] x, PLFLT[] y, PLINT code ) 00879 { 00880 PLINT n = cast(PLINT) x.length; 00881 assert( n == y.length, "plsym(): Arrays must be of same length!" ); 00882 c_plsym( n, x.ptr, y.ptr, code ); 00883 } 00884 00885 // Set the format for date / time labels 00886 void pltimefmt( string fmt ) 00887 { 00888 c_pltimefmt( toStringz( fmt ) ); 00889 } 00890 00891 //-------------------------------------------------------------------------- 00892 // Functions for use from C or C++ only 00893 //-------------------------------------------------------------------------- 00894 00895 // Returns a list of file-oriented device names and their menu strings 00896 //void plgFileDevs(char ***p_menustr, char ***p_devname, int *p_ndev); 00897 00898 // Returns a list of all device names and their menu strings 00899 //void plgDevs(char ***p_menustr, char ***p_devname, int *p_ndev); 00900 00901 // Set the function pointer for the keyboard event handler 00902 //void plsKeyEH(void function(PLGraphicsIn *, void *, int *)KeyEH, void *KeyEH_data); 00903 00904 // Set the function pointer for the (mouse) button event handler 00905 //void plsButtonEH(void function(PLGraphicsIn *, void *, int *)ButtonEH, void *ButtonEH_data); 00906 00907 // Sets an optional user bop handler 00908 //void plsbopH(void function(void *, int *)handler, void *handler_data); 00909 00910 // Sets an optional user eop handler 00911 //void plseopH(void function(void *, int *)handler, void *handler_data); 00912 00913 // Set the variables to be used for storing error info 00914 //void plsError(PLINT *errcode, char *errmsg) 00915 //{ 00916 //} 00917 00918 // Sets an optional user exit handler. 00919 //void plsexit(int function(char *)handler); 00920 00921 // Sets an optional user abort handler. 00922 //void plsabort(void function(char *)handler); 00923 00924 // Function evaluators 00925 00926 // Does a lookup from a 2d function array. Array is of type (PLFLT **), 00927 // and is column dominant (normal C ordering). 00928 //PLFLT plf2eval2(PLINT ix, PLINT iy, PLPointer plf2eval_data); 00929 00930 // Does a lookup from a 2d function array. Array is of type (PLFLT *), 00931 // and is column dominant (normal C ordering). 00932 //PLFLT plf2eval(PLINT ix, PLINT iy, PLPointer plf2eval_data); 00933 00934 // Does a lookup from a 2d function array. Array is of type (PLFLT *), 00935 // and is row dominant (Fortran ordering). 00936 //PLFLT plf2evalr(PLINT ix, PLINT iy, PLPointer plf2eval_data); 00937 00938 // Command line parsing utilities 00939 00940 // Merge user option table into internal info structure. 00941 //int plMergeOpts(PLOptionTable *options, char *name, char **notes); 00942 00943 // Set the strings used in usage and syntax messages. 00944 //void plSetUsage(char *program_string, char *usage_string); 00945 00946 // Process input strings, treating them as an option and argument pair. 00947 // The first is for the external API, the second the work routine declared 00948 // here for backward compatibilty. 00949 int plsetopt( string opt, string optarg ) 00950 { 00951 return c_plsetopt( toStringz( opt ), toStringz( optarg ) ); 00952 } 00953 00954 // Miscellaneous 00955 00956 // Get the escape character for text strings. 00957 //void plgesc(char *p_esc); 00958 00959 // Front-end to driver escape function. 00960 //void pl_cmd(PLINT op, void *ptr); 00961 00962 // Return full pathname for given file if executable 00963 //int plFindName(char *p); 00964 00965 // Looks for the specified executable file according to usual search path. 00966 //char * plFindCommand(char *fn); 00967 00968 // Gets search name for file by concatenating the dir, subdir, and file 00969 // name, allocating memory as needed. 00970 //void plGetName(char *dir, char *subdir, char *filename, char **filespec); 00971 00972 // Prompts human to input an integer in response to given message. 00973 //PLINT plGetInt(char *s); 00974 00975 // Prompts human to input a float in response to given message. 00976 //PLFLT plGetFlt(char *s); 00977 00978 // Find the maximum and minimum of a 2d matrix allocated with plAllc2dGrid(). 00979 void plMinMax2dGrid( PLFLT[][] f, out PLFLT fmax, out PLFLT fmin ) 00980 { 00981 plMinMax2dGrid( convert_array( f ), cast(PLINT) f.length, cast(PLINT) f[0].length, &fmax, &fmin ); 00982 } 00983 00984 // Wait for graphics input event and translate to world coordinates 00985 //int plGetCursor(PLGraphicsIn *gin); 00986 00987 // Translates relative device coordinates to world coordinates. 00988 //int plTranslateCursor(PLGraphicsIn *gin); 00989 00990 00991 00992 extern ( C ) : 00993 00994 alias double PLFLT; 00995 00996 // This is apparently portable if stdint.h exists. 00997 // A reasonable back-up in case stdint.h does not exist on the platform. 00998 alias uint PLUNICODE; 00999 alias int PLINT; 01000 01001 // For identifying logical (boolean) arguments 01002 alias PLINT PLBOOL; 01003 01004 // For passing user data, as with X's XtPointer 01005 alias void* PLPointer; 01006 01007 //-------------------------------------------------------------------------- 01008 // Complex data types and other good stuff 01009 //-------------------------------------------------------------------------- 01010 01011 // Switches for escape function call. 01012 // Some of these are obsolete but are retained in order to process 01013 // old metafiles. 01014 01015 const PLESC_SET_RGB = 1; 01016 const PLESC_ALLOC_NCOL = 2; 01017 const PLESC_SET_LPB = 3; 01018 const PLESC_EXPOSE = 4; 01019 const PLESC_RESIZE = 5; 01020 const PLESC_REDRAW = 6; 01021 const PLESC_TEXT = 7; 01022 const PLESC_GRAPH = 8; 01023 const PLESC_FILL = 9; 01024 const PLESC_DI = 10; 01025 const PLESC_FLUSH = 11; 01026 const PLESC_EH = 12; 01027 const PLESC_GETC = 13; 01028 const PLESC_SWIN = 14; 01029 const PLESC_DOUBLEBUFFERING = 15; 01030 const PLESC_XORMOD = 16; 01031 const PLESC_SET_COMPRESSION = 17; 01032 const PLESC_CLEAR = 18; 01033 const PLESC_DASH = 19; 01034 const PLESC_HAS_TEXT = 20; 01035 const PLESC_IMAGE = 21; 01036 const PLESC_IMAGEOPS = 22; 01037 const PLESC_PL2DEVCOL = 23; 01038 const PLESC_DEV2PLCOL = 24; 01039 const PLESC_SETBGFG = 25; 01040 const PLESC_DEVINIT = 26; 01041 01042 // image operations 01043 const ZEROW2B = 1; 01044 const ZEROW2D = 2; 01045 const ONEW2B = 3; 01046 const ONEW2D = 4; 01047 01048 // Window parameter tags 01049 const PLSWIN_DEVICE = 1; 01050 const PLSWIN_WORLD = 2; 01051 01052 // Axis label tags 01053 const PL_X_AXIS = 1; // The x-axis 01054 const PL_Y_AXIS = 2; // The y-axis 01055 const PL_Z_AXIS = 3; // The z-axis 01056 01057 // PLplot Option table & support constants 01058 01059 // Option-specific settings 01060 const PL_OPT_ENABLED = 0x0001; 01061 const PL_OPT_ARG = 0x0002; 01062 const PL_OPT_NODELETE = 0x0004; 01063 const PL_OPT_INVISIBLE = 0x0008; 01064 const PL_OPT_DISABLED = 0x0010; 01065 01066 // Option-processing settings -- mutually exclusive 01067 const PL_OPT_FUNC = 0x0100; 01068 const PL_OPT_BOOL = 0x0200; 01069 const PL_OPT_INT = 0x0400; 01070 const PL_OPT_FLOAT = 0x0800; 01071 const PL_OPT_STRING = 0x1000; 01072 01073 // Global mode settings 01074 // These override per-option settings 01075 const PL_PARSE_PARTIAL = 0x0000; 01076 const PL_PARSE_FULL = 0x0001; 01077 const PL_PARSE_QUIET = 0x0002; 01078 01079 // processing 01080 const PL_PARSE_NODELETE = 0x0004; 01081 const PL_PARSE_SHOWALL = 0x0008; 01082 const PL_PARSE_OVERRIDE = 0x0010; 01083 const PL_PARSE_NOPROGRAM = 0x0020; 01084 const PL_PARSE_NODASH = 0x0040; 01085 const PL_PARSE_SKIP = 0x0080; 01086 01087 // FCI (font characterization integer) related constants. 01088 const PL_FCI_MARK = 0x80000000; 01089 const PL_FCI_IMPOSSIBLE = 0x00000000; 01090 const PL_FCI_HEXDIGIT_MASK = 0xf; 01091 const PL_FCI_HEXPOWER_MASK = 0x7; 01092 01093 // These define hexpower values corresponding to each font attribute. 01094 const PL_FCI_HEXPOWER_IMPOSSIBLE = 0xf; 01095 const PL_FCI_FAMILY = 0x0; 01096 const PL_FCI_STYLE = 0x1; 01097 01098 // These are legal values for font family attribute 01099 const PL_FCI_WEIGHT = 0x2; 01100 const PL_FCI_SANS = 0x0; 01101 const PL_FCI_SERIF = 0x1; 01102 const PL_FCI_MONO = 0x2; 01103 const PL_FCI_SCRIPT = 0x3; 01104 01105 // These are legal values for font style attribute 01106 const PL_FCI_SYMBOL = 0x4; 01107 const PL_FCI_UPRIGHT = 0x0; 01108 const PL_FCI_ITALIC = 0x1; 01109 01110 // These are legal values for font weight attribute 01111 const PL_FCI_MEDIUM = 0x0; 01112 const PL_FCI_BOLD = 0x1; 01113 const PL_FCI_OBLIQUE = 0x2; 01114 01115 // Obsolete names 01116 01117 // Option table definition 01118 01119 struct _N1 01120 { 01121 string opt; 01122 int function( char *, char *, void * ) handler; 01123 void *client_data; 01124 void *var; 01125 int mode; 01126 string syntax; 01127 string desc; 01128 } 01129 alias _N1 PLOptionTable; 01130 01131 // PLplot Graphics Input structure 01132 01133 01134 const PL_MAXKEY = 16; 01135 struct _N2 01136 { 01137 int type; 01138 uint state; 01139 uint keysym; 01140 uint button; 01141 PLINT subwindow; 01142 char [16] string; 01143 int pX; 01144 int pY; 01145 PLFLT dX; 01146 PLFLT dY; 01147 PLFLT wX; 01148 PLFLT wY; 01149 } 01150 alias _N2 PLGraphicsIn; 01151 01152 // Structure for describing the plot window 01153 01154 01155 const PL_MAXWINDOWS = 64; 01156 struct _N3 01157 { 01158 PLFLT dxmi; 01159 PLFLT dxma; 01160 PLFLT dymi; 01161 PLFLT dyma; 01162 PLFLT wxmi; 01163 PLFLT wxma; 01164 PLFLT wymi; 01165 PLFLT wyma; 01166 } 01167 alias _N3 PLWindow; 01168 01169 // Structure for doing display-oriented operations via escape commands 01170 // May add other attributes in time 01171 01172 struct _N4 01173 { 01174 uint x; 01175 uint y; 01176 uint width; 01177 uint height; 01178 } 01179 alias _N4 PLDisplay; 01180 01181 // Macro used (in some cases) to ignore value of argument 01182 // I don't plan on changing the value so you can hard-code it 01183 01184 const int PL_NOTSET = -42; 01185 01186 // See plcont.c for examples of the following 01187 01188 // 01189 // PLfGrid is for passing (as a pointer to the first element) an arbitrarily 01190 // dimensioned array. The grid dimensions MUST be stored, with a maximum of 3 01191 // dimensions assumed for now. 01192 // 01193 01194 struct _N5 01195 { 01196 PLFLT *f; 01197 PLINT nx; 01198 PLINT ny; 01199 PLINT nz; 01200 } 01201 alias _N5 PLfGrid; 01202 01203 // 01204 // PLfGrid2 is for passing (as an array of pointers) a 2d function array. The 01205 // grid dimensions are passed for possible bounds checking. 01206 // 01207 01208 struct _N6 01209 { 01210 PLFLT **f; 01211 PLINT nx; 01212 PLINT ny; 01213 } 01214 alias _N6 PLfGrid2; 01215 01216 // 01217 // NOTE: a PLfGrid3 is a good idea here but there is no way to exploit it yet 01218 // so I'll leave it out for now. 01219 // 01220 01221 // 01222 // PLcGrid is for passing (as a pointer to the first element) arbitrarily 01223 // dimensioned coordinate transformation arrays. The grid dimensions MUST be 01224 // stored, with a maximum of 3 dimensions assumed for now. 01225 // 01226 01227 struct _N7 01228 { 01229 PLFLT *xg; 01230 PLFLT *yg; 01231 PLFLT *zg; 01232 PLINT nx; 01233 PLINT ny; 01234 PLINT nz; 01235 } 01236 alias _N7 c_PLcGrid; 01237 01238 // 01239 // PLcGrid2 is for passing (as arrays of pointers) 2d coordinate 01240 // transformation arrays. The grid dimensions are passed for possible bounds 01241 // checking. 01242 // 01243 01244 struct _N8 01245 { 01246 PLFLT **xg; 01247 PLFLT **yg; 01248 PLFLT **zg; 01249 PLINT nx; 01250 PLINT ny; 01251 } 01252 alias _N8 c_PLcGrid2; 01253 01254 // 01255 // NOTE: a PLcGrid3 is a good idea here but there is no way to exploit it yet 01256 // so I'll leave it out for now. 01257 // 01258 01259 // PLColor is the usual way to pass an rgb color value. 01260 01261 struct _N9 01262 { 01263 ubyte r; 01264 ubyte g; 01265 ubyte b; 01266 PLFLT a; 01267 char *name; 01268 } 01269 alias _N9 PLColor; 01270 01271 // PLControlPt is how cmap1 control points are represented. 01272 01273 struct _N10 01274 { 01275 PLFLT h; 01276 PLFLT l; 01277 PLFLT s; 01278 PLFLT p; 01279 PLFLT a; 01280 int alt_hue_path; 01281 } 01282 alias _N10 PLControlPt; 01283 01284 // A PLBufferingCB is a control block for interacting with devices 01285 // that support double buffering. 01286 01287 struct _N11 01288 { 01289 PLINT cmd; 01290 PLINT result; 01291 } 01292 alias _N11 PLBufferingCB; 01293 01294 const PLESC_DOUBLEBUFFERING_ENABLE = 1; 01295 const PLESC_DOUBLEBUFFERING_DISABLE = 2; 01296 01297 const PLESC_DOUBLEBUFFERING_QUERY = 3; 01298 01299 //--------------------------------------------------------------------------* * BRAINDEAD-ness 01300 // 01301 // Some systems allow the Fortran & C namespaces to clobber each other. 01302 // For PLplot to work from Fortran on these systems, we must name the the 01303 // externally callable C functions something other than their Fortran entry 01304 // names. In order to make this as easy as possible for the casual user, 01305 // yet reversible to those who abhor my solution, I have done the 01306 // following: 01307 // 01308 // The C-language bindings are actually different from those 01309 // described in the manual. Macros are used to convert the 01310 // documented names to the names used in this package. The 01311 // user MUST include plplot.h in order to get the name 01312 // redefinition correct. 01313 // 01314 // Sorry to have to resort to such an ugly kludge, but it is really the 01315 // best way to handle the situation at present. If all available 01316 // compilers offer a way to correct this stupidity, then perhaps we can 01317 // eventually reverse it. 01318 // 01319 // If you feel like screaming at someone (I sure do), please 01320 // direct it at your nearest system vendor who has a braindead shared 01321 // C/Fortran namespace. Some vendors do offer compiler switches that 01322 // change the object names, but then everybody who wants to use the 01323 // package must throw these same switches, leading to no end of trouble. 01324 // 01325 // Note that this definition should not cause any noticable effects except 01326 // when debugging PLplot calls, in which case you will need to remember 01327 // the real function names (same as before but with a 'c_' prepended). 01328 // 01329 // Also, to avoid macro conflicts, the BRAINDEAD part must not be expanded 01330 // in the stub routines. 01331 // 01332 // Aside: the reason why a shared Fortran/C namespace is deserving of the 01333 // BRAINDEAD characterization is that it completely precludes the the kind 01334 // of universal API that is attempted (more or less) with PLplot, without 01335 // Herculean efforts (e.g. remapping all of the C bindings by macros as 01336 // done here). The vendors of such a scheme, in order to allow a SINGLE 01337 // type of argument to be passed transparently between C and Fortran, 01338 // namely, a pointer to a conformable data type, have slammed the door on 01339 // insertion of stub routines to handle the conversions needed for other 01340 // data types. Intelligent linkers could solve this problem, but these are 01341 // not anywhere close to becoming universal. So meanwhile, one must live 01342 // with either stub routines for the inevitable data conversions, or a 01343 // different API. The former is what is used here, but is made far more 01344 // difficult in a braindead shared Fortran/C namespace. 01345 //-------------------------------------------------------------------------- 01346 01347 01348 01349 01350 alias c_pl_setcontlabelformat pl_setcontlabelformat; 01351 alias c_pl_setcontlabelparam pl_setcontlabelparam; 01352 alias c_pladv pladv; 01353 //alias c_plaxes plaxes; 01354 //alias c_plbin plbin; 01355 alias c_plbop plbop; 01356 //alias c_plbox plbox; 01357 //alias c_plbox3 plbox3; 01358 alias c_plbtime plbtime; 01359 alias c_plslabelfunc plslabelfunc; 01360 alias c_plcalc_world plcalc_world; 01361 alias c_plarc plarc; 01362 alias c_plclear plclear; 01363 alias c_plcol0 plcol0; 01364 alias c_plcol1 plcol1; 01365 //alias c_plcolorbar plcolorbar; 01366 alias c_plconfigtime plconfigtime; 01367 //alias c_plcont plcont; 01368 alias c_plcpstrm plcpstrm; 01369 alias c_plctime plctime; 01370 alias c_plend plend; 01371 alias c_plend1 plend1; 01372 alias c_plenv plenv; 01373 alias c_plenv0 plenv0; 01374 alias c_pleop pleop; 01375 //alias c_plerrx plerrx; 01376 //alias c_plerry plerry; 01377 alias c_plfamadv plfamadv; 01378 //alias c_plfill plfill; 01379 //alias c_plfill3 plfill3; 01380 alias c_plflush plflush; 01381 alias c_plfont plfont; 01382 alias c_plfontld plfontld; 01383 alias c_plgchr plgchr; 01384 alias c_plgcol0 plgcol0; 01385 alias c_plgcolbg plgcolbg; 01386 alias c_plgcol0a plgcol0a; 01387 alias c_plgcolbga plgcolbga; 01388 alias c_plgcompression plgcompression; 01389 //alias c_plgdev plgdev; 01390 alias c_plgdidev plgdidev; 01391 alias c_plgdiori plgdiori; 01392 alias c_plgdiplt plgdiplt; 01393 alias c_plgfam plgfam; 01394 alias c_plgfci plgfci; 01395 //alias c_plgfnam plgfnam; 01396 alias c_plgfont plgfont; 01397 alias c_plglevel plglevel; 01398 alias c_plgpage plgpage; 01399 alias c_plgradient plgrdient; 01400 alias c_plgra plgra; 01401 //alias c_plgriddata plgriddata; 01402 alias c_plgspa plgspa; 01403 alias c_plgstrm plgstrm; 01404 //alias c_plgver plgver; 01405 alias c_plgvpd plgvpd; 01406 alias c_plgvpw plgvpw; 01407 alias c_plgxax plgxax; 01408 alias c_plgyax plgyax; 01409 alias c_plgzax plgzax; 01410 //alias c_plhist plhist; 01411 alias c_plhls plhls; 01412 alias c_plhlsrgb plhlsrgb; 01413 //alias c_plimage plimage; 01414 //alias c_plimagefr plimagefr; 01415 alias c_plinit plinit; 01416 alias c_pljoin pljoin; 01417 //alias c_pllab pllab; 01418 //alias c_pllegend pllegend; 01419 alias c_pllightsource pllightsource; 01420 //alias c_plline plline; 01421 alias c_plpath plpath; 01422 //alias c_plline3 plline3; 01423 alias c_pllsty pllsty; 01424 //alias c_plmap plmap; 01425 alias c_plmeridians plmeridians; 01426 //alias c_plmesh plmesh; 01427 //alias c_plmeshc plmeshc; 01428 alias c_plmkstrm plmkstrm; 01429 //alias c_plmtex plmtex; 01430 //alias c_plmtex3 plmtex3; 01431 //alias c_plot3d plot3d; 01432 //alias c_plot3dc plot3dc; 01433 //alias c_plot3dcl plot3dcl; 01434 //alias c_plparseopts plparseopts; 01435 //alias c_plpat plpat; 01436 //alias c_plpoin plpoin; 01437 //alias c_plpoin3 plpoin3; 01438 //alias c_plpoly3 plpoly3; 01439 alias c_plprec plprec; 01440 alias c_plpsty plpsty; 01441 //alias c_plptex plptex; 01442 //alias c_plptex3 plptex3; 01443 alias c_plrandd plrandd; 01444 alias c_plreplot plreplot; 01445 alias c_plrgb plrgb; 01446 alias c_plrgb1 plrgb1; 01447 alias c_plrgbhls plrgbhls; 01448 alias c_plschr plschr; 01449 //alias c_plscmap0 plscmap0; 01450 //alias c_plscmap0a plscmap0a; 01451 alias c_plscmap0n plscmap0n; 01452 //alias c_plscmap1 plscmap1; 01453 //alias c_plscmap1a plscmap1a; 01454 //alias c_plscmap1l plscmap1l; 01455 //alias c_plscmap1la plscmap1la; 01456 alias c_plscmap1n plscmap1n; 01457 alias c_plscmap1_range plscmap1_range; 01458 alias c_plscol0 plscol0; 01459 alias c_plscol0a plscol0a; 01460 alias c_plscolbg plscolbg; 01461 alias c_plscolbga plscolbga; 01462 alias c_plscolor plscolor; 01463 alias c_plscompression plscompression; 01464 // alias c_plsdev plsdev; 01465 alias c_plsdidev plsdidev; 01466 alias c_plsdimap plsdimap; 01467 alias c_plsdiori plsdiori; 01468 alias c_plsdiplt plsdiplt; 01469 alias c_plsdiplz plsdiplz; 01470 alias c_plseed plseed; 01471 alias c_plsesc plsesc; 01472 //alias c_plsetopt plsetopt; 01473 alias c_plsfam plsfam; 01474 alias c_plsfci plsfci; 01475 // alias c_plsfnam plsfnam; 01476 alias c_plsfont plsfont; 01477 //alias c_plshade plshade; 01478 //alias c_plshades plshades; 01479 alias c_plsmaj plsmaj; 01480 alias c_plsmem plsmem; 01481 alias c_plsmin plsmin; 01482 alias c_plsori plsori; 01483 alias c_plspage plspage; 01484 // alias c_plspal0 plspal0; 01485 // alias c_plspal1 plspal1; 01486 alias c_plspause plspause; 01487 alias c_plsstrm plsstrm; 01488 alias c_plssub plssub; 01489 alias c_plssym plssym; 01490 alias c_plstar plstar; 01491 //alias c_plstart plstart; 01492 alias c_plstransform plstransform; 01493 alias c_plstripa plstripa; 01494 //alias c_plstripc plstripc; 01495 alias c_plstripd plstripd; 01496 //alias c_plstring plstring; 01497 //alias c_plstring3 plstring3; 01498 //alias c_plstyl plstyl; 01499 //alias c_plsurf3d plsurf3d; 01500 //alias c_plsurf3dl plsurf3dl; 01501 //alias c_plsvect plsvect; 01502 alias c_plsvpa plsvpa; 01503 alias c_plsxax plsxax; 01504 alias c_plsyax plsyax; 01505 //alias c_plsym plsym; 01506 alias c_plszax plszax; 01507 alias c_pltext pltext; 01508 //alias c_pltimefmt pltimefmt; 01509 alias c_plvasp plvasp; 01510 //alias c_plvect plvect; 01511 alias c_plvpas plvpas; 01512 alias c_plvpor plvpor; 01513 alias c_plvsta plvsta; 01514 alias c_plw3d plw3d; 01515 alias c_plwidth plwidth; 01516 alias c_plwind plwind; 01517 01518 alias c_plxormod plxormod; 01519 01520 01521 // Redefine some old function names for backward compatibility 01522 01523 01524 alias pleop plclr; 01525 alias plbop plpage; 01526 alias plcol0 plcol; 01527 alias plfcont plcontf; 01528 alias plAlloc2dGrid Alloc2dGrid; 01529 alias plFree2dGrid Free2dGrid; 01530 alias plMinMax2dGrid MinMax2dGrid; 01531 alias plgvpd plP_gvpd; 01532 alias plgvpw plP_gvpw; 01533 01534 01535 //--------------------------------------------------------------------------* * Function Prototypes 01536 //-------------------------------------------------------------------------- 01537 01538 01539 // All void types 01540 // C routines callable from stub routines come first 01541 01542 // set the format of the contour labels 01543 void c_pl_setcontlabelformat( PLINT lexp, PLINT sigdig ); 01544 01545 // set offset and spacing of contour labels 01546 void c_pl_setcontlabelparam( PLFLT offset, PLFLT size, PLFLT spacing, PLINT active ); 01547 01548 // Advance to subpage "page", or to the next one if "page" = 0. 01549 void c_pladv( PLINT page ); 01550 01551 // simple arrow plotter. 01552 void c_plvect( PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, 01553 void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data ); 01554 void c_plsvect( PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLBOOL fill ); 01555 01556 // This functions similarly to plbox() except that the origin of the axes 01557 // is placed at the user-specified point (x0, y0). 01558 void c_plaxes( PLFLT x0, PLFLT y0, const char *xopt, PLFLT xtick, PLINT nxsub, 01559 const char *yopt, PLFLT ytick, PLINT nysub ); 01560 01561 // Flags for plbin() - opt argument 01562 const PL_BIN_DEFAULT = 0; 01563 const PL_BIN_CENTRED = 1; 01564 const PL_BIN_NOEXPAND = 2; 01565 const PL_BIN_NOEMPTY = 4; 01566 01567 // Plot a histogram using x to store data values and y to store frequencies 01568 void c_plbin( PLINT nbin, PLFLT *x, PLFLT *y, PLINT opt ); 01569 01570 // Start new page. Should only be used with pleop(). 01571 void c_plbop(); 01572 01573 // This draws a box around the current viewport. 01574 void c_plbox( const char *xopt, PLFLT xtick, PLINT nxsub, const char *yopt, PLFLT ytick, PLINT nysub ); 01575 01576 // This is the 3-d analogue of plbox(). 01577 void c_plbox3( const char *xopt, const char *xlabel, PLFLT xtick, PLINT nsubx, const char *yopt, 01578 const char *ylabel, PLFLT ytick, PLINT nsuby, const char *zopt, const char *zlabel, 01579 PLFLT ztick, PLINT nsubz ); 01580 01581 // Calculate broken-down time from continuous time for current stream. 01582 void c_plbtime( PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec, PLFLT ctime ); 01583 01584 // Setup a user-provided custom labeling function 01585 void c_plslabelfunc( void function( PLINT, PLFLT, char*, PLINT, PLPointer ) labelfunc, 01586 PLPointer label_data ); 01587 01588 // Calculate world coordinates and subpage from relative device coordinates. 01589 void c_plcalc_world( PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window ); 01590 01591 // Plot an arc 01592 void c_plarc( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, 01593 PLFLT rotate, PLBOOL fill ); 01594 01595 // Clear current subpage. 01596 void c_plclear(); 01597 01598 // Set color, map 0. Argument is integer between 0 and 15. 01599 void c_plcol0( PLINT icol0 ); 01600 01601 // Set color, map 1. Argument is a float between 0. and 1. 01602 void c_plcol1( PLFLT col1 ); 01603 01604 01605 // Configure transformation between continuous and broken-down time (and 01606 // vice versa) for current stream. 01607 void c_plconfigtime( PLFLT scale, PLFLT offset1, PLFLT offset2, PLINT ccontrol, PLBOOL ifbtime_offset, 01608 PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec ); 01609 01610 // Draws a contour plot from data in f(nx,ny). Is just a front-end to 01611 // plfcont, with a particular choice for f2eval and f2eval_data. 01612 // 01613 void c_plcont( PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, 01614 PLFLT *clevel, PLINT nlevel, 01615 void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data ); 01616 01617 // Draws a contour plot using the function evaluator f2eval and data stored 01618 // by way of the f2eval_data pointer. This allows arbitrary organizations 01619 // of 2d array data to be used. 01620 // 01621 void plfcont( PLFLT function( PLINT, PLINT, PLPointer ) f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny, 01622 PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, 01623 void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data ); 01624 01625 // Copies state parameters from the reference stream to the current stream. 01626 void c_plcpstrm( PLINT iplsr, PLBOOL flags ); 01627 01628 // Calculate continuous time from broken-down time for current stream. 01629 void c_plctime( PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec, PLFLT *ctime ); 01630 01631 // Converts input values from relative device coordinates to relative plot 01632 // coordinates. 01633 void pldid2pc( PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax ); 01634 01635 // Converts input values from relative plot coordinates to relative 01636 // device coordinates. 01637 void pldip2dc( PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax ); 01638 01639 // End a plotting session for all open streams. 01640 void c_plend(); 01641 01642 // End a plotting session for the current stream only. 01643 void c_plend1(); 01644 01645 // Simple interface for defining viewport and window. 01646 void c_plenv( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis ); 01647 01648 // similar to plenv() above, but in multiplot mode does not advance the subpage, 01649 // instead the current subpage is cleared 01650 void c_plenv0( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis ); 01651 01652 // End current page. Should only be used with plbop(). 01653 void c_pleop(); 01654 01655 // Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i)) 01656 void c_plerrx( PLINT n, PLFLT *xmin, PLFLT *xmax, PLFLT *y ); 01657 01658 // Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i)) 01659 void c_plerry( PLINT n, PLFLT *x, PLFLT *ymin, PLFLT *ymax ); 01660 01661 // Advance to the next family file on the next new page 01662 void c_plfamadv(); 01663 01664 // Pattern fills the polygon bounded by the input points. 01665 void c_plfill( PLINT n, PLFLT *x, PLFLT *y ); 01666 01667 // Pattern fills the 3d polygon bounded by the input points. 01668 void c_plfill3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z ); 01669 01670 // Flushes the output stream. Use sparingly, if at all. 01671 void c_plflush(); 01672 01673 // Sets the global font flag to 'ifont'. 01674 void c_plfont( PLINT ifont ); 01675 01676 // Load specified font set. 01677 void c_plfontld( PLINT fnt ); 01678 01679 // Get character default height and current (scaled) height 01680 void c_plgchr( PLFLT *p_def, PLFLT *p_ht ); 01681 01682 // Returns 8 bit RGB values for given color from color map 0 01683 void c_plgcol0( PLINT icol0, PLINT *r, PLINT *g, PLINT *b ); 01684 01685 // Returns 8 bit RGB values for given color from color map 0 and alpha value 01686 void c_plgcol0a( PLINT icol0, PLINT *r, PLINT *g, PLINT *b, PLFLT *a ); 01687 01688 // Returns the background color by 8 bit RGB value 01689 void c_plgcolbg( PLINT *r, PLINT *g, PLINT *b ); 01690 01691 // Returns the background color by 8 bit RGB value and alpha value 01692 void c_plgcolbga( PLINT *r, PLINT *g, PLINT *b, PLFLT *a ); 01693 01694 // Returns the current compression setting 01695 void c_plgcompression( PLINT *compression ); 01696 01697 // Get the current device (keyword) name 01698 void c_plgdev( char *p_dev ); 01699 01700 // Retrieve current window into device space 01701 void c_plgdidev( PLFLT *p_mar, PLFLT *p_aspect, PLFLT *p_jx, PLFLT *p_jy ); 01702 01703 // Get plot orientation 01704 void c_plgdiori( PLFLT *p_rot ); 01705 01706 // Retrieve current window into plot space 01707 void c_plgdiplt( PLFLT *p_xmin, PLFLT *p_ymin, PLFLT *p_xmax, PLFLT *p_ymax ); 01708 01709 // Get FCI (font characterization integer) 01710 01711 void c_plgfci( PLUNICODE *pfci ); 01712 01713 // Get family file parameters 01714 01715 void c_plgfam( PLINT *p_fam, PLINT *p_num, PLINT *p_bmax ); 01716 01717 // Get the (current) output file name. Must be preallocated to >80 bytes 01718 void c_plgfnam( char *fnam ); 01719 01720 // Get the current font family, style and weight 01721 void c_plgfont( PLINT *p_family, PLINT *p_style, PLINT *p_weight ); 01722 01723 // Get the (current) run level. 01724 void c_plglevel( PLINT *p_level ); 01725 01726 // Get output device parameters. 01727 void c_plgpage( PLFLT *p_xp, PLFLT *p_yp, PLINT *p_xleng, PLINT *p_yleng, 01728 PLINT *p_xoff, PLINT *p_yoff ); 01729 01730 // Switches to graphics screen. 01731 void c_plgra(); 01732 01733 // Draw gradient in polygon. 01734 void c_plgradient( PLINT n, PLFLT *x, PLFLT *y, PLFLT angle ); 01735 01736 // grid irregularly sampled data 01737 void c_plgriddata( PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, PLFLT *xg, PLINT nptsx, 01738 PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data ); 01739 01740 // type of gridding algorithm for plgriddata() 01741 const GRID_CSA = 1; 01742 const GRID_DTLI = 2; 01743 const GRID_NNI = 3; 01744 const GRID_NNIDW = 4; 01745 const GRID_NNLI = 5; 01746 const GRID_NNAIDW = 6; 01747 01748 // Get subpage boundaries in absolute coordinates 01749 void c_plgspa( PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax ); 01750 01751 // Get current stream number. 01752 void c_plgstrm( PLINT *p_strm ); 01753 01754 // Get the current library version number 01755 void c_plgver( char *p_ver ); 01756 01757 // Get viewport boundaries in normalized device coordinates 01758 void c_plgvpd( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax ); 01759 01760 // Get viewport boundaries in world coordinates 01761 void c_plgvpw( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax ); 01762 01763 // Get x axis labeling parameters 01764 void c_plgxax( PLINT *p_digmax, PLINT *p_digits ); 01765 01766 // Get y axis labeling parameters 01767 void c_plgyax( PLINT *p_digmax, PLINT *p_digits ); 01768 01769 // Get z axis labeling parameters 01770 void c_plgzax( PLINT *p_digmax, PLINT *p_digits ); 01771 01772 // Flags for plhist() - opt argument; note: some flags are passed to 01773 // plbin() for the actual plotting 01774 const PL_HIST_DEFAULT = 0; 01775 const PL_HIST_NOSCALING = 1; 01776 const PL_HIST_IGNORE_OUTLIERS = 2; 01777 const PL_HIST_NOEXPAND = 8; 01778 const PL_HIST_NOEMPTY = 16; 01779 01780 // Draws a histogram of n values of a variable in array data[0..n-1] 01781 void c_plhist( PLINT n, PLFLT *data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt ); 01782 01783 // Set current color (map 0) by hue, lightness, and saturation. 01784 void c_plhls( PLFLT h, PLFLT l, PLFLT s ); 01785 01786 // Functions for converting between HLS and RGB color space 01787 void c_plhlsrgb( PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b ); 01788 01789 // Initializes PLplot, using preset or default options 01790 void c_plinit(); 01791 01792 // Draws a line segment from (x1, y1) to (x2, y2). 01793 void c_pljoin( PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 ); 01794 01795 // Simple routine for labelling graphs. 01796 void c_pllab( const char *xlabel, const char *ylabel, const char *tlabel ); 01797 01798 // Flags used for position argument of both pllegend and plcolorbar 01799 const PL_POSITION_LEFT = 1; 01800 const PL_POSITION_RIGHT = 2; 01801 const PL_POSITION_TOP = 4; 01802 const PL_POSITION_BOTTOM = 8; 01803 const PL_POSITION_INSIDE = 16; 01804 const PL_POSITION_OUTSIDE = 32; 01805 const PL_POSITION_VIEWPORT = 64; 01806 const PL_POSITION_SUBPAGE = 128; 01807 01808 // Flags for pllegend 01809 const PL_LEGEND_NONE = 1; 01810 const PL_LEGEND_COLOR_BOX = 2; 01811 const PL_LEGEND_LINE = 4; 01812 const PL_LEGEND_SYMBOL = 8; 01813 const PL_LEGEND_TEXT_LEFT = 16; 01814 const PL_LEGEND_BACKGROUND = 32; 01815 const PL_LEGEND_BOUNDING_BOX = 64; 01816 const PL_LEGEND_ROW_MAJOR = 128; 01817 01818 // Flags for plcolorbar 01819 const PL_COLORBAR_LABEL_LEFT = 1; 01820 const PL_COLORBAR_LABEL_RIGHT = 2; 01821 const PL_COLORBAR_LABEL_TOP = 4; 01822 const PL_COLORBAR_LABEL_BOTTOM = 8; 01823 const PL_COLORBAR_IMAGE = 16; 01824 const PL_COLORBAR_SHADE = 32; 01825 const PL_COLORBAR_GRADIENT = 64; 01826 const PL_COLORBAR_CAP_NONE = 128; 01827 const PL_COLORBAR_CAP_LOW = 256; 01828 const PL_COLORBAR_CAP_HIGH = 512; 01829 const PL_COLORBAR_SHADE_LABEL = 1024; 01830 const PL_COLORBAR_ORIENT_RIGHT = 2048; 01831 const PL_COLORBAR_ORIENT_TOP = 4096; 01832 const PL_COLORBAR_ORIENT_LEFT = 8192; 01833 const PL_COLORBAR_ORIENT_BOTTOM = 16384; 01834 const PL_COLORBAR_BACKGROUND = 32768; 01835 const PL_COLORBAR_BOUNDING_BOX = 65536; 01836 01837 01838 // Routine for drawing discrete line, symbol, or cmap0 legends 01839 void c_pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height, 01840 PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT plot_width, 01841 PLINT bg_color, PLINT bb_color, PLINT bb_style, 01842 PLINT nrow, PLINT ncolumn, 01843 PLINT nlegend, PLINT *opt_array, 01844 PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, 01845 PLFLT text_justification, 01846 PLINT *text_colors, const char **text, 01847 PLINT *box_colors, PLINT *box_patterns, 01848 PLFLT *box_scales, PLFLT *box_line_widths, 01849 PLINT *line_colors, PLINT *line_styles, 01850 PLFLT *line_widths, 01851 PLINT *symbol_colors, PLFLT *symbol_scales, 01852 PLINT *symbol_numbers, const char **symbols ); 01853 01854 // Routine for drawing continous colour legends 01855 void c_plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, 01856 PLINT opt, PLINT position, PLFLT x, PLFLT y, 01857 PLFLT x_length, PLFLT y_length, 01858 PLINT bg_color, PLINT bb_color, PLINT bb_style, 01859 PLFLT low_cap_color, PLFLT high_cap_color, 01860 PLINT cont_color, PLFLT cont_width, 01861 PLINT n_labels, const PLINT *label_opts, const char **label, 01862 PLINT n_axes, const char ** axis_opts, 01863 const PLFLT *ticks, const PLINT *sub_ticks, 01864 const PLINT *n_values, const PLFLT **values ); 01865 01866 // Sets position of the light source 01867 void c_pllightsource( PLFLT x, PLFLT y, PLFLT z ); 01868 01869 // Draws line segments connecting a series of points. 01870 void c_plline( PLINT n, PLFLT *x, PLFLT *y ); 01871 01872 // Draws a line in 3 space. 01873 void c_plline3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z ); 01874 01875 // Set line style. 01876 void c_pllsty( PLINT lin ); 01877 01878 // plot continental outline in world coordinates 01879 void c_plmap( void function( PLINT, PLFLT *, PLFLT* ) mapform, const char *type, PLFLT minlong, 01880 PLFLT maxlong, PLFLT minlat, PLFLT maxlat ); 01881 01882 // Plot the latitudes and longitudes on the background. 01883 void c_plmeridians( void function( PLINT, PLFLT *, PLFLT* ) mapform, PLFLT dlong, PLFLT dlat, 01884 PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat ); 01885 01886 // Plots a mesh representation of the function z[x][y]. 01887 void c_plmesh( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt ); 01888 01889 // Plots a mesh representation of the function z[x][y] with contour 01890 void c_plmeshc( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, 01891 PLFLT *clevel, PLINT nlevel ); 01892 01893 // Creates a new stream and makes it the default. 01894 void c_plmkstrm( PLINT *p_strm ); 01895 01896 // Prints out "text" at specified position relative to viewport 01897 void c_plmtex( const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text ); 01898 01899 // Prints out "text" at specified position relative to viewport (3D) 01900 void c_plmtex3( const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text ); 01901 01902 // Plots a 3-d representation of the function z[x][y]. 01903 void c_plot3d( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLBOOL side ); 01904 01905 // Plots a 3-d representation of the function z[x][y] with contour. 01906 void c_plot3dc( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, 01907 PLFLT *clevel, PLINT nlevel ); 01908 01909 // Plots a 3-d representation of the function z[x][y] with contour and 01910 // y index limits. 01911 void c_plot3dcl( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, 01912 PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn, 01913 PLINT *indexymin, PLINT *indexymax ); 01914 01915 // 01916 // definitions for the opt argument in plot3dc() and plsurf3d() 01917 // 01918 // DRAW_LINEX *must* be 1 and DRAW_LINEY *must* be 2, because of legacy code! 01919 // 01920 const DRAW_LINEX = 1 << 0; // draw lines parallel to the X axis 01921 const DRAW_LINEY = 1 << 1; // draw lines parallel to the Y axis 01922 const DRAW_LINEXY = DRAW_LINEX | DRAW_LINEY; // draw lines parallel to both the X and Y axis 01923 const MAG_COLOR = 1 << 2; // draw the mesh with a color dependent of the magnitude 01924 const BASE_CONT = 1 << 3; // draw contour plot at bottom xy plane 01925 const TOP_CONT = 1 << 4; // draw contour plot at top xy plane 01926 const SURF_CONT = 1 << 5; // draw contour plot at surface 01927 const DRAW_SIDES = 1 << 6; // draw sides 01928 const FACETED = 1 << 7; // draw outline for each square that makes up the surface 01929 const MESH = 1 << 8; // draw mesh 01930 01931 // 01932 // valid options for plot3dc(): 01933 // 01934 // DRAW_SIDES, BASE_CONT, TOP_CONT (not yet), 01935 // MAG_COLOR, DRAW_LINEX, DRAW_LINEY, DRAW_LINEXY. 01936 // 01937 // valid options for plsurf3d(): 01938 // 01939 // MAG_COLOR, BASE_CONT, SURF_CONT, FACETED, DRAW_SIDES. 01940 // 01941 01942 // Set fill pattern directly. 01943 void c_plpat( PLINT nlin, PLINT *inc, PLINT *del ); 01944 01945 // Draw a line connecting two points, accounting for coordinate transforms 01946 void c_plpath( PLINT n, PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 ); 01947 01948 // Plots array y against x for n points using ASCII code "code". 01949 void c_plpoin( PLINT n, PLFLT *x, PLFLT *y, PLINT code ); 01950 01951 // Draws a series of points in 3 space. 01952 void c_plpoin3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT code ); 01953 01954 // Draws a polygon in 3 space. 01955 void c_plpoly3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLBOOL *draw, PLBOOL ifcc ); 01956 01957 // Plots array y against x for n points using (UTF-8) text string 01958 void c_plstring( PLINT n, PLFLT *x, PLFLT *y, const char *text ); 01959 01960 // Draws a series of points (described by [UTF8] text string) in 3 space. 01961 void c_plstring3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, const char * text ); 01962 01963 // Set the floating point precision (in number of places) in numeric labels. 01964 void c_plprec( PLINT setp, PLINT prec ); 01965 01966 // Set fill pattern, using one of the predefined patterns. 01967 void c_plpsty( PLINT patt ); 01968 01969 // Prints out "text" at world cooordinate (x,y). 01970 void c_plptex( PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, const char *text ); 01971 01972 // Prints out "text" at world cooordinate (x,y,z). 01973 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 ); 01974 01975 // Random number generator based on Mersenne Twister. 01976 // Obtain real random number in range [0,1]. 01977 PLFLT c_plrandd(); 01978 01979 // Replays contents of plot buffer to current device/file. 01980 void c_plreplot(); 01981 01982 // Set line color by red, green, blue from 0. to 1. 01983 01984 void c_plrgb( PLFLT r, PLFLT g, PLFLT b ); 01985 01986 // Set line color by 8 bit RGB values. 01987 01988 void c_plrgb1( PLINT r, PLINT g, PLINT b ); 01989 01990 // Functions for converting between HLS and RGB color space 01991 01992 void c_plrgbhls( PLFLT r, PLFLT g, PLFLT b, PLFLT *p_h, PLFLT *p_l, PLFLT *p_s ); 01993 01994 // Set character height. 01995 01996 void c_plschr( PLFLT def, PLFLT scale ); 01997 01998 // Set color map 0 colors by 8 bit RGB values 01999 void c_plscmap0( PLINT *r, PLINT *g, PLINT *b, PLINT ncol0 ); 02000 02001 // Set color map 0 colors by 8 bit RGB values and alpha values 02002 void c_plscmap0a( PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol0 ); 02003 02004 // Set number of colors in cmap 0 02005 void c_plscmap0n( PLINT ncol0 ); 02006 02007 // Set color map 1 colors by 8 bit RGB values 02008 void c_plscmap1( PLINT *r, PLINT *g, PLINT *b, PLINT ncol1 ); 02009 02010 // Set color map 1 colors by 8 bit RGB and alpha values 02011 void c_plscmap1a( PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol1 ); 02012 02013 // Set color map 1 colors using a piece-wise linear relationship between 02014 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. 02015 void c_plscmap1l( PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLBOOL *alt_hue_path ); 02016 02017 // Set color map 1 colors using a piece-wise linear relationship between 02018 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. 02019 // Will also linear interpolate alpha values. 02020 void c_plscmap1la( PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLFLT *a, PLBOOL *alt_hue_path ); 02021 02022 // Set number of colors in cmap 1 02023 void c_plscmap1n( PLINT ncol1 ); 02024 02025 // Set the color map 1 range used in continuous plots 02026 void c_plscmap1_range( PLFLT min_color, PLFLT max_color ); 02027 02028 // Get the color map 1 range used in continuous plots 02029 void c_plgcmap1_range( PLFLT *min_color, PLFLT *max_color ); 02030 02031 // Set a given color from color map 0 by 8 bit RGB value 02032 void c_plscol0( PLINT icol0, PLINT r, PLINT g, PLINT b ); 02033 02034 // Set a given color from color map 0 by 8 bit RGB value 02035 void c_plscol0a( PLINT icol0, PLINT r, PLINT g, PLINT b, PLFLT a ); 02036 02037 // Set the background color by 8 bit RGB value 02038 void c_plscolbg( PLINT r, PLINT g, PLINT b ); 02039 02040 // Set the background color by 8 bit RGB value and alpha value 02041 void c_plscolbga( PLINT r, PLINT g, PLINT b, PLFLT a ); 02042 02043 // Used to globally turn color output on/off 02044 void c_plscolor( PLINT color ); 02045 02046 // Set the compression level 02047 02048 void c_plscompression( PLINT compression ); 02049 02050 // Set the device (keyword) name 02051 void c_plsdev( const char *devname ); 02052 02053 // Set window into device space using margin, aspect ratio, and 02054 // justification 02055 02056 void c_plsdidev( PLFLT mar, PLFLT aspect, PLFLT jx, PLFLT jy ); 02057 02058 // Set up transformation from metafile coordinates. 02059 02060 void c_plsdimap( PLINT dimxmin, PLINT dimxmax, PLINT dimymin, PLINT dimymax, PLFLT dimxpmm, PLFLT dimypmm ); 02061 02062 // Set plot orientation, specifying rotation in units of pi/2. 02063 02064 void c_plsdiori( PLFLT rot ); 02065 02066 // Set window into plot space 02067 02068 void c_plsdiplt( PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax ); 02069 02070 // Set window into plot space incrementally (zoom) 02071 void c_plsdiplz( PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax ); 02072 02073 // Set seed for internal random number generator 02074 void c_plseed( uint s ); 02075 02076 // Set the escape character for text strings. 02077 void c_plsesc( char esc ); 02078 02079 // Set family file parameters 02080 02081 void c_plsfam( PLINT fam, PLINT num, PLINT bmax ); 02082 02083 // Set FCI (font characterization integer) 02084 02085 void c_plsfci( PLUNICODE fci ); 02086 02087 // Set the output file name. 02088 void c_plsfnam( const char *fnam ); 02089 02090 // Set the current font family, style and weight 02091 02092 void c_plsfont( PLINT family, PLINT style, PLINT weight ); 02093 02094 // Shade region. 02095 void c_plshade( PLFLT **a, PLINT nx, PLINT ny, PLINT function( PLFLT, PLFLT ) defined, PLFLT left, 02096 PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, 02097 PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color, 02098 PLFLT max_width, void function( PLINT, PLFLT *, PLFLT* ) fill, PLBOOL rectangular, 02099 void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data ); 02100 02101 void c_plshades( PLFLT **a, PLINT nx, PLINT ny, PLINT function( PLFLT, PLFLT ) defined, PLFLT xmin, 02102 PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT *clevel, PLINT nlevel, PLFLT fill_width, 02103 PLINT cont_color, PLFLT cont_width, void function( PLINT, PLFLT *, PLFLT* ) fill, 02104 PLBOOL rectangular, void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, 02105 PLPointer pltr_data ); 02106 02107 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 ); 02108 02109 // Set up lengths of major tick marks. 02110 02111 void c_plsmaj( PLFLT def, PLFLT scale ); 02112 02113 // Set the memory area to be plotted (with the 'mem' driver) 02114 02115 void c_plsmem( PLINT maxx, PLINT maxy, void *plotmem ); 02116 02117 // Set up lengths of minor tick marks. 02118 02119 void c_plsmin( PLFLT def, PLFLT scale ); 02120 02121 // Set orientation. Must be done before calling plinit. 02122 02123 void c_plsori( PLINT ori ); 02124 02125 // Set output device parameters. Usually ignored by the driver. 02126 void c_plspage( PLFLT xp, PLFLT yp, PLINT xleng, PLINT yleng, PLINT xoff, PLINT yoff ); 02127 02128 // Set the colors for color table 0 from a cmap0 file 02129 void c_plspal0( const char* filename ); 02130 02131 // Set the colors for color table 1 from a cmap1 file 02132 void c_plspal1( const char *filename, PLBOOL interpolate ); 02133 02134 // Set the pause (on end-of-page) status 02135 void c_plspause( PLBOOL pause ); 02136 02137 // Set stream number. 02138 02139 void c_plsstrm( PLINT strm ); 02140 02141 // Set the number of subwindows in x and y 02142 02143 void c_plssub( PLINT nx, PLINT ny ); 02144 02145 // Set symbol height. 02146 02147 void c_plssym( PLFLT def, PLFLT scale ); 02148 02149 // Initialize PLplot, passing in the windows/page settings. 02150 void c_plstar( PLINT nx, PLINT ny ); 02151 02152 // Initialize PLplot, passing the device name and windows/page settings. 02153 void c_plstart( const char *devname, PLINT nx, PLINT ny ); 02154 02155 // Set the coordinate transform 02156 void c_plstransform( ct_func coordinate_transform = null, PLPointer coordinate_transform_data = null ); 02157 02158 // Add a point to a stripchart. 02159 void c_plstripa( PLINT id, PLINT pen, PLFLT x, PLFLT y ); 02160 02161 // Create 1d stripchart 02162 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 ); 02163 02164 // Deletes and releases memory used by a stripchart. 02165 void c_plstripd( PLINT id ); 02166 02167 // plots a 2d image (or a matrix too large for plshade() ) 02168 void c_plimagefr( PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 02169 PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, 02170 void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); 02171 02172 // plots a 2d image (or a matrix too large for plshade() ) - colors 02173 // automatically scaled 02174 void c_plimage( PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 02175 PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax ); 02176 02177 // Set up a new line style 02178 void c_plstyl( PLINT nms, PLINT *mark, PLINT *space ); 02179 02180 // Plots the 3d surface representation of the function z[x][y]. 02181 void c_plsurf3d( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, 02182 PLFLT *clevel, PLINT nlevel ); 02183 02184 // Plots the 3d surface representation of the function z[x][y] with y 02185 // index limits. 02186 void c_plsurf3dl( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, 02187 PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT *indexymax ); 02188 02189 // Sets the edges of the viewport to the specified absolute coordinates 02190 void c_plsvpa( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ); 02191 02192 // Set x axis labeling parameters 02193 void c_plsxax( PLINT digmax, PLINT digits ); 02194 02195 // Set inferior X window 02196 void plsxwin( PLINT window_id ); 02197 02198 // Set y axis labeling parameters 02199 void c_plsyax( PLINT digmax, PLINT digits ); 02200 02201 // Plots array y against x for n points using Hershey symbol "code" 02202 void c_plsym( PLINT n, PLFLT *x, PLFLT *y, PLINT code ); 02203 02204 // Set z axis labeling parameters 02205 02206 void c_plszax( PLINT digmax, PLINT digits ); 02207 02208 // Switches to text screen. 02209 02210 void c_pltext(); 02211 02212 // Set the format for date / time labels 02213 void c_pltimefmt( const char *fmt ); 02214 02215 // Sets the edges of the viewport with the given aspect ratio, leaving 02216 // room for labels. 02217 02218 void c_plvasp( PLFLT aspect ); 02219 02220 // Creates the largest viewport of the specified aspect ratio that fits 02221 // within the specified normalized subpage coordinates. 02222 02223 void c_plvpas( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT aspect ); 02224 02225 // Creates a viewport with the specified normalized subpage coordinates. 02226 02227 void c_plvpor( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ); 02228 02229 // Defines a "standard" viewport with seven character heights for 02230 // the left margin and four character heights everywhere else. 02231 02232 void c_plvsta(); 02233 02234 // Set up a window for three-dimensional plotting. 02235 02236 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 ); 02237 02238 // Set pen width. 02239 02240 void c_plwidth( PLFLT width ); 02241 02242 // Set up world coordinates of the viewport boundaries (2d plots). 02243 02244 void c_plwind( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ); 02245 02246 // set xor mode; mode = 1-enter, 0-leave, status = 0 if not interactive device 02247 02248 void c_plxormod( PLBOOL mode, PLBOOL *status ); 02249 02250 //--------------------------------------------------------------------------* * Functions for use from C or C++ only 02251 //-------------------------------------------------------------------------- 02252 02253 // Returns a list of file-oriented device names and their menu strings 02254 02255 void plgFileDevs( char ***p_menustr, char ***p_devname, int *p_ndev ); 02256 02257 // Returns a list of all device names and their menu strings 02258 02259 void plgDevs( char ***p_menustr, char ***p_devname, int *p_ndev ); 02260 02261 // Set the function pointer for the keyboard event handler 02262 02263 void plsKeyEH( void function( PLGraphicsIn *, void *, int * ) KeyEH, void *KeyEH_data ); 02264 02265 // Set the function pointer for the (mouse) button event handler 02266 02267 void plsButtonEH( void function( PLGraphicsIn *, void *, int * ) ButtonEH, void *ButtonEH_data ); 02268 02269 // Sets an optional user bop handler 02270 02271 void plsbopH( void function( void *, int * ) handler, void *handler_data ); 02272 02273 // Sets an optional user eop handler 02274 02275 void plseopH( void function( void *, int * ) handler, void *handler_data ); 02276 02277 // Set the variables to be used for storing error info 02278 02279 void plsError( PLINT *errcode, const char *errmsg ); 02280 02281 // Sets an optional user exit handler. 02282 02283 void plsexit( int function( const char * ) handler ); 02284 02285 // Sets an optional user abort handler. 02286 02287 void plsabort( void function( const char * ) handler ); 02288 02289 // Transformation routines 02290 02291 // Identity transformation. 02292 void pltr0( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data ); 02293 02294 // Does linear interpolation from singly dimensioned coord arrays. 02295 void pltr1( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data ); 02296 02297 // Does linear interpolation from doubly dimensioned coord arrays 02298 // (column dominant, as per normal C 2d arrays). 02299 void pltr2( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data ); 02300 02301 // Just like pltr2() but uses pointer arithmetic to get coordinates from 02302 // 2d grid tables. 02303 void pltr2p( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data ); 02304 02305 // Identity transformation for plots from Fortran. 02306 void pltr0f( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data ); 02307 02308 // Does linear interpolation from doubly dimensioned coord arrays 02309 // (row dominant, i.e. Fortran ordering). 02310 void pltr2f( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data ); 02311 02312 // Function evaluators 02313 02314 // Does a lookup from a 2d function array. Array is of type (PLFLT **), 02315 // and is column dominant (normal C ordering). 02316 02317 PLFLT plf2eval2( PLINT ix, PLINT iy, PLPointer plf2eval_data ); 02318 02319 // Does a lookup from a 2d function array. Array is of type (PLFLT *), 02320 // and is column dominant (normal C ordering). 02321 02322 PLFLT plf2eval( PLINT ix, PLINT iy, PLPointer plf2eval_data ); 02323 02324 // Does a lookup from a 2d function array. Array is of type (PLFLT *), 02325 // and is row dominant (Fortran ordering). 02326 02327 PLFLT plf2evalr( PLINT ix, PLINT iy, PLPointer plf2eval_data ); 02328 02329 // Command line parsing utilities 02330 // Clear internal option table info structure. 02331 void plClearOpts(); 02332 02333 // Reset internal option table info structure. 02334 void plResetOpts(); 02335 02336 // Merge user option table into internal info structure. 02337 02338 int plMergeOpts( PLOptionTable *options, const char *name, const char **notes ); 02339 02340 // Set the strings used in usage and syntax messages. 02341 02342 void plSetUsage( const char *program_string, const char *usage_string ); 02343 02344 // Process input strings, treating them as an option and argument pair. 02345 // The first is for the external API, the second the work routine declared 02346 // here for backward compatibilty. 02347 int c_plsetopt( const char *opt, const char *optarg ); 02348 02349 int plSetOpt( const char *opt, const char *optarg ); 02350 02351 // Process options list using current options info. 02352 int c_plparseopts( int *p_argc, const char **argv, PLINT mode ); 02353 02354 // Print usage & syntax message. 02355 02356 void plOptUsage(); 02357 02358 // Miscellaneous 02359 02360 // Get the escape character for text strings. 02361 02362 void plgesc( char *p_esc ); 02363 02364 // Front-end to driver escape function. 02365 02366 void pl_cmd( PLINT op, void *ptr ); 02367 02368 // Return full pathname for given file if executable 02369 02370 int plFindName( char *p ); 02371 02372 // Looks for the specified executable file according to usual search path. 02373 02374 char * plFindCommand( const char *fn ); 02375 02376 // Gets search name for file by concatenating the dir, subdir, and file 02377 // name, allocating memory as needed. 02378 02379 void plGetName( const char *dir, const char *subdir, const char *filename, char **filespec ); 02380 02381 // Prompts human to input an integer in response to given message. 02382 02383 PLINT plGetInt( const char *s ); 02384 02385 // Prompts human to input a float in response to given message. 02386 02387 PLFLT plGetFlt( const char *s ); 02388 02389 // Nice way to allocate space for a vectored 2d grid 02390 02391 // Allocates a block of memory for use as a 2-d grid of PLFLT's. 02392 02393 void plAlloc2dGrid( PLFLT ***f, PLINT nx, PLINT ny ); 02394 02395 // Frees a block of memory allocated with plAlloc2dGrid(). 02396 02397 void plFree2dGrid( PLFLT **f, PLINT nx, PLINT ny ); 02398 02399 // Find the maximum and minimum of a 2d matrix allocated with plAllc2dGrid(). 02400 void plMinMax2dGrid( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmax, PLFLT *fmin ); 02401 02402 // Wait for graphics input event and translate to world coordinates 02403 02404 int plGetCursor( PLGraphicsIn *gin ); 02405 02406 // Translates relative device coordinates to world coordinates. 02407 02408 int plTranslateCursor( PLGraphicsIn *gin ); 02409