From: <hez...@us...> - 2011-02-19 18:28:34
|
Revision: 11571 http://plplot.svn.sourceforge.net/plplot/?rev=11571&view=rev Author: hezekiahcarty Date: 2011-02-19 18:28:28 +0000 (Sat, 19 Feb 2011) Log Message: ----------- Add some more detail to the code comments in plcolorbar Modified Paths: -------------- trunk/src/pllegend.c Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2011-02-19 18:28:00 UTC (rev 11570) +++ trunk/src/pllegend.c 2011-02-19 18:28:28 UTC (rev 11571) @@ -1046,7 +1046,8 @@ //! should be fixed with new, more flexible implementations of plimage, //! plimagefr, plshades and plgradient which use user-provided minimum and //! maximum colors for their range instead of keeping the minimum color fixed -//! as 0.0 and the maximum fixed as 1.0. +//! as 0.0 and the maximum fixed as 1.0. The net effect of this is that the +//! values in colors do not have the effect they should at this time. //! @param values Numeric values for the data range represented by the //! colorbar. For PL_COLORBAR_SHADE, this should include one value per break //! between segments. For PL_COLORBAR_IMAGE and PL_COLORBAR_GRADIENT this @@ -1087,7 +1088,8 @@ // coordinates). PLFLT vx_min, vx_max, vy_min, vy_max; PLFLT wx_min, wx_max, wy_min, wy_max; - // Build the proper viewport and window dimensions + // Build the proper viewport and window dimension along the requested side + // of the subpage if ( position & PL_POSITION_LEFT ) { vx_min = x; @@ -1137,7 +1139,7 @@ plabort( "plcolorbar: Invalid or missing side" ); } - // The window should take up the whole viewport + // The window used to draw the colorbar should take up the whole viewport plvpor( vx_min, vx_max, vy_min, vy_max ); plwind( wx_min, wx_max, wy_min, wy_max ); @@ -1235,6 +1237,10 @@ else if ( opt & PL_COLORBAR_SHADE ) { // Transform grid + // The transform grid is used to make the size of the shaded segments + // scale relative to other segments. For example, if segment A + // makes up 10% of the scale and segment B makes up 20% of the scale + // then segment B will be twice the length of segment A. PLcGrid grid; PLFLT grid_axis[2] = { 0.0, 1.0 }; n_steps = n_colors; @@ -1296,12 +1302,15 @@ xs[3] = wx_min; ys[3] = wy_max; PLFLT angle; + // Make sure the gradient runs in the proper direction if ( position & PL_POSITION_LEFT || position & PL_POSITION_RIGHT ) { + // Top to bottom angle = 90.0; } else if ( position & PL_POSITION_TOP || position & PL_POSITION_BOTTOM ) { + // Left to right angle = 0.0; } else @@ -1322,7 +1331,7 @@ if ( opt & PL_COLORBAR_CAP_LOW ) { // Add an extra offset for the label so it does not bump in to the - // cap. + // cap if the label is placed on the same side as the cap. if ( ( ( position & PL_POSITION_LEFT || position & PL_POSITION_RIGHT ) && opt & PL_COLORBAR_LABEL_BOTTOM ) || ( ( position & PL_POSITION_TOP || position & PL_POSITION_BOTTOM ) && @@ -1336,7 +1345,7 @@ else if ( opt & PL_COLORBAR_CAP_HIGH ) { // Add an extra offset for the label so it does not bump in to the - // cap. + // cap if the label is placed on the same side as the cap. if ( ( ( position & PL_POSITION_LEFT || position & PL_POSITION_RIGHT ) && opt & PL_COLORBAR_LABEL_TOP ) || ( ( position & PL_POSITION_TOP || position & PL_POSITION_BOTTOM ) && @@ -1463,7 +1472,7 @@ } } - // Draw the boxes, etc. + // Draw the outline for the entire colorbar, tick marks, tick labels. if ( position & PL_POSITION_LEFT ) { snprintf( opt_string, max_opts, "bc%s%s", tick_string, axis_opts ); @@ -1485,7 +1494,7 @@ plbox( opt_string, ticks, sub_ticks, "bc", 0.0, 0 ); } - // Restore + // Restore previous plot characteristics. plcol0( col0_save ); plvpor( xdmin_save, xdmax_save, ydmin_save, ydmax_save ); plwind( xwmin_save, xwmax_save, ywmin_save, ywmax_save ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |