Revision: 11714
http://plplot.svn.sourceforge.net/plplot/?rev=11714&view=rev
Author: hezekiahcarty
Date: 2011-04-18 03:58:36 +0000 (Mon, 18 Apr 2011)
Log Message:
-----------
Add a colorbar to each page of C example 16 (disabled by default)
This is primarily to illustrate a colorbar in action. It is not intended
to be propagated to other languages at this point.
Use the "-colorbar" command line flag to enable the colorbar on each page.
Modified Paths:
--------------
trunk/examples/c/x16c.c
Modified: trunk/examples/c/x16c.c
===================================================================
--- trunk/examples/c/x16c.c 2011-04-17 22:02:48 UTC (rev 11713)
+++ trunk/examples/c/x16c.c 2011-04-18 03:58:36 UTC (rev 11714)
@@ -19,6 +19,9 @@
// anyway, and cannot be reproduced by any
// front end other than the C one.
+// For now, don't show the colorbars while we are working out the API.
+static int colorbar = 0;
+
// polar plot data
#define PERIMETERPTS 100
@@ -42,6 +45,15 @@
static PLOptionTable options[] = {
{
+ "colorbar", // Turns on the colorbar for each page
+ NULL,
+ NULL,
+ &colorbar,
+ PL_OPT_BOOL,
+ "-colorbar",
+ "Plot a \"color bar\" on each page."
+ },
+ {
"exclude", // Turns on page showing exclusion
NULL,
NULL,
@@ -221,6 +233,25 @@
cont_color, cont_width,
plfill, 1, NULL, NULL );
+ if ( colorbar )
+ {
+ // Smaller text
+ plschr( 0.0, 0.75 );
+ // Small ticks on the vertical axis
+ plsmaj( 0.0, 0.5 );
+ plsmin( 0.0, 0.5 );
+
+ plcolorbar( PL_POSITION_RIGHT, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL,
+ 0.05, 0.15, 0.7, 0.03, 0.0, 0.0,
+ cont_color, cont_width, 0.0, 0, "bv", "",
+ ns + 1, shedge );
+
+ // Reset text and tick sizes
+ plschr( 0.0, 1.0 );
+ plsmaj( 0.0, 1.0 );
+ plsmin( 0.0, 1.0 );
+ }
+
plcol0( 1 );
plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 );
plcol0( 2 );
@@ -248,6 +279,25 @@
cont_color, cont_width,
plfill, 1, pltr1, (void *) &cgrid1 );
+ if ( colorbar )
+ {
+ // Smaller text
+ plschr( 0.0, 0.75 );
+ // Small ticks on the vertical axis
+ plsmaj( 0.0, 0.5 );
+ plsmin( 0.0, 0.5 );
+
+ plcolorbar( PL_POSITION_RIGHT, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL,
+ 0.05, 0.15, 0.7, 0.03, 0.0, 0.0,
+ cont_color, cont_width, 0.0, 0, "bv", "",
+ ns + 1, shedge );
+
+ // Reset text and tick sizes
+ plschr( 0.0, 1.0 );
+ plsmaj( 0.0, 1.0 );
+ plsmin( 0.0, 1.0 );
+ }
+
plcol0( 1 );
plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 );
plcol0( 2 );
@@ -275,6 +325,25 @@
cont_color, cont_width,
plfill, 0, pltr2, (void *) &cgrid2 );
+ if ( colorbar )
+ {
+ // Smaller text
+ plschr( 0.0, 0.75 );
+ // Small ticks on the vertical axis
+ plsmaj( 0.0, 0.5 );
+ plsmin( 0.0, 0.5 );
+
+ plcolorbar( PL_POSITION_RIGHT, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL,
+ 0.05, 0.15, 0.7, 0.03, 0.0, 0.0,
+ cont_color, cont_width, 0.0, 0, "bv", "",
+ ns + 1, shedge );
+
+ // Reset text and tick sizes
+ plschr( 0.0, 1.0 );
+ plsmaj( 0.0, 1.0 );
+ plsmin( 0.0, 1.0 );
+ }
+
plcol0( 1 );
plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 );
plcol0( 2 );
@@ -301,6 +370,25 @@
2, 3,
plfill, 0, pltr2, (void *) &cgrid2 );
+ if ( colorbar )
+ {
+ // Smaller text
+ plschr( 0.0, 0.75 );
+ // Small ticks on the vertical axis
+ plsmaj( 0.0, 0.5 );
+ plsmin( 0.0, 0.5 );
+
+ plcolorbar( PL_POSITION_RIGHT, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL,
+ 0.05, 0.15, 0.7, 0.03, 0.0, 0.0,
+ 2, 3, 0.0, 0, "bv", "",
+ ns + 1, shedge );
+
+ // Reset text and tick sizes
+ plschr( 0.0, 1.0 );
+ plsmaj( 0.0, 1.0 );
+ plsmin( 0.0, 1.0 );
+ }
+
plcol0( 1 );
plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 );
plcol0( 2 );
@@ -378,6 +466,25 @@
cont_color, cont_width,
plfill, 0, pltr2, (void *) &cgrid2 );
+ if ( colorbar )
+ {
+ // Smaller text
+ plschr( 0.0, 0.75 );
+ // Small ticks on the vertical axis
+ plsmaj( 0.0, 0.5 );
+ plsmin( 0.0, 0.5 );
+
+ plcolorbar( PL_POSITION_RIGHT, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL,
+ 0.06, 0.15, 0.7, 0.03, 0.0, 0.0,
+ cont_color, cont_width, 0.0, 0, "bv", "",
+ ns + 1, shedge );
+
+ // Reset text and tick sizes
+ plschr( 0.0, 1.0 );
+ plsmaj( 0.0, 1.0 );
+ plsmin( 0.0, 1.0 );
+ }
+
// Now we can draw the perimeter. (If do before, shade stuff may overlap.)
for ( i = 0; i < PERIMETERPTS; i++ )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|