From: <and...@us...> - 2013-05-22 22:44:44
|
Revision: 12347 http://sourceforge.net/p/plplot/code/12347 Author: andrewross Date: 2013-05-22 22:44:41 +0000 (Wed, 22 May 2013) Log Message: ----------- Update python bindings to support plcolorbar. Update example 16 and 33 consistent with the C versions to use this. Modified Paths: -------------- trunk/bindings/python/plplotcmodule.i trunk/bindings/swig-support/plplotcapi.i trunk/examples/python/xw16.py trunk/examples/python/xw33.py Modified: trunk/bindings/python/plplotcmodule.i =================================================================== --- trunk/bindings/python/plplotcmodule.i 2013-05-22 22:41:41 UTC (rev 12346) +++ trunk/bindings/python/plplotcmodule.i 2013-05-22 22:44:41 UTC (rev 12347) @@ -240,6 +240,26 @@ } %typemap( freearg ) const PLINT * Array { Py_DECREF( tmp$argnum );} +// set X and Y length for later consistency checking +%typemap( in ) const PLINT * ArrayN( PyArrayObject * tmp ) +{ + int i; + tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 ); + if ( tmp == NULL ) + return NULL; + if ( PyArray_DIMS(tmp)[0] != Alen ) + { + PyErr_SetString( PyExc_ValueError, "Vectors must be same length." ); + return NULL; + } + Xlen = PyArray_DIMS(tmp)[0]; + $1 = (PLINT *) PyArray_DATA(tmp); + Ylen = -1; + for ( i = 0; i < Xlen; i++ ) + if ( $1[i] > Ylen ) Ylen = $1[i]; +} +%typemap( freearg ) const PLINT * ArrayN { Py_DECREF( tmp$argnum );} + //-------------------------------------------------------------------------- // PLFLT Arrays //-------------------------------------------------------------------------- @@ -602,7 +622,7 @@ } //************************** -// special for pllegend, char ** ArrayCk +// special for pllegend / plcolorbar, char ** ArrayCk //*************************** // no count, but check consistency with previous. Always allow NULL strings. %typemap( in ) const char **ArrayCk( PyArrayObject * tmp ) @@ -629,6 +649,28 @@ } %typemap( freearg ) const char **ArrayCk { Py_DECREF( tmp$argnum ); free( $1 );} +// With count. Always allow NULL strings. +%typemap( in ) (PLINT n, const char **Array) ( PyArrayObject * tmp ) +{ + int i; + tmp = (PyArrayObject *) PyArray_ContiguousFromObject( $input, NPY_STRING, 1, 1 ); + if ( tmp == NULL ) + return NULL; + Alen = PyArray_DIMS(tmp)[0]; + $1 = Alen; + $2 = (char **) malloc( sizeof ( char* ) * Alen ); + for ( i = 0; i < Alen; i++ ) + { + $2[i] = PyArray_DATA(tmp) + i * PyArray_STRIDES(tmp)[0]; + if ( $2[i] == NULL ) + { + free( $2 ); + return NULL; + } + } +} +%typemap( freearg ) (PLINT n, const char **Array) { Py_DECREF( tmp$argnum ); free( $2 );} + //************************** // String returning functions //*************************** Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2013-05-22 22:41:41 UTC (rev 12346) +++ trunk/bindings/swig-support/plplotcapi.i 2013-05-22 22:44:41 UTC (rev 12347) @@ -117,16 +117,23 @@ #define PL_LEGEND_ROW_MAJOR 128 // Flags for plcolorbar -#define PL_COLORBAR_LABEL_LEFT 1 -#define PL_COLORBAR_LABEL_RIGHT 2 -#define PL_COLORBAR_LABEL_TOP 4 -#define PL_COLORBAR_LABEL_BOTTOM 8 -#define PL_COLORBAR_IMAGE 16 -#define PL_COLORBAR_SHADE 32 -#define PL_COLORBAR_GRADIENT 64 -#define PL_COLORBAR_CAP_LOW 128 -#define PL_COLORBAR_CAP_HIGH 256 -#define PL_COLORBAR_SHADE_LABEL 512 +#define PL_COLORBAR_LABEL_LEFT 0x1 +#define PL_COLORBAR_LABEL_RIGHT 0x2 +#define PL_COLORBAR_LABEL_TOP 0x4 +#define PL_COLORBAR_LABEL_BOTTOM 0x8 +#define PL_COLORBAR_IMAGE 0x10 +#define PL_COLORBAR_SHADE 0x20 +#define PL_COLORBAR_GRADIENT 0x40 +#define PL_COLORBAR_CAP_NONE 0x80 +#define PL_COLORBAR_CAP_LOW 0x100 +#define PL_COLORBAR_CAP_HIGH 0x200 +#define PL_COLORBAR_SHADE_LABEL 0x400 +#define PL_COLORBAR_ORIENT_RIGHT 0x800 +#define PL_COLORBAR_ORIENT_TOP 0x1000 +#define PL_COLORBAR_ORIENT_LEFT 0x2000 +#define PL_COLORBAR_ORIENT_BOTTOM 0x4000 +#define PL_COLORBAR_BACKGROUND 0x8000 +#define PL_COLORBAR_BOUNDING_BOX 0x10000 // Window parameter tags @@ -474,18 +481,18 @@ const PLINT *ArrayCkNull, const PLFLT *ArrayCkNull, const PLINT *ArrayCkNull, const char **ArrayCk ); -#if 0 +#if defined (SWIG_PYTHON) || defined(SWIG_JAVA) void plcolorbar( PLFLT *OUTPUT, PLFLT *OUTPUT, - PLINT opt, PLFLT x, PLFLT y, + PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT x_length, PLFLT y_length, PLINT bg_color, PLINT bb_color, PLINT bb_style, PLFLT low_cap_color, PLFLT high_cap_color, PLINT cont_color, PLFLT cont_width, - PLINT n_labels, PLINT *label_opts, const char *label[], - PLINT n_axes, const char *axis_opts[], - PLFLT *ticks, PLINT *sub_ticks, - PLINT *n_values, const PLFLT * const *values ); + PLINT n, const PLINT *Array, const char **ArrayCk, + PLINT n, const char **Array, + const PLFLT *ArrayCk, const PLINT *ArrayCk, + const PLINT *ArrayN , const PLFLT **MatrixCk ); #endif void @@ -610,6 +617,12 @@ plscmap1n( PLINT ncol1 ); void +plscmap1_range( PLFLT min_color, PLFLT max_color ); + +void +plgcmap1_range( PLFLT *OUTPUT, PLFLT *OUTPUT ); + +void plscol0( PLINT icol0, PLINT r, PLINT g, PLINT b ); void Modified: trunk/examples/python/xw16.py =================================================================== --- trunk/examples/python/xw16.py 2013-05-22 22:41:41 UTC (rev 12346) +++ trunk/examples/python/xw16.py 2013-05-22 22:44:41 UTC (rev 12347) @@ -27,6 +27,8 @@ NX = 35 NY = 46 PERIMETERPTS = 100 +NUM_AXES = 1 +NUM_LABELS = 1 XSPA = 2./(NX-1) YSPA = 2./(NY-1) @@ -41,9 +43,23 @@ def main(): fill_width = 2. - cont_color = 2 - cont_width = 3. + cont_color = 0 + cont_width = 0. + n_axis_opts = NUM_AXES + axis_opts = zeros(NUM_AXES,"S100") + axis_opts[0] = "bcvtm" + num_values = zeros(NUM_AXES,"int"); + values = reshape(zeros(NUM_AXES*(NS+1)),[NUM_AXES,NS+1]) + axis_ticks = zeros(NUM_AXES) + axis_subticks = zeros(NUM_AXES,"int") + + n_labels = NUM_LABELS + label_opts = zeros(NUM_LABELS,"int") + labels = zeros(NUM_LABELS,"S100") + label_opts[0] = PL_COLORBAR_LABEL_BOTTOM + labels[0] = "Magnitude" + # Set up data array x = (arange(NX) - (NX/2)) / float(NX/2) @@ -86,7 +102,6 @@ plwind(-1.0, 1.0, -1.0, 1.0) plpsty(0) - # Note another alternative to produce the identical result in a different way # is to use the command: # plshades(zz, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, 1) @@ -100,6 +115,21 @@ # them from the argument list. plshades(zz, shedge, fill_width, 1, mypltr, tr) + # Smaller text + plschr(0.0, 0.75 ) + # Small ticks on the vertical axis + plsmaj( 0.0, 0.5 ) + plsmin( 0.0, 0.5 ) + + num_values[0] = NS + 1 + values[0] = shedge + (colorbar_width, colorbar_height) = plcolorbar ( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values) + + # 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, "bcnstv", 0., 0 ) plcol0(2) @@ -119,6 +149,21 @@ plshades(zz, shedge, fill_width, 1, pltr1, xg1, yg1) + # Smaller text + plschr(0.0, 0.75 ) + # Small ticks on the vertical axis + plsmaj( 0.0, 0.5 ) + plsmin( 0.0, 0.5 ) + + num_values[0] = NS + 1 + values[0] = shedge + (colorbar_width, colorbar_height) = plcolorbar ( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values) + + # 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) @@ -138,6 +183,21 @@ plshades(zz, shedge, fill_width, 0, pltr2, xg2, yg2) + # Smaller text + plschr(0.0, 0.75 ) + # Small ticks on the vertical axis + plsmaj( 0.0, 0.5 ) + plsmin( 0.0, 0.5 ) + + num_values[0] = NS + 1 + values[0] = shedge + (colorbar_width, colorbar_height) = plcolorbar ( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values) + + # 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) @@ -159,9 +219,23 @@ # Note default cont_color and cont_width are zero so that no contours # are done with other calls to plshades. But for this call we specify # non-zero values so that contours are drawn. - plshades(zz, shedge, fill_width, cont_color, cont_width,\ - 0, pltr2, xg2, yg2) + plshades(zz, shedge, fill_width, 2, 3.0, 0, pltr2, xg2, yg2) + # Smaller text + plschr(0.0, 0.75 ) + # Small ticks on the vertical axis + plsmaj( 0.0, 0.5 ) + plsmin( 0.0, 0.5 ) + + num_values[0] = NS + 1 + values[0] = shedge + (colorbar_width, colorbar_height) = plcolorbar ( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, 2, 3.0, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values) + + # 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) @@ -200,6 +274,21 @@ # point at t = 2 pi. plshades(z, shedge, fill_width, 0, pltr2, xg, yg, 2) + # Smaller text + plschr(0.0, 0.75 ) + # Small ticks on the vertical axis + plsmaj( 0.0, 0.5 ) + plsmin( 0.0, 0.5 ) + + num_values[0] = NS + 1 + values[0] = shedge + (colorbar_width, colorbar_height) = plcolorbar ( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values) + + # 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, plshades may overlap.) t = 2.*pi*arange(PERIMETERPTS)/(PERIMETERPTS-1.) px = cos(t) Modified: trunk/examples/python/xw33.py =================================================================== --- trunk/examples/python/xw33.py 2013-05-22 22:41:41 UTC (rev 12346) +++ trunk/examples/python/xw33.py 2013-05-22 22:44:41 UTC (rev 12347) @@ -57,109 +57,158 @@ "✦", ] -def plcolorbar_example_1( bar_type, ticks, sub_ticks, values, title ): - pladv( 0 ) - # Setup color palette 1 - plspal1( "cmap1_blue_red.pal", 1 ) +# Colorbar type options +COLORBAR_KINDS = 4 +colorbar_option_kinds = [ + PL_COLORBAR_SHADE, + PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, + PL_COLORBAR_IMAGE, + PL_COLORBAR_GRADIENT +] +colorbar_option_kind_labels = [ + "Shade colorbars", + "Shade colorbars with custom labels", + "Image colorbars", + "Gradient colorbars" +] - n = len(values) - color_step = 1.0 / float(n - 1) - colors = color_step*arange(n) +# Which side of the page are we positioned relative to? +COLORBAR_POSITIONS = 4 +colorbar_position_options = [ + PL_POSITION_LEFT, + PL_POSITION_RIGHT, + PL_POSITION_TOP, + PL_POSITION_BOTTOM +] +colorbar_position_option_labels = [ + "Left", + "Right", + "Top", + "Bottom" +] - opt = PL_POSITION_LEFT | bar_type | PL_COLORBAR_LABEL_LEFT | PL_COLORBAR_CAP_HIGH +# Colorbar label positioning options +COLORBAR_LABELS = 4 +colorbar_label_options = [ + PL_COLORBAR_LABEL_LEFT, + PL_COLORBAR_LABEL_RIGHT, + PL_COLORBAR_LABEL_TOP, + PL_COLORBAR_LABEL_BOTTOM +] +colorbar_label_option_labels = [ + "Label left", + "Label right", + "Label top", + "Label bottom" +] - if bar_type & PL_COLORBAR_SHADE_LABEL: - axis_opts_1 = "iv" - axis_opts_2 = "i" - else: - if sub_ticks != 0: - axis_opts_1 = "stv" - axis_opts_2 = "st" - else: - axis_opts_1 = "tv" - axis_opts_2 = "t" +# Colorbar cap options +COLORBAR_CAPS = 4 +colorbar_cap_options = [ + PL_COLORBAR_CAP_NONE, + PL_COLORBAR_CAP_LOW, + PL_COLORBAR_CAP_HIGH, + PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH +] +colorbar_cap_option_labels = [ + "No caps", + "Low cap", + "High cap", + "Low and high caps" +] - plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Left, High Cap", - colors, values ) +def plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, values ): + n_axes = 1 + axis_opts = zeros(n_axes,"S100") + ticks = zeros(n_axes) + sub_ticks = zeros(n_axes,"int") + label_opts = zeros(n_axes,"int") + label_opts[0] = PL_COLORBAR_LABEL_BOTTOM + label = zeros(n_axes,"S100") + n_values_array = zeros(n_axes,"int") + n_values_array[0] = len(values) + values_array = reshape(values,[1,len(values)]) - opt = PL_POSITION_RIGHT | bar_type | PL_COLORBAR_LABEL_RIGHT | PL_COLORBAR_CAP_LOW + low_cap_color = 0.0 + high_cap_color = 1.0 - plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Right, Low Cap", - colors, values ) + # Start a new page + pladv( 0 ) - opt = PL_POSITION_TOP | bar_type | PL_COLORBAR_LABEL_TOP | PL_COLORBAR_CAP_HIGH + # Draw one colorbar relative to each side of the page + for position_i in range(COLORBAR_POSITIONS): + position = colorbar_position_options[position_i] + opt = colorbar_option_kinds[kind_i] | colorbar_label_options[label_i] | colorbar_cap_options[cap_i] - plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Upper, High Cap", - colors, values ) + vertical = (position & PL_POSITION_LEFT) or (position & PL_POSITION_RIGHT) + ifn = position & PL_POSITION_LEFT or position & PL_POSITION_BOTTOM - opt = PL_POSITION_BOTTOM | bar_type | PL_COLORBAR_LABEL_BOTTOM | PL_COLORBAR_CAP_LOW + # Set the offset position on the page + if vertical: + x = 0.0 + y = 0.0 + x_length = 0.05 + y_length = 0.5 + else: + x = 0.0 + y = 0.0 + x_length = 0.5 + y_length = 0.05 - plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Lower, Low Cap", - colors, values ) - - plvpor( 0.0, 1.0, 0.0, 1.0 ) - plwind( 0.0, 1.0, 0.0, 1.0 ) - plptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ) - -def plcolorbar_example_2( bar_type, ticks, sub_ticks, values, title ): - pladv( 0 ) - # Setup color palette 1 - plspal1( "cmap1_blue_yellow.pal", 1 ) - - n = len(values) - color_step = 1.0 / float(n - 1) - colors = color_step*arange(n) - opt = PL_POSITION_LEFT | bar_type | PL_COLORBAR_LABEL_LEFT | PL_COLORBAR_CAP_LOW - - if bar_type == PL_COLORBAR_SHADE_LABEL: - axis_opts_1 = "" - axis_opts_2 = "" - else: - if sub_ticks != 0: - axis_opts_1 = "stv" - axis_opts_2 = "st" + # Set appropriate labelling options. + if ifn: + if ( cont_color == 0 or cont_width == 0. ): + axis_opts[0] = "uwtivn" + else: + axis_opts[0] = "uwxvn"; else: - axis_opts_1 = "tv" - axis_opts_2 = "t" + if ( cont_color == 0 or cont_width == 0. ): + axis_opts[0] = "uwtivm" + else: + axis_opts[0] = "uwxvm" - plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Left, Low Cap", - colors, values ) + label[0] = "%s, %s" % (colorbar_position_option_labels[position_i] , colorbar_label_option_labels[label_i]) - opt = PL_POSITION_RIGHT | bar_type | PL_COLORBAR_LABEL_RIGHT | PL_COLORBAR_CAP_HIGH + # Smaller text + plschr( 0.0, 0.75 ) + # Small ticks on the vertical axis + plsmaj( 0.0, 0.5 ) + plsmin( 0.0, 0.5 ) - plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Right, High Cap", - colors, values ) + plvpor( 0.20, 0.80, 0.20, 0.80 ) + plwind( 0.0, 1.0, 0.0, 1.0 ) + # Set interesting background colour. + plscol0a( 15, 0, 0, 0, 0.20 ) + (colorbar_width, colorbar_height) = plcolorbar( \ + opt | PL_COLORBAR_BOUNDING_BOX | PL_COLORBAR_BACKGROUND, position, \ + x, y, x_length, y_length, \ + 15, 1, 1, \ + low_cap_color, high_cap_color, \ + cont_color, cont_width, \ + label_opts, label, \ + axis_opts, ticks, sub_ticks, \ + n_values_array, values_array ) - opt = PL_POSITION_TOP | bar_type | PL_COLORBAR_LABEL_TOP | PL_COLORBAR_CAP_LOW + # Reset text and tick sizes + plschr( 0.0, 1.0 ) + plsmaj( 0.0, 1.0 ) + plsmin( 0.0, 1.0 ) - plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Upper, Low Cap", - colors, values ) - - opt = PL_POSITION_BOTTOM | bar_type | PL_COLORBAR_LABEL_BOTTOM | PL_COLORBAR_CAP_HIGH - - plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Lower, High Cap", - colors, values ) - + # Draw a page title + title = "%s - %s" % (colorbar_option_kind_labels[kind_i] , colorbar_cap_option_labels[cap_i]) plvpor( 0.0, 1.0, 0.0, 1.0 ) plwind( 0.0, 1.0, 0.0, 1.0 ) plptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ) +def plcolorbar_example( palette, kind_i, cont_color, cont_width, values ): + # Load the color palette + plspal1( palette, 1 ) + + for label_i in arange(COLORBAR_LABELS): + for cap_i in arange(COLORBAR_CAPS): + plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, values ) + + def main(): # First page illustrating the 16 standard positions. pladv(0) @@ -699,15 +748,24 @@ symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max(max_height, legend_height) - if False: - # Color bar examples - values_small = [ 0.0, 1.0 ] - values_uneven = [ 0.0, 2.0, 2.6, 3.4, 6.0, 7.0, 8.0, 9.0, 10.0 ] - values_even = [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] - plcolorbar_example_1( PL_COLORBAR_IMAGE, 0.0, 0, values_small, "Image Color Bars" ) - plcolorbar_example_2( PL_COLORBAR_IMAGE, 0.0, 0, values_small, "Image Color Bars" ) - plcolorbar_example_1( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0.0, 0, values_uneven, "Shade Color Bars - Uneven Steps" ) - plcolorbar_example_2( PL_COLORBAR_SHADE, 3.0, 3, values_even, "Shade Color Bars - Even Steps" ) - plcolorbar_example_1( PL_COLORBAR_GRADIENT, 0.5, 5, values_small, "Gradient Color Bars" ) - plcolorbar_example_2( PL_COLORBAR_GRADIENT, 0.5, 5, values_small, "Gradient Color Bars" ) + # Color bar examples + values_small = [ -1.0e-200, 1.0e-200 ] + values_uneven = [ -1.0e-200, 2.0e-200, 2.6e-200, 3.4e-200, 6.0e-200, 7.0e-200, 8.0e-200, 9.0e-200, 10.0e-200 ] + values_even = [ -2.0e-200, -1.0e-200, 0.0e-200, 1.0e-200, 2.0e-200, 3.0e-200, 4.0e-200, 5.0e-200, 6.0e-200 ] + + # Use unsaturated green background colour to contrast with black caps. + plscolbg( 70, 185, 70 ) + # Cut out the greatest and smallest bits of the color spectrum to + # leave colors for the end caps. + plscmap1_range( 0.01, 0.99 ) + + # We can only test image and gradient colorbars with two element arrays + for i in arange(COLORBAR_KINDS-2)+2: + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_small ) + # Test shade colorbars with larger arrays + for i in arange(2): + plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, values_even ) + for i in arange(2): + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_uneven ) + main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |