From: <ai...@us...> - 2011-04-28 22:46:56
|
Revision: 11727 http://plplot.svn.sourceforge.net/plplot/?rev=11727&view=rev Author: airwin Date: 2011-04-28 22:46:49 +0000 (Thu, 28 Apr 2011) Log Message: ----------- Replace width, length arguments of plcolorbar with orientation-independent x_length and y_length. Modified Paths: -------------- trunk/examples/c/x16c.c trunk/examples/c/x33c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x16c.c =================================================================== --- trunk/examples/c/x16c.c 2011-04-28 13:53:02 UTC (rev 11726) +++ trunk/examples/c/x16c.c 2011-04-28 22:46:49 UTC (rev 11727) @@ -242,7 +242,7 @@ plsmin( 0.0, 0.5 ); plcolorbar( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, PL_POSITION_RIGHT, - 0.05, 0.15, 0.7, 0.03, 0.0, 0.0, + 0.05, 0.15, 0.03, 0.7, 0.0, 0.0, cont_color, cont_width, 0.0, 0, "bv", "", ns + 1, shedge ); @@ -288,7 +288,7 @@ plsmin( 0.0, 0.5 ); plcolorbar( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, PL_POSITION_RIGHT, - 0.05, 0.15, 0.7, 0.03, 0.0, 0.0, + 0.05, 0.15, 0.03, 0.7, 0.0, 0.0, cont_color, cont_width, 0.0, 0, "bv", "", ns + 1, shedge ); @@ -334,7 +334,7 @@ plsmin( 0.0, 0.5 ); plcolorbar( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, PL_POSITION_RIGHT, - 0.05, 0.15, 0.7, 0.03, 0.0, 0.0, + 0.05, 0.15, 0.03, 0.7, 0.0, 0.0, cont_color, cont_width, 0.0, 0, "bv", "", ns + 1, shedge ); @@ -379,7 +379,7 @@ plsmin( 0.0, 0.5 ); plcolorbar( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, PL_POSITION_RIGHT, - 0.05, 0.15, 0.7, 0.03, 0.0, 0.0, + 0.05, 0.15, 0.03, 0.7, 0.0, 0.0, 2, 3, 0.0, 0, "bv", "", ns + 1, shedge ); @@ -475,7 +475,7 @@ plsmin( 0.0, 0.5 ); plcolorbar( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, PL_POSITION_RIGHT, - 0.06, 0.15, 0.7, 0.03, 0.0, 0.0, + 0.06, 0.15, 0.03, 0.7, 0.0, 0.0, cont_color, cont_width, 0.0, 0, "bv", "", ns + 1, shedge ); Modified: trunk/examples/c/x33c.c =================================================================== --- trunk/examples/c/x33c.c 2011-04-28 13:53:02 UTC (rev 11726) +++ trunk/examples/c/x33c.c 2011-04-28 22:46:49 UTC (rev 11727) @@ -152,7 +152,7 @@ { // Parameters for the colorbars on this page PLINT position_i, position, opt; - PLFLT x, y, length, width; + PLFLT x, y, x_length, y_length; PLFLT ticks; PLINT sub_ticks; PLFLT low_cap_color, high_cap_color; @@ -161,9 +161,6 @@ char label[200]; char title[200]; - length = 0.5; - width = 0.05; - ticks = 0.0; sub_ticks = 0; @@ -189,11 +186,16 @@ { x = 0.1; y = 0.25; + x_length = 0.05; + y_length = 0.5; + } else { x = 0.25; y = 0.1; + x_length = 0.5; + y_length = 0.05; } // Set appropriate labeling options @@ -233,7 +235,7 @@ plsmin( 0.0, 0.5 ); plcolorbar( opt, position, - x, y, length, width, + x, y, x_length, y_length, low_cap_color, high_cap_color, cont_color, cont_width, ticks, sub_ticks, Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2011-04-28 13:53:02 UTC (rev 11726) +++ trunk/include/plplot.h 2011-04-28 22:46:49 UTC (rev 11727) @@ -1278,7 +1278,7 @@ // Routine for drawing continous colour legends PLDLLIMPEXP void c_plcolorbar( PLINT position, PLINT opt, - PLFLT x, PLFLT y, PLFLT length, PLFLT width, + PLFLT x, PLFLT y, PLFLT x_length, PLFLT y_length, PLFLT low_cap_color, PLFLT high_cap_color, PLINT cont_color, PLINT cont_width, PLFLT ticks, PLINT sub_ticks, Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2011-04-28 13:53:02 UTC (rev 11726) +++ trunk/src/pllegend.c 2011-04-28 22:46:49 UTC (rev 11727) @@ -980,19 +980,25 @@ //-------------------------------------------------------------------------- //! Plot color bar for image, shade or gradient plots. //! -//! @param opt This variable contains bits which control the overall colorbar. -//! The type of colorbar can be specified with PL_COLORBAR_SHADE, -//! PL_COLORBAR_IMAGE or PL_COLORBAR_GRADIENT. The position of the (optional) -//! label/title can be specified with -//! PL_COLORBAR_LABEL_(LEFT|RIGHT|TOP|BOTTOM). If no label position is -//! specified then no label will be drawn. End-caps for the colorbar can -//! added with PL_COLORBAR_CAP_LOW and PL_COLORBAR_CAP_HIGH. If a particular -//! colorbar cap option is not specified then no cap will be drawn for that -//! end. As a special case for PL_COLORBAR_SHADE, the option -//! PL_COLORBAR_SHADE_LABEL can be specified. If this option is provided then -//! any tick marks and tick labels will be placed at the breaks between shaded -//! segments. TODO: This should be expanded to support custom placement of -//! tick marks and tick labels at custom value locations for any colorbar type. +//! @param opt This variable contains bits which control the overall +//! colorbar. The orientation (direction of the maximum value) of the +//! colorbar is specified with PL_COLORBAR_ORIENT_(RIGHT, TOP, LEFT, +//! BOTTOM). If none of those bits are specified, the default orientation +//! is toward the top, i.e., a vertical colorbar. The type of +//! colorbar can be specified with PL_COLORBAR_SHADE, +//! PL_COLORBAR_IMAGE or PL_COLORBAR_GRADIENT. The position of the +//! (optional) label/title can be specified with +//! PL_COLORBAR_LABEL_(LEFT|RIGHT|TOP|BOTTOM). If no label position +//! is specified then no label will be drawn. End-caps for the +//! colorbar can added with PL_COLORBAR_CAP_LOW and +//! PL_COLORBAR_CAP_HIGH. If a particular colorbar cap option is not +//! specified then no cap will be drawn for that end. As a special +//! case for PL_COLORBAR_SHADE, the option PL_COLORBAR_SHADE_LABEL can +//! be specified. If this option is provided then any tick marks and +//! tick labels will be placed at the breaks between shaded segments. +//! TODO: This should be expanded to support custom placement of tick +//! marks and tick labels at custom value locations for any colorbar +//! type. //! @param position This variable defines the placement of the colorbar on the //! subpage. The position can be one of PL_POSITION_TOP, //! PL_POSITION_BOTTOM, PL_POSITION_LEFT or PL_POSITION_RIGHT. The colorbar @@ -1001,12 +1007,10 @@ //! in normalized subpage coordinates. //! @param y Colorbar displacement distance along/away from the vertical axis //! in normalized subpage coordinates. -//! @param length Length of the colorbar along its major axis (ex. along the -//! top of the subpage if pos is PL_POSITION_TOP) in normalized subpage -//! coordinates. -//! @param width Width of the colorbar along the minor axis (ex. fraction of -//! the vertical subpage size if pos is PL_POSITION_TOP) in normalized subpage -//! coordinates. +//! @param x_length Length of the colorbar in the X direction in +//! adopted coordinates. +//! @param y_length Length of the colorbar in the Y direction in +//! adopted coordinates. //! @param low_cap_color Color of the low-end color bar cap, if it is drawn. //! @param high_cap_color Color of the high-end color bar cap, if it is drawn. //! @param cont_color Contour color for PL_COLORBAR_SHADE plots. This is @@ -1036,7 +1040,7 @@ void c_plcolorbar( PLINT opt, PLINT position, - PLFLT x, PLFLT y, PLFLT length, PLFLT width, + PLFLT x, PLFLT y, PLFLT x_length, PLFLT y_length, PLFLT low_cap_color, PLFLT high_cap_color, PLINT cont_color, PLINT cont_width, PLFLT ticks, PLINT sub_ticks, @@ -1082,8 +1086,8 @@ { vx_min = x; vy_min = y; - vx_max = vx_min + width; - vy_max = vy_min + length; + vx_max = vx_min + x_length; + vy_max = vy_min + y_length; wx_min = 0.0; wy_min = min_value; wx_max = 1.0; @@ -1091,10 +1095,10 @@ } else if ( position & PL_POSITION_RIGHT ) { - vx_min = 1.0 - x - width; + vx_min = 1.0 - x - x_length; vy_min = y; - vx_max = vx_min + width; - vy_max = vy_min + length; + vx_max = vx_min + x_length; + vy_max = vy_min + y_length; wx_min = 0.0; wy_min = min_value; wx_max = 1.0; @@ -1103,9 +1107,9 @@ else if ( position & PL_POSITION_TOP ) { vx_min = x; - vy_min = 1.0 - y - width; - vx_max = vx_min + length; - vy_max = vy_min + width; + vy_min = 1.0 - y - y_length; + vx_max = vx_min + x_length; + vy_max = vy_min + y_length; wx_min = min_value; wy_min = 0.0; wx_max = max_value; @@ -1115,8 +1119,8 @@ { vx_min = x; vy_min = y; - vx_max = vx_min + length; - vy_max = vy_min + width; + vx_max = vx_min + x_length; + vy_max = vy_min + y_length; wx_min = min_value; wy_min = 0.0; wx_max = max_value; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |