From: <hez...@us...> - 2011-01-29 17:09:05
|
Revision: 11520 http://plplot.svn.sourceforge.net/plplot/?rev=11520&view=rev Author: hezekiahcarty Date: 2011-01-29 17:08:58 +0000 (Sat, 29 Jan 2011) Log Message: ----------- Add support for contours in plcolorbar for shaded colorbars Includes a small update to C example 33. Modified Paths: -------------- trunk/examples/c/x33c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x33c.c =================================================================== --- trunk/examples/c/x33c.c 2011-01-28 20:20:13 UTC (rev 11519) +++ trunk/examples/c/x33c.c 2011-01-29 17:08:58 UTC (rev 11520) @@ -61,7 +61,7 @@ }; void -plcolorbar_example_1( PLINT bar_type, PLFLT ticks, PLINT sub_ticks, PLINT n, PLFLT *values, const char *title ) +plcolorbar_example_1( PLINT bar_type, PLINT cont_color, PLINT cont_width, PLFLT ticks, PLINT sub_ticks, PLINT n, PLFLT *values, const char *title ) { pladv( 0 ); // Setup color palette 1 @@ -101,6 +101,7 @@ } plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, + cont_color, cont_width, ticks, sub_ticks, axis_opts_1, "Test label - Left, High Cap", n, colors, values ); @@ -109,6 +110,7 @@ PL_COLORBAR_CAP_LOW; plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, + cont_color, cont_width, ticks, sub_ticks, axis_opts_1, "Test label - Right, Low Cap", n, colors, values ); @@ -117,6 +119,7 @@ PL_COLORBAR_CAP_HIGH; plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, + cont_color, cont_width, ticks, sub_ticks, axis_opts_2, "Test label - Upper, High Cap", n, colors, values ); @@ -125,6 +128,7 @@ PL_COLORBAR_CAP_LOW; plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, + cont_color, cont_width, ticks, sub_ticks, axis_opts_2, "Test label - Lower, Low Cap", n, colors, values ); @@ -135,7 +139,7 @@ } void -plcolorbar_example_2( PLINT bar_type, PLFLT ticks, PLFLT sub_ticks, PLINT n, PLFLT *values, const char *title ) +plcolorbar_example_2( PLINT bar_type, PLINT cont_color, PLINT cont_width, PLFLT ticks, PLFLT sub_ticks, PLINT n, PLFLT *values, const char *title ) { pladv( 0 ); // Setup color palette 1 @@ -175,6 +179,7 @@ } plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, + cont_color, cont_width, ticks, sub_ticks, axis_opts_1, "Test label - Left, Low Cap", n, colors, values ); @@ -183,6 +188,7 @@ PL_COLORBAR_CAP_HIGH; plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, + cont_color, cont_width, ticks, sub_ticks, axis_opts_1, "Test label - Right, High Cap", n, colors, values ); @@ -191,6 +197,7 @@ PL_COLORBAR_CAP_LOW; plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, + cont_color, cont_width, ticks, sub_ticks, axis_opts_2, "Test label - Upper, Low Cap", n, colors, values ); @@ -199,6 +206,7 @@ PL_COLORBAR_CAP_HIGH; plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, + cont_color, cont_width, ticks, sub_ticks, axis_opts_2, "Test label - Lower, High Cap", n, colors, values ); @@ -765,15 +773,19 @@ PLFLT values_small[2] = { 0.0, 1.0 }; PLFLT values_uneven[9] = { 0.0, 2.0, 2.6, 3.4, 6.0, 7.0, 8.0, 9.0, 10.0 }; PLFLT values_even[9] = { 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, 2, values_small, "Image Color Bars" ); - plcolorbar_example_2( PL_COLORBAR_IMAGE, 0.0, 0, 2, values_small, "Image Color Bars" ); - plcolorbar_example_1( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0.0, 0, 9, values_uneven, + plcolorbar_example_1( PL_COLORBAR_IMAGE, 0, 0, 0.0, 0, 2, values_small, "Image Color Bars" ); + plcolorbar_example_2( PL_COLORBAR_IMAGE, 0, 0, 0.0, 0, 2, values_small, "Image Color Bars" ); + plcolorbar_example_1( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0, 0.0, 0, 9, values_uneven, "Shade Color Bars - Uneven Steps" ); - plcolorbar_example_2( PL_COLORBAR_SHADE, 3.0, 3, 9, values_even, + plcolorbar_example_2( PL_COLORBAR_SHADE, 0, 0, 3.0, 3, 9, values_even, "Shade Color Bars - Even Steps" ); - plcolorbar_example_1( PL_COLORBAR_GRADIENT, 0.5, 5, 2, values_small, + plcolorbar_example_1( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 2, 1, 0.0, 0, 9, values_uneven, + "Shade Color Bars - Uneven Steps, Contours" ); + plcolorbar_example_2( PL_COLORBAR_SHADE, 2, 3, 3.0, 3, 9, values_even, + "Shade Color Bars - Even Steps, Contours" ); + plcolorbar_example_1( PL_COLORBAR_GRADIENT, 0, 0, 0.5, 5, 2, values_small, "Gradient Color Bars" ); - plcolorbar_example_2( PL_COLORBAR_GRADIENT, 0.5, 5, 2, values_small, + plcolorbar_example_2( PL_COLORBAR_GRADIENT, 0, 0, 0.5, 5, 2, values_small, "Gradient Color Bars" ); // Free space that contained legend text. Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2011-01-28 20:20:13 UTC (rev 11519) +++ trunk/include/plplot.h 2011-01-29 17:08:58 UTC (rev 11520) @@ -1265,6 +1265,7 @@ // Routine for drawing continous colour legends PLDLLIMPEXP void c_plcolorbar( PLINT opt, PLFLT x, PLFLT y, PLFLT length, PLFLT width, + PLINT cont_color, PLINT cont_width, PLFLT ticks, PLINT sub_ticks, const char *axis_opts, const char *label, PLINT n_colors, PLFLT *colors, PLFLT *values ); Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2011-01-28 20:20:13 UTC (rev 11519) +++ trunk/src/pllegend.c 2011-01-29 17:08:58 UTC (rev 11520) @@ -908,6 +908,7 @@ void c_plcolorbar( PLINT opt, PLFLT x, PLFLT y, PLFLT length, PLFLT width, + PLINT cont_color, PLINT cont_width, PLFLT ticks, PLINT sub_ticks, const char *axis_opts, const char *label, PLINT n_colors, PLFLT *colors, PLFLT *values ) @@ -1130,7 +1131,7 @@ // Draw the color bar plshades( color_data, ni, nj, NULL, wx_min, wx_max, wy_min, wy_max, - values, n_colors, 0, 0, 0, plfill, TRUE, + values, n_colors, 0, cont_color, cont_width, plfill, TRUE, pltr1, (void *) ( &grid ) ); plFree2dGrid( color_data, ni, nj ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |