From: <hez...@us...> - 2011-01-01 00:32:00
|
Revision: 11410 http://plplot.svn.sourceforge.net/plplot/?rev=11410&view=rev Author: hezekiahcarty Date: 2011-01-01 00:31:53 +0000 (Sat, 01 Jan 2011) Log Message: ----------- Move plbox drawing to make plcolorbar a bit prettier Also, tick marks and labels are no longer included by default. They must be requested in the plcolorbar call. Modified Paths: -------------- trunk/src/pllegend.c Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2011-01-01 00:26:35 UTC (rev 11409) +++ trunk/src/pllegend.c 2011-01-01 00:31:53 UTC (rev 11410) @@ -1161,38 +1161,6 @@ // Restore the previous drawing color to use for outlines and text plcol0( col0_save ); - // Smaller text - plschr( 0.0, 0.75 ); - // Small ticks on the vertical axis - plsmaj( 0.0, 0.5); - plsmin( 0.0, 0.5); - - // For building axis option string - PLINT max_opts = 25; - char opt_string[max_opts]; - - // Draw the boxes, ticks and tick labels - if ( opt & PL_COLORBAR_LEFT ) - { - snprintf( opt_string, max_opts, "bcn%s", axis_opts ); - plbox( "bc", 0.0, 0, opt_string, 0.0, 0 ); - } - else if ( opt & PL_COLORBAR_RIGHT ) - { - snprintf( opt_string, max_opts, "bcm%s", axis_opts ); - plbox( "bc", 0.0, 0, opt_string, 0.0, 0 ); - } - else if ( opt & PL_COLORBAR_UPPER ) - { - snprintf( opt_string, max_opts, "bcm%s", axis_opts ); - plbox( opt_string, 0.0, 0, "bc", 0.0, 0 ); - } - else if ( opt & PL_COLORBAR_LOWER ) - { - snprintf( opt_string, max_opts, "bcn%s", axis_opts ); - plbox( opt_string, 0.0, 0, "bc", 0.0, 0 ); - } - // How far away from the axis should the label be drawn? PLFLT label_offset; label_offset = 0.0; @@ -1227,6 +1195,40 @@ draw_cap( opt, x, y, length, width, 1.0 ); } + // Smaller text + plschr( 0.0, 0.75 ); + // Small ticks on the vertical axis + plsmaj( 0.0, 0.5); + plsmin( 0.0, 0.5); + + // For building axis option string + PLINT max_opts = 25; + char opt_string[max_opts]; + + // Draw the boxes, etc. + if ( opt & PL_COLORBAR_LEFT ) + { + snprintf( opt_string, max_opts, "bc%s", axis_opts ); + plbox( "bc", 0.0, 0, opt_string, 0.0, 0 ); + } + else if ( opt & PL_COLORBAR_RIGHT ) + { + snprintf( opt_string, max_opts, "bc%s", axis_opts ); + plbox( "bc", 0.0, 0, opt_string, 0.0, 0 ); + } + else if ( opt & PL_COLORBAR_UPPER ) + { + snprintf( opt_string, max_opts, "bc%s", axis_opts ); + plbox( opt_string, 0.0, 0, "bc", 0.0, 0 ); + } + else if ( opt & PL_COLORBAR_LOWER ) + { + snprintf( opt_string, max_opts, "bc%s", axis_opts ); + plbox( opt_string, 0.0, 0, "bc", 0.0, 0 ); + } + + // TODO: Add tick mark drawing and labeling here when n_colors > 2 + // Draw a title char perp; if ( opt & PL_COLORBAR_LABEL_LEFT ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |