void plplot_text( plot_driver_type * driver , const plot_text_type * plot_text) { double just = 0.0; // Left justified plschr( 0.0 , plot_text_get_font_scale( plot_text ) ); plcol0( BLACK ); plptex( plot_text_get_x( plot_text ) , plot_text_get_y( plot_text ) , 1 , 0 , just , plot_text_get_text( plot_text )); plschr( 0.0 , 1.0 ); }
static void plcntr(PLFLT (*f2eval) (PLINT, PLINT, PLPointer), PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT flev, PLINT **ipts, void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data) { PLINT kcol, krow, lastindex; PLFLT distance; PLFLT save_def, save_scale; char flabel[30]; plgchr(&save_def, &save_scale); save_scale = save_scale/save_def; cont_new_store(flev); /* format contour label for plptex and define the font height of the labels */ plfloatlabel(flev, flabel); plschr(0.0, contlabel_size); /* Clear array for traversed squares */ for (kcol = kx; kcol < lx; kcol++) { for (krow = ky; krow < ly; krow++) { ipts[kcol][krow] = 0; } } for (krow = ky; krow < ly; krow++) { for (kcol = kx; kcol < lx; kcol++) { if (ipts[kcol][krow] == 0) { /* Follow and draw a contour */ pldrawcn(f2eval, f2eval_data, nx, ny, kx, lx, ky, ly, flev, flabel, kcol, krow, 0.0, 0.0, -2, ipts, &distance, &lastindex, pltr, pltr_data); if (error) return; } } } plschr(save_def, save_scale); }
static void plplot_set_axis(plot_driver_type * driver , const plot_range_type * range , const char * timefmt , plot_color_type box_color , double tick_font_size) { plplot_state_type * state = driver->state; { double xmin , xmax , ymin , ymax; plot_range_get_limits( range , &xmin , &xmax , &ymin , &ymax); if (state->logx) { xmin = log( xmin ); xmax = log( xmax ); } if (state->logy) { ymin = log( ymin ); ymax = log( ymax ); } plwind( xmin , xmax , ymin , ymax ); } plcol0(box_color); plschr(0, tick_font_size * PLOT_DEFAULT_LABEL_FONTSIZE); if (timefmt != NULL) { pltimefmt(timefmt); state->plbox_xopt = util_realloc_sprintf( state->plbox_xopt , "%s%c" , state->plbox_xopt , 'd'); } plbox(state->plbox_xopt, 0.0, 0, state->plbox_yopt , 0.0, 0); }
int main( int argc, char *argv[] ) { int i, j; plparseopts( &argc, argv, PL_PARSE_FULL ); plinit(); pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plcol0( 0 ); plbox( "", 1.0, 0, "", 1.0, 0 ); plscmap0n( 7 ); plscmap0( red, green, blue, 7 ); plschr( 0, 4.0 ); plfont( 1 ); for ( i = 0; i < 4; i++ ) { plcol0( i + 1 ); plfill( 4, px, py ); for ( j = 0; j < 4; j++ ) py [j] += 1.0 / 4.0; } plcol0( 0 ); for ( i = 0; i < 12; i++ ) plptex( sx [i], sy [i], 1.0, 0.0, 0.5, peace [i] ); plend(); exit( 0 ); }
int main( int argc, const char *argv[] ) { PLFLT *x, *y, **z, xmin = 0., xmax = 1.0, xmid = 0.5 * ( xmax + xmin ), xrange = xmax - xmin, ymin = 0., ymax = 1.0, ymid = 0.5 * ( ymax + ymin ), yrange = ymax - ymin, zmin = 0., zmax = 1.0, zmid = 0.5 * ( zmax + zmin ), zrange = zmax - zmin, ysmin = ymin + 0.1 * yrange, ysmax = ymax - 0.1 * yrange, ysrange = ysmax - ysmin, dysrot = ysrange / (PLFLT) ( NROTATION - 1 ), dysshear = ysrange / (PLFLT) ( NSHEAR - 1 ), zsmin = zmin + 0.1 * zrange, zsmax = zmax - 0.1 * zrange, zsrange = zsmax - zsmin, dzsrot = zsrange / (PLFLT) ( NROTATION - 1 ), dzsshear = zsrange / (PLFLT) ( NSHEAR - 1 ), ys, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, omega, sin_omega, cos_omega, domega; int i, j; PLFLT radius, pitch, xpos, ypos, zpos; // p1string must be exactly one character + the null termination // character. char p1string[] = "O"; const char *pstring = "The future of our civilization depends on software freedom."; // Allocate and define the minimal x, y, and z to insure 3D box x = (PLFLT *) calloc( XPTS, sizeof ( PLFLT ) ); y = (PLFLT *) calloc( YPTS, sizeof ( PLFLT ) ); plAlloc2dGrid( &z, XPTS, YPTS ); for ( i = 0; i < XPTS; i++ ) { x[i] = xmin + (double) i * ( xmax - xmin ) / (double) ( XPTS - 1 ); } for ( j = 0; j < YPTS; j++ ) y[j] = ymin + (double) j * ( ymax - ymin ) / (double) ( YPTS - 1 ); for ( i = 0; i < XPTS; i++ ) { for ( j = 0; j < YPTS; j++ ) { z[i][j] = 0.; } } // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); plinit(); // Page 1: Demonstrate inclination and shear capability pattern. pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // z = zmin. plschr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NREVOLUTION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.5 * xrange * cos_omega; y_inclination = 0.5 * yrange * sin_omega; z_inclination = 0.; x_shear = -0.5 * xrange * sin_omega; y_shear = 0.5 * yrange * cos_omega; z_shear = 0.; plptex3( xmid, ymid, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // x = xmax. plschr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NREVOLUTION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.; y_inclination = -0.5 * yrange * cos_omega; z_inclination = 0.5 * zrange * sin_omega; x_shear = 0.; y_shear = 0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; plptex3( xmax, ymid, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // y = ymax. plschr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NREVOLUTION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.5 * xrange * cos_omega; y_inclination = 0.; z_inclination = 0.5 * zrange * sin_omega; x_shear = -0.5 * xrange * sin_omega; y_shear = 0.; z_shear = 0.5 * zrange * cos_omega; plptex3( xmid, ymax, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, DRAW_LINEXY ); // Page 2: Demonstrate rotation of string around its axis. pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // y = ymax. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NROTATION ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsrot * (PLFLT) i; plptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for y = y#dmax#u" ); } // x = xmax. plschr( 0., 1.0 ); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; y_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NROTATION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_shear = 0.5 * xrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsrot * (PLFLT) i; plptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for x = x#dmax#u" ); } // z = zmin. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NROTATION ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * cos_omega; z_shear = 0.5 * zrange * sin_omega; ys = ysmax - dysrot * (PLFLT) i; plptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for z = z#dmin#u" ); } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, DRAW_LINEXY ); // Page 3: Demonstrate shear of string along its axis. // Work around xcairo and pngcairo (but not pscairo) problems for // shear vector too close to axis of string. (N.B. no workaround // would be domega = 0.) domega = 0.05; pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // y = ymax. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; y_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * M_PI * ( (PLFLT) i / (PLFLT) NSHEAR ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_shear = 0.5 * xrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsshear * (PLFLT) i; plptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for y = y#dmax#u" ); } // x = xmax. plschr( 0., 1.0 ); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * M_PI * ( (PLFLT) i / (PLFLT) NSHEAR ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = -0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsshear * (PLFLT) i; plptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for x = x#dmax#u" ); } // z = zmin. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; z_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * M_PI * ( (PLFLT) i / (PLFLT) NSHEAR ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * cos_omega; x_shear = 0.5 * xrange * sin_omega; ys = ysmax - dysshear * (PLFLT) i; plptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for z = z#dmin#u" ); } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, DRAW_LINEXY ); // Page 4: Demonstrate drawing a string on a 3D path. pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 40., -30. ); plcol0( 2 ); plbox3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); plschr( 0., 1.2 ); // domega controls the spacing between the various characters of the // string and also the maximum value of omega for the given number // of characters in *pstring. domega = 2. * M_PI / (double) strlen( pstring ); omega = 0.; // 3D function is a helix of the given radius and pitch radius = 0.5; pitch = 1. / ( 2. * M_PI ); while ( *pstring ) { sin_omega = sin( omega ); cos_omega = cos( omega ); xpos = xmid + radius * sin_omega; ypos = ymid - radius * cos_omega; zpos = zmin + pitch * omega; // In general, the inclination is proportional to the derivative of // the position wrt theta. x_inclination = radius * cos_omega;; y_inclination = radius * sin_omega; z_inclination = pitch; // The shear vector should be perpendicular to the 3D line with Z // component maximized, but for low pitch a good approximation is // a constant vector that is parallel to the Z axis. x_shear = 0.; y_shear = 0.; z_shear = 1.; *p1string = *pstring; plptex3( xpos, ypos, zpos, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, p1string ); pstring++; omega += domega; } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, DRAW_LINEXY ); // Page 5: Demonstrate plmtex3 axis labelling capability pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); plschr( 0., 1.0 ); plmtex3( "xp", 3.0, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "xp", 4.5, 0.5, 0.5, "primary X-axis label" ); plmtex3( "xs", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "xs", -1.0, 0.5, 0.5, "secondary X-axis label" ); plmtex3( "yp", 3.0, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "yp", 4.5, 0.5, 0.5, "primary Y-axis label" ); plmtex3( "ys", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "ys", -1.0, 0.5, 0.5, "secondary Y-axis label" ); plmtex3( "zp", 4.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "zp", 3.0, 0.5, 0.5, "primary Z-axis label" ); plmtex3( "zs", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "zs", -1.0, 0.5, 0.5, "secondary Z-axis label" ); // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, DRAW_LINEXY ); // Clean up. free( (void *) x ); free( (void *) y ); plFree2dGrid( z, XPTS, YPTS ); plend(); exit( 0 ); }
static void plcntr(PLFLT (*f2eval) (PLINT, PLINT, PLPointer), PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT flev, PLINT *iscan, PLINT *ixstor, PLINT *iystor, PLINT nstor, void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data) { PLINT kcol, krow, kstor, kscan, l, ixt, iyt, jstor, next; char flabel[30]; cont_new_store(flev); /* format contour label for plptex and define the font height of the labels */ plfloatlabel(flev, flabel); plschr(0.0, contlabel_size); /* Initialize memory pointers */ kstor = 0; kscan = 0; for (krow = ky; krow <= ly; krow++) { for (kcol = kx + 1; kcol <= lx; kcol++) { /* Follow and draw a contour */ pldrawcn(f2eval, f2eval_data, nx, ny, kx, lx, ky, ly, flev, flabel, kcol, krow, &kscan, &kstor, iscan, ixstor, iystor, nstor, pltr, pltr_data); if (error) return; } /* Search of row complete */ /* Set up memory of next row in iscan and edit ixstor and iystor */ if (krow < ny-1) { jstor = 0; kscan = 0; next = krow + 1; for (l = 1; l <= kstor; l++) { ixt = ixstor[l - 1]; iyt = iystor[l - 1]; /* Memory of next row into iscan */ if (iyt == next) { kscan = kscan + 1; iscan[kscan - 1] = ixt; } /* Retain memory of rows to come, and forget rest */ else if (iyt > next) { jstor = jstor + 1; ixstor[jstor - 1] = ixt; iystor[jstor - 1] = iyt; } } kstor = jstor; } } plschr(0.0, 1.0); }
int main( int argc, const char *argv[] ) { int i, j, dthet, theta0, theta1, theta; PLFLT just, dx, dy; static PLFLT x[500], y[500], per[5]; per[0] = 10.; per[1] = 32.; per[2] = 12.; per[3] = 30.; per[4] = 16.; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); pladv( 0 ); // Ensure window has aspect ratio of one so circle is // plotted as a circle. plvasp( 1.0 ); plwind( 0., 10., 0., 10. ); // plenv(0., 10., 0., 10., 1, -2); plcol0( 2 ); // n.b. all theta quantities scaled by 2*M_PI/500 to be integers to avoid // floating point logic problems. theta0 = 0; dthet = 1; for ( i = 0; i <= 4; i++ ) { j = 0; x[j] = 5.; y[j++] = 5.; // n.b. the theta quantities multiplied by 2*M_PI/500 afterward so // in fact per is interpreted as a percentage. theta1 = (int) ( theta0 + 5 * per[i] ); if ( i == 4 ) theta1 = 500; for ( theta = theta0; theta <= theta1; theta += dthet ) { x[j] = 5 + 3 * cos( ( 2. * M_PI / 500. ) * theta ); y[j++] = 5 + 3 * sin( ( 2. * M_PI / 500. ) * theta ); } plcol0( i + 1 ); plpsty( ( i + 3 ) % 8 + 1 ); plfill( j, x, y ); plcol0( 1 ); plline( j, x, y ); just = ( 2. * M_PI / 500. ) * ( theta0 + theta1 ) / 2.; dx = .25 * cos( just ); dy = .25 * sin( just ); if ( ( theta0 + theta1 ) < 250 || ( theta0 + theta1 ) > 750 ) just = 0.; else just = 1.; plptex( ( x[j / 2] + dx ), ( y[j / 2] + dy ), 1.0, 0.0, just, text[i] ); theta0 = theta - dthet; } plfont( 2 ); plschr( 0., 1.3 ); plptex( 5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales" ); // Don't forget to call PLEND to finish off! plend(); exit( 0 ); }
int main( int argc, char **argv ) { PLFLT minx, maxx, miny, maxy; PLFLT x, y; //variables for the shapelib example const PLINT nbeachareas = 2; const PLINT beachareas[] = { 23, 24 }; const PLINT nwoodlandareas = 94; PLINT woodlandareas[94]; const PLINT nshingleareas = 22; const PLINT shingleareas[] = { 0, 1, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 217, 2424, 2425, 2426, 2427, 2428, 2491, 2577 }; const PLINT ncragareas = 2024; PLINT cragareas[2024]; const PLINT majorroads[] = { 33, 48, 71, 83, 89, 90, 101, 102, 111 }; int i; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Longitude (x) and latitude (y) miny = -70; maxy = 80; plinit(); // Cartesian plots // Most of world minx = -170; maxx = minx + 360; // Setup a custom latitude and longitude-based scaling function. plslabelfunc( geolocation_labeler, NULL ); plcol0( 1 ); plenv( minx, maxx, miny, maxy, 1, 70 ); plmap( NULL, "usaglobe", minx, maxx, miny, maxy ); // The Americas minx = 190; maxx = 340; plcol0( 1 ); plenv( minx, maxx, miny, maxy, 1, 70 ); plmap( NULL, "usaglobe", minx, maxx, miny, maxy ); // Clear the labeling function plslabelfunc( NULL, NULL ); // Polar, Northern hemisphere minx = 0; maxx = 360; plenv( -75., 75., -75., 75., 1, -1 ); plmap( mapform19, "globe", minx, maxx, miny, maxy ); pllsty( 2 ); plmeridians( mapform19, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); // Polar, Northern hemisphere, this time with a PLplot-wide transform minx = 0; maxx = 360; plstransform( map_transform, NULL ); pllsty( 1 ); plenv( -75., 75., -75., 75., 1, -1 ); // No need to set the map transform here as the global transform will be // used. plmap( NULL, "globe", minx, maxx, miny, maxy ); pllsty( 2 ); plmeridians( NULL, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); // Show Baltimore, MD on the map plcol0( 2 ); plssym( 0.0, 2.0 ); x = -76.6125; y = 39.2902778; plpoin( 1, &x, &y, 18 ); plssym( 0.0, 1.0 ); plptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); // For C, this is how the global transform is cleared plstransform( NULL, NULL ); // An example using shapefiles. The shapefiles used are from Ordnance Survey, UK. // These were chosen because they provide shapefiles for small grid boxes which // are easilly manageable for this demo. pllsty( 1 ); minx = 240570; maxx = 621109; miny = 87822; maxy = 722770; plscol0( 0, 255, 255, 255 ); plscol0( 1, 0, 0, 0 ); plscol0( 2, 150, 150, 150 ); plscol0( 3, 0, 50, 200 ); plscol0( 4, 50, 50, 50 ); plscol0( 5, 150, 0, 0 ); plscol0( 6, 100, 100, 255 ); minx = 265000; maxx = 270000; miny = 145000; maxy = 150000; plscol0( 0, 255, 255, 255 ); //white plscol0( 1, 0, 0, 0 ); //black plscol0( 2, 255, 200, 0 ); //yelow for sand plscol0( 3, 60, 230, 60 ); // green for woodland plscol0( 4, 210, 120, 60 ); //brown for contours plscol0( 5, 150, 0, 0 ); //red for major roads plscol0( 6, 180, 180, 255 ); //pale blue for water plscol0( 7, 100, 100, 100 ); //pale grey for shingle or boulders plscol0( 8, 100, 100, 100 ); //dark grey for custom polygons - generally crags plcol0( 1 ); plenv( minx, maxx, miny, maxy, 1, -1 ); pllab( "", "", "Martinhoe CP, Exmoor National Park, UK (shapelib only)" ); //Beach plcol0( 2 ); plmapfill( NULL, "ss/ss64ne_Landform_Area", minx, maxx, miny, maxy, beachareas, nbeachareas ); //woodland plcol0( 3 ); for ( i = 0; i < nwoodlandareas; ++i ) woodlandareas[i] = i + 218; plmapfill( NULL, "ss/ss64ne_Landform_Area", minx, maxx, miny, maxy, (PLINT_VECTOR) woodlandareas, nwoodlandareas ); //shingle or boulders plcol0( 7 ); plmapfill( NULL, "ss/ss64ne_Landform_Area", minx, maxx, miny, maxy, shingleareas, nshingleareas ); //crags plcol0( 8 ); for ( i = 0; i < ncragareas; ++i ) cragareas[i] = i + 325; plmapfill( NULL, "ss/ss64ne_Landform_Area", minx, maxx, miny, maxy, (PLINT_VECTOR) cragareas, ncragareas ); //draw contours, we need to separate contours from high/low coastline //draw_contours(pls, "ss/SS64_line", 433, 20, 4, 3, minx, maxx, miny, maxy ); plcol0( 4 ); plmapline( NULL, "ss/ss64ne_Height_Contours", minx, maxx, miny, maxy, NULL, 0 ); //draw the sea and surface water plwidth( 0.0 ); plcol0( 6 ); plmapfill( NULL, "ss/ss64ne_Water_Area", minx, maxx, miny, maxy, NULL, 0 ); plwidth( 2.0 ); plmapfill( NULL, "ss/ss64ne_Water_Line", minx, maxx, miny, maxy, NULL, 0 ); //draw the roads, first with black and then thinner with colour to give an //an outlined appearance plwidth( 5.0 ); plcol0( 1 ); plmapline( NULL, "ss/ss64ne_Road_Centreline", minx, maxx, miny, maxy, NULL, 0 ); plwidth( 3.0 ); plcol0( 0 ); plmapline( NULL, "ss/ss64ne_Road_Centreline", minx, maxx, miny, maxy, NULL, 0 ); plcol0( 5 ); plmapline( NULL, "ss/ss64ne_Road_Centreline", minx, maxx, miny, maxy, majorroads, 9 ); //draw buildings plwidth( 1.0 ); plcol0( 1 ); plmapfill( NULL, "ss/ss64ne_Building_Area", minx, maxx, miny, maxy, NULL, 0 ); //labels plsfci( 0x80000100 ); plschr( 0, 0.8 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 0.5, "MARTINHOE CP", minx, maxx, miny, maxy, 202 ); plschr( 0, 0.7 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 0.5, "Heale\nDown", minx, maxx, miny, maxy, 13 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 0.5, "South\nDown", minx, maxx, miny, maxy, 34 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 0.5, "Martinhoe\nCommon", minx, maxx, miny, maxy, 42 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 0.5, "Woody Bay", minx, maxx, miny, maxy, 211 ); plschr( 0, 0.6 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 0.5, "Mill Wood", minx, maxx, miny, maxy, 16 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 0.5, "Heale Wood", minx, maxx, miny, maxy, 17 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 1.0, "Bodley", minx, maxx, miny, maxy, 31 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 0.0, "Martinhoe", minx, maxx, miny, maxy, 37 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 0.5, "Woolhanger\nCommon", minx, maxx, miny, maxy, 60 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 0.5, "West Ilkerton\nCommon", minx, maxx, miny, maxy, 61 ); plmaptex( NULL, "ss/ss64ne_General_Text", 1.0, 0.0, 0.5, "Caffyns\nHeanton\nDown", minx, maxx, miny, maxy, 62 ); plend(); exit( 0 ); }
static void plplot_set_labels( plot_driver_type * driver , const char * title , const char * xlabel , const char * ylabel , plot_color_type label_color , double label_font_size) { plcol0(label_color); plschr(0, label_font_size * PLOT_DEFAULT_LABEL_FONTSIZE); pllab(xlabel, ylabel, title); }