From: <ai...@us...> - 2013-01-30 08:25:56
|
Revision: 12290 http://plplot.svn.sourceforge.net/plplot/?rev=12290&view=rev Author: airwin Date: 2013-01-30 08:25:49 +0000 (Wed, 30 Jan 2013) Log Message: ----------- Implement plwid in pldeprecated.c. This gives backwards compatibility (at least for one release cycle) for plwid calls from users, but only if they specify -DPL_DEPRECATED=ON. Modified Paths: -------------- trunk/include/plplot.h trunk/src/pldeprecated.c Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2013-01-30 08:05:39 UTC (rev 12289) +++ trunk/include/plplot.h 2013-01-30 08:25:49 UTC (rev 12290) @@ -1974,6 +1974,11 @@ PLFLT xmax0, PLFLT ymin0, PLFLT ymax0, PLFLT zmin0, PLFLT zmax0, PLFLT alt, PLFLT az ); +// Set pen width with deprecated integer width + +PLDLLIMPEXP void +c_plwid( PLINT width ); + // Set pen width. PLDLLIMPEXP void Modified: trunk/src/pldeprecated.c =================================================================== --- trunk/src/pldeprecated.c 2013-01-30 08:05:39 UTC (rev 12289) +++ trunk/src/pldeprecated.c 2013-01-30 08:25:49 UTC (rev 12290) @@ -121,5 +121,18 @@ plrgb( r, g, b ); } +//-------------------------------------------------------------------------- +// void plwid() +// +// Set pen width using a deprecated integer width value rather than +// the recommended plwidth call with floating-point width value. +//-------------------------------------------------------------------------- +void +c_plwid( PLINT width ) +{ + plwarn( "plwid: function deprecated. Use plwidth instead" ); + plwidth( (PLFLT) width ); +} + #endif // PL_DEPRECATED This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2013-03-15 03:14:47
|
Revision: 12298 http://plplot.svn.sourceforge.net/plplot/?rev=12298&view=rev Author: hezekiahcarty Date: 2013-03-15 03:14:39 +0000 (Fri, 15 Mar 2013) Log Message: ----------- Bring OCaml bindings mostly up to date Example 16 still needs to be updated to match it's C counterpart. Modified Paths: -------------- trunk/bindings/ocaml/plplot.ml trunk/bindings/ocaml/plplot.mli trunk/bindings/ocaml/plplot_core.idl trunk/bindings/ocaml/plplot_h trunk/bindings/ocaml/plplot_h.inc trunk/bindings/ocaml/plplot_impl.c trunk/bindings/ocaml/touchup.ml trunk/examples/ocaml/x01.ml trunk/examples/ocaml/x02.ml trunk/examples/ocaml/xplot01.ml Modified: trunk/bindings/ocaml/plplot.ml =================================================================== --- trunk/bindings/ocaml/plplot.ml 2013-03-14 20:45:30 UTC (rev 12297) +++ trunk/bindings/ocaml/plplot.ml 2013-03-15 03:14:39 UTC (rev 12298) @@ -173,15 +173,15 @@ | Arc of (color_t * float * float * float * float * float * float * float * bool) | Axes of - (color_t * axis_options_t list * axis_options_t list * int * + (color_t * axis_options_t list * axis_options_t list * float * line_style_t * (plplot_axis_type -> float -> string) option) | Contours of (color_t * pltr_t * float array * float array array) | Image of image_t | Image_fr of (image_t * (float * float)) - | Join of (color_t * float * float * float * float * int * line_style_t) + | Join of (color_t * float * float * float * float * float * line_style_t) | Labels of (color_t * string * string * string) | Lines of - (string option * color_t * float array * float array * int * line_style_t) + (string option * color_t * float array * float array * float * line_style_t) | Map of (color_t * map_t * float * float * float * float) | Points of (string option * color_t * float array * float array * string * float) @@ -497,7 +497,7 @@ Arc (color, x, y, a, b, angle1, angle2, rotation, fill) (** [axes ?color ?style ?width xopt yopt] *) - let axes ?(color = Black) ?(style = Solid_line) ?(width = 1) ?labelfunc xopt yopt = + let axes ?(color = Black) ?(style = Solid_line) ?(width = 1.0) ?labelfunc xopt yopt = Axes (color, xopt, yopt, width, style, labelfunc) (** Default axes *) @@ -519,7 +519,7 @@ (** [join color (x0, y0) (x1, y1)] *) let join ?style ?width color (x0, y0) (x1, y1) = - Join (color, x0, y0, x1, y1, width |? 1, style |? Solid_line) + Join (color, x0, y0, x1, y1, width |? 1.0, style |? Solid_line) (** [label x y title] labels the axes and adds plot title *) let label ?(color = Black) x y title = @@ -527,7 +527,7 @@ (** [lines ?label color xs ys] *) let lines ?label ?style ?width color xs ys = - Lines (label, color, xs, ys, width |? 1, style |? Solid_line) + Lines (label, color, xs, ys, width |? 1.0, style |? Solid_line) (** [map ?sw ?ne color outline] *) let map ?sw ?ne color outline = @@ -840,18 +840,29 @@ ) ) + type colorbar_axis_t = { + axis_def : axis_options_t list; + axis_values : float array; + } + type colorbar_kind_t = - | Gradient_colorbar of float array - | Image_colorbar of float array - | Shade_colorbar of (bool * float array) + | Gradient_colorbar of colorbar_axis_t + | Image_colorbar of colorbar_axis_t + | Shade_colorbar of (bool * colorbar_axis_t) - let gradient_colorbar vs = Gradient_colorbar vs - let image_colorbar vs = Image_colorbar vs - let shade_colorbar ?(custom = true) vs = Shade_colorbar (custom, vs) - let default_colorbar_axis = [Frame0; Frame1; Invert_ticks; Unconventional_label; Major_ticks; Vertical_label] + let colorbar_axis ?(axis = default_colorbar_axis) vs = + { axis_def = axis; axis_values = vs } + + let gradient_colorbar ?axis vs = + Gradient_colorbar (colorbar_axis ?axis vs) + let image_colorbar ?axis vs = + Image_colorbar (colorbar_axis ?axis vs) + let shade_colorbar ?(custom = true) ?axis vs = + Shade_colorbar (custom, colorbar_axis ?axis vs) + let colorbar ?pos ?bg ?bb ?cap ?contour ?orient ?axis ?label ?color ?scale kind = (* Colorbar position *) let colorbar_x, colorbar_y, pos_opt = convert_position pos in @@ -904,39 +915,76 @@ (* Default to vertical *) default_width, default_length, [] in - (* Axis *) - let axis = axis |? default_colorbar_axis in - let axis_string, tick_spacing, sub_ticks = - string_ticks_of_axis_options axis + (* Extra axis definitions *) + let extra_axes = axis |? [] in + (* Labels *) + let labels, label_opts = + let result = + match label with + | Some l -> begin + List.map ( + fun p -> + match p with + | Right l -> l, [PL_COLORBAR_LABEL_RIGHT] + | Left l -> l, [PL_COLORBAR_LABEL_LEFT] + | Top l -> l, [PL_COLORBAR_LABEL_TOP] + | Bottom l -> l, [PL_COLORBAR_LABEL_BOTTOM] + ) l + end + | None -> ["", []] + in + List.split result in - (* Label *) - let label, label_opt = - match label with - | Some p -> begin - match p with - | Right l -> l, [PL_COLORBAR_LABEL_RIGHT] - | Left l -> l, [PL_COLORBAR_LABEL_LEFT] - | Top l -> l, [PL_COLORBAR_LABEL_TOP] - | Bottom l -> l, [PL_COLORBAR_LABEL_BOTTOM] - end - | None -> "", [] - in + let labels = Array.of_list labels in + let label_opts = Array.of_list label_opts in (* Color for labels, axes, etc. *) let color = color |? Black in (* Values and colorbar type *) - let values, kind_opt = + let { axis_def = main_axis; axis_values = values}, kind_opt = match kind with - | Gradient_colorbar vs -> vs, [PL_COLORBAR_GRADIENT] - | Image_colorbar vs -> vs, [PL_COLORBAR_IMAGE] - | Shade_colorbar (custom, vs) -> - vs, ( + | Gradient_colorbar a -> a, [PL_COLORBAR_GRADIENT] + | Image_colorbar a -> a, [PL_COLORBAR_IMAGE] + | Shade_colorbar (custom, a) -> + a, ( PL_COLORBAR_SHADE :: if custom then [PL_COLORBAR_SHADE_LABEL] else [] ) in + let main_axis_string, tick_spacing, sub_ticks = + string_ticks_of_axis_options main_axis + in + let extra_axis_strings, extra_axis_tick_spacing, extra_axis_sub_ticks, extra_values = + let axes = + Array.of_list ( + List.map ( + fun { axis_def; axis_values } -> + let str, tick_spacing, sub_ticks = + string_ticks_of_axis_options axis_def + in + str, tick_spacing, sub_ticks, axis_values + ) extra_axes + ) + in + Array.to_list (Array.map (fun (x, _, _, _) -> x) axes), + Array.to_list (Array.map (fun (_, x, _, _) -> x) axes), + Array.to_list (Array.map (fun (_, _, x, _) -> x) axes), + Array.to_list (Array.map (fun (_, _, _, x) -> x) axes) + in + let axis_strings = + Array.of_list (main_axis_string :: extra_axis_strings) + in + let tick_spacing = + Array.of_list (tick_spacing :: extra_axis_tick_spacing) + in + let sub_ticks = + Array.of_list (sub_ticks :: extra_axis_sub_ticks) + in + let values = + Array.of_list (values :: extra_values) + in (* Combine all of the options *) let opt = - List.concat [bg_opt; bb_opt; cap_opt; orient_opt; label_opt; kind_opt] + List.concat [bg_opt; bb_opt; cap_opt; orient_opt; kind_opt] in (* Call the (wrapped) core plcolorbar function *) custom ( @@ -949,11 +997,11 @@ bg bb bb_style cap_low_color cap_high_color cont_color cont_width - tick_spacing sub_ticks axis_string - label values + label_opts labels + axis_strings tick_spacing sub_ticks values ) ); - Option.may (fun _ -> plsmaj 0.0 0.0; plsmin 0.0 0.0; plschr 0.0 0.0) scale; + Option.may (fun _ -> plsmaj 0.0 1.0; plsmin 0.0 1.0; plschr 0.0 1.0) scale; ) (** An easier to deduce alternative to {Plplot.plbox} *) @@ -1041,9 +1089,9 @@ let plot_points (label, color, xs, ys, symbol, scale) = set_color_in color ( fun () -> - plssym 0.0 scale; + plschr 0.0 scale; plstring xs ys symbol; - plssym 0.0 1.0; + plschr 0.0 1.0; ) in let plot_polygon (color, xs, ys, fill) = @@ -1301,8 +1349,8 @@ image (xmin, ymin) (xmax, ymax) m; default_axes; maybe (Option.map (fun (x, y, t) -> label x y t) labels); - colorbar ~axis ~scale:0.75 ~pos:(viewport_pos 0.05 0.0) - (image_colorbar [|m_min; m_max|]); + colorbar ~scale:0.75 ~pos:(viewport_pos 0.05 0.0) + (image_colorbar ~axis [|m_min; m_max|]); ]; end_stream ~stream (); () @@ -1374,8 +1422,8 @@ shades (xmin, ymin) (xmax, ymax) contours m; default_axes; maybe (Option.map (fun (x, y, t) -> label x y t) labels); - colorbar ~axis ~scale:0.75 ~pos:(viewport_pos 0.05 0.0) - (shade_colorbar contours); + colorbar ~scale:0.75 ~pos:(viewport_pos 0.05 0.0) + (shade_colorbar ~axis contours); ]; end_stream ~stream (); () Modified: trunk/bindings/ocaml/plplot.mli =================================================================== --- trunk/bindings/ocaml/plplot.mli 2013-03-14 20:45:30 UTC (rev 12297) +++ trunk/bindings/ocaml/plplot.mli 2013-03-15 03:14:39 UTC (rev 12298) @@ -256,7 +256,7 @@ val axes : ?color:color_t -> ?style:line_style_t -> - ?width:int -> + ?width:float -> ?labelfunc:(plplot_axis_type -> float -> string) -> axis_options_t list -> axis_options_t list -> plot_t @@ -285,7 +285,7 @@ (** [join ?style color (x0, y0) (x1, y1)] *) val join : ?style:line_style_t -> - ?width:int -> + ?width:float -> color_t -> float * float -> float * float -> plot_t (** [label ?color x_label y_label title] adds axis labels and a title. *) @@ -295,7 +295,7 @@ val lines : ?label:string -> ?style:line_style_t -> - ?width:int -> + ?width:float -> color_t -> float array -> float array -> plot_t (** [map ?sw ?ne color outline_type] *) @@ -449,21 +449,34 @@ ?text_justification:float -> ?text_left:bool -> legend_entry_t list list -> plot_t + (** Colorbar axis definitions *) + type colorbar_axis_t + (** Available colorbar kinds *) type colorbar_kind_t - (** [gradient_colorbar [|min; max|]] from [min] to [max] *) - val gradient_colorbar : float array -> colorbar_kind_t + (** [colorbar_axis ?axis values] creates a {!colorbar_axis_t} with the + given axis options and range values. *) + val colorbar_axis : + ?axis:axis_options_t list -> float array -> colorbar_axis_t - (** [image_colorbar [|min; max|]] from [min] to [max] *) - val image_colorbar : float array -> colorbar_kind_t + (** [gradient_colorbar ?axis [|min; max|]] from [min] to [max] *) + val gradient_colorbar : + ?axis:axis_options_t list -> float array -> colorbar_kind_t - (** [shade_colorbar ?custom contours] defines a shaded contour colorbar - with axis labels at even spacings ([custom = false]) or at the - locations of the values in [contours] - ([custom = true] - the default). *) - val shade_colorbar : ?custom:bool -> float array -> colorbar_kind_t + (** [image_colorbar ?axis [|min; max|]] from [min] to [max] *) + val image_colorbar : + ?axis:axis_options_t list -> float array -> colorbar_kind_t + (** [shade_colorbar ?custom ?axis contours] defines a shaded contour + colorbar with axis labels at even spacings ([custom = false]) or at the + locations of the values in [contours] ([custom = true] - the + default). *) + val shade_colorbar : + ?custom:bool -> + ?axis:axis_options_t list -> + float array -> colorbar_kind_t + (** Default options used for a colorbar axis *) val default_colorbar_axis : axis_options_t list @@ -475,8 +488,8 @@ ?cap:float option * float option -> ?contour:color_t * int -> ?orient:(float * float) plot_side_t -> - ?axis:axis_options_t list -> - ?label:string plot_side_t -> + ?axis:colorbar_axis_t list -> + ?label:string plot_side_t list -> ?color:color_t -> ?scale:float -> colorbar_kind_t -> plot_t @@ -764,8 +777,10 @@ = "camlidl_plplot_core_c_pllab" external plcolorbar : plplot_colorbar_opt -> plplot_position_opt -> float -> float -> float -> float -> int -> int -> int -> float -> float -> int -> - int -> float -> int -> string -> string -> float array -> float * float - = "camlidl_plplot_core_c_plcolorbar_bytecode" "camlidl_plplot_core_c_plcolorbar" + int -> plplot_colorbar_opt array -> string array -> + string array -> float array -> int array -> float array array -> + float * float + = "ml_plcolorbar_byte" "ml_plcolorbar" external pllegend : plplot_legend_opt -> plplot_position_opt -> float -> float -> float -> int -> int -> int -> int -> int -> plplot_legend_opt array -> float -> float -> Modified: trunk/bindings/ocaml/plplot_core.idl =================================================================== --- trunk/bindings/ocaml/plplot_core.idl 2013-03-14 20:45:30 UTC (rev 12297) +++ trunk/bindings/ocaml/plplot_core.idl 2013-03-15 03:14:39 UTC (rev 12298) @@ -330,4 +330,5 @@ RAW_ML(external plgriddata : float array -> float array -> float array -> float array -> float array -> plplot_grid_method_type -> float -> float array array = "ml_plgriddata_bytecode" "ml_plgriddata") RAW_ML(external plparseopts : string array -> plplot_parse_method_type list -> unit = "ml_plparseopts") RAW_ML(external pllegend : plplot_legend_opt -> plplot_position_opt -> float -> float -> float -> int -> int -> int -> int -> int -> plplot_legend_opt array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> float array -> int array -> int array -> int array -> int array -> int array -> float array -> int array -> string array -> float * float = "ml_pllegend_byte" "ml_pllegend") +RAW_ML(external plcolorbar : plplot_colorbar_opt -> plplot_position_opt -> float -> float -> float -> float -> int -> int -> int -> float -> float -> int -> int -> plplot_colorbar_opt array -> string array -> string array -> float array -> int array -> float array array -> float * float = "ml_plcolorbar_byte" "ml_plcolorbar") Modified: trunk/bindings/ocaml/plplot_h =================================================================== --- trunk/bindings/ocaml/plplot_h 2013-03-14 20:45:30 UTC (rev 12297) +++ trunk/bindings/ocaml/plplot_h 2013-03-15 03:14:39 UTC (rev 12298) @@ -259,7 +259,6 @@ const PLINT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers, const char **symbols ); -*/ void c_plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, @@ -270,7 +269,8 @@ PLINT cont_color, PLINT cont_width, PLFLT ticks, PLINT sub_ticks, const char *axis_opts, const char *label, - PLINT n_values, /*const*/ PLFLT *values ); + PLINT n_values, const PLFLT *values ); +*/ void c_pllightsource(PLFLT x, PLFLT y, PLFLT z); Modified: trunk/bindings/ocaml/plplot_h.inc =================================================================== --- trunk/bindings/ocaml/plplot_h.inc 2013-03-14 20:45:30 UTC (rev 12297) +++ trunk/bindings/ocaml/plplot_h.inc 2013-03-15 03:14:39 UTC (rev 12298) @@ -61,7 +61,6 @@ [mlname(plinit)] void c_plinit ( void ); [mlname(pljoin)] void c_pljoin ( double x1, double y1, double x2, double y2 ); [mlname(pllab)] void c_pllab ( [string] const char * xlabel, [string] const char * ylabel, [string] const char * tlabel ); -[mlname(plcolorbar)] void c_plcolorbar ( [out] double * p_colorbar_width, [out] double * p_colorbar_height, plplot_colorbar_opt opt, plplot_position_opt position, double x, double y, double x_length, double y_length, int bg_color, int bb_color, int bb_style, double low_cap_color, double high_cap_color, int cont_color, int cont_width, double ticks, int sub_ticks, [string] const char * axis_opts, [string] const char * label, int n_values, [in, size_is(n_values)] double * values ); [mlname(pllightsource)] void c_pllightsource ( double x, double y, double z ); [mlname(plline)] void c_plline ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y ); [mlname(plline3)] void c_plline3 ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y, [in, size_is(n)] double * z ); Modified: trunk/bindings/ocaml/plplot_impl.c =================================================================== --- trunk/bindings/ocaml/plplot_impl.c 2013-03-14 20:45:30 UTC (rev 12297) +++ trunk/bindings/ocaml/plplot_impl.c 2013-03-15 03:14:39 UTC (rev 12298) @@ -654,6 +654,16 @@ int c_ ## o[o ## _length]; \ for ( i = 0; i < ( o ## _length ); i++ ) { ( c_ ## o )[i] = Int_val( Field( ( o ), i ) ); } +// Copy an int array, o, of n element to the C array c +#define INIT_INT_ARRAYS( o ) \ + int o ## _length, o ## _inner; \ + o ## _length = Wosize_val( o ); \ + int *c_ ## o[o ## _length]; \ + for ( i = 0; i < ( o ## _length ); i++ ) { \ + INIT_INT_ARRAY( o ## _subarray ); \ + ( c_ ## o )[i] = c_ ## o ## _subarray; \ + } + int lor_ml_list( value list, ML_VARIANT_FUNC variant_f ) { CAMLparam1( list ); @@ -753,6 +763,33 @@ return translated_option; } +int translate_colorbar_option( int colorbar_option ) +{ + int translated_option; + switch ( colorbar_option ) + { + case 0: translated_option = PL_COLORBAR_LABEL_LEFT; break; + case 1: translated_option = PL_COLORBAR_LABEL_RIGHT; break; + case 2: translated_option = PL_COLORBAR_LABEL_TOP; break; + case 3: translated_option = PL_COLORBAR_LABEL_BOTTOM; break; + case 4: translated_option = PL_COLORBAR_IMAGE; break; + case 5: translated_option = PL_COLORBAR_SHADE; break; + case 6: translated_option = PL_COLORBAR_GRADIENT; break; + case 7: translated_option = PL_COLORBAR_CAP_NONE; break; + case 8: translated_option = PL_COLORBAR_CAP_LOW; break; + case 9: translated_option = PL_COLORBAR_CAP_HIGH; break; + case 10: translated_option = PL_COLORBAR_SHADE_LABEL; break; + case 11: translated_option = PL_COLORBAR_ORIENT_RIGHT; break; + case 12: translated_option = PL_COLORBAR_ORIENT_TOP; break; + case 13: translated_option = PL_COLORBAR_ORIENT_LEFT; break; + case 14: translated_option = PL_COLORBAR_ORIENT_BOTTOM; break; + case 15: translated_option = PL_COLORBAR_BACKGROUND; break; + case 16: translated_option = PL_COLORBAR_BOUNDING_BOX; break; + default: translated_option = -1; + } + return translated_option; +} + int translate_position_option( int position_option ) { int translated_option; @@ -864,6 +901,93 @@ argv[25], argv[26], argv[27] ); } +value ml_plcolorbar( value opt, value position, value x, value y, + value x_length, value y_length, + value bg_color, value bb_color, value bb_style, + value low_cap_color, value high_cap_color, + value cont_color, value cont_width, + value label_opts, value label, + value axis_opts, + value ticks, value sub_ticks, + value values ) +{ + CAMLparam5( opt, position, x, y, x_length ); + CAMLxparam5( y_length, bg_color, bb_color, bb_style, low_cap_color ); + CAMLxparam5( high_cap_color, cont_color, cont_width, label_opts, label ); + CAMLxparam4( axis_opts, ticks, sub_ticks, values ); + CAMLlocal1( result ); + result = caml_alloc( 2, 0 ); + + // Counter + int i; + // General colorbar options + int c_opt, c_position; + // Number of labels + int n_labels; + n_labels = Wosize_val( label_opts ); + // Number of axes and value ranges + int n_axes; + n_axes = Wosize_val( axis_opts ); + + // Translate configuration options + c_opt = lor_ml_list( opt, translate_colorbar_option ); + c_position = lor_ml_list( position, translate_position_option ); + + // Assume that the dimensions all line up on the OCaml side, so we don't + // need to do any further dimension checks. + + // Define and initialize all of the C arrays to pass into plcolorbar + INIT_STRING_ARRAY( label ) + INIT_STRING_ARRAY( axis_opts ) + INIT_INT_ARRAY( sub_ticks ); + + // Label options + int c_label_opts[ n_labels ]; + for ( i = 0; i < n_labels; i++ ) + { + c_label_opts[i] = lor_ml_list( Field( label_opts, i ), translate_colorbar_option ); + } + + // Copy the axis/range values + double **c_values; + int n_values[ n_axes ]; + c_values = malloc( n_axes * sizeof( double * ) ); + // TODO: Add allocation failure check + for ( i = 0; i < n_axes; i++ ) + { + c_values[i] = (double *) Field( values, i ); + n_values[i] = Wosize_val( Field( values, i ) ) / Double_wosize; + } + + // Return values + PLFLT width, height; + + plcolorbar( &width, &height, + c_opt, c_position, Double_val( x ), Double_val( y ), + Double_val( x_length ), Double_val( y_length ), + Int_val( bg_color ), Int_val( bb_color ), Int_val( bb_style ), + Double_val( low_cap_color ), Double_val( high_cap_color ), + Int_val( cont_color ), Int_val( cont_width ), + n_labels, c_label_opts, c_label, + n_axes, c_axis_opts, + (double *)ticks, c_sub_ticks, + n_values, (const PLFLT * const *)c_values ); + + // Return a tuple with the colorbar's size + Store_field( result, 0, caml_copy_double( width ) ); + Store_field( result, 1, caml_copy_double( height ) ); + + CAMLreturn( result ); +} + +value ml_plcolorbar_byte( value *argv, int argn ) +{ + return ml_plcolorbar( argv[0], argv[1], argv[2], argv[3], argv[4], + argv[5], argv[6], argv[7], argv[8], argv[9], + argv[10], argv[11], argv[12], argv[13], argv[14], + argv[15], argv[16], argv[17], argv[18] ); +} + // pltr* function implementations void ml_pltr0( double x, double y, double* tx, double* ty ) { Modified: trunk/bindings/ocaml/touchup.ml =================================================================== --- trunk/bindings/ocaml/touchup.ml 2013-03-14 20:45:30 UTC (rev 12297) +++ trunk/bindings/ocaml/touchup.ml 2013-03-15 03:14:39 UTC (rev 12298) @@ -79,6 +79,7 @@ function_attrs = None; parameter_attrs = Some ["ctime", ["out"]]; }; + (* For now, this will be wrapped by hand... { function_name = "c_plcolorbar"; function_attrs = None; @@ -86,7 +87,6 @@ "p_colorbar_width", ["out"]; "p_colorbar_height", ["out"]]; }; - (* For now, this will be wrapped by hand... { function_name = "c_plgriddata"; function_attrs = None; Modified: trunk/examples/ocaml/x01.ml =================================================================== --- trunk/examples/ocaml/x01.ml 2013-03-14 20:45:30 UTC (rev 12297) +++ trunk/examples/ocaml/x01.ml 2013-03-15 03:14:39 UTC (rev 12298) @@ -182,9 +182,9 @@ (* Draw the line *) plcol0 3; - plwidth 2; + plwidth 2.0; plline x y; - plwidth 1; + plwidth 1.0; (* All done. *) () Modified: trunk/examples/ocaml/x02.ml =================================================================== --- trunk/examples/ocaml/x02.ml 2013-03-14 20:45:30 UTC (rev 12297) +++ trunk/examples/ocaml/x02.ml 2013-03-15 03:14:39 UTC (rev 12298) @@ -39,13 +39,13 @@ let vmin = 0.1 in let vmax = 0.9 in for j = 0 to 2 do - plwidth (j + 1); + plwidth (float_of_int (j + 1)); let j' = float_of_int j *. 0.1 in plvpor (vmin +. j') (vmax -. j') (vmin +. j') (vmax -. j'); plwind 0.0 1.0 0.0 1.0; plbox "bc" 0.0 0 "bc" 0.0 0; done; - plwidth 1; + plwidth 1.0; plptex 0.5 0.5 1.0 0.0 0.5 text; done; () Modified: trunk/examples/ocaml/xplot01.ml =================================================================== --- trunk/examples/ocaml/xplot01.ml 2013-03-14 20:45:30 UTC (rev 12297) +++ trunk/examples/ocaml/xplot01.ml 2013-03-15 03:14:39 UTC (rev 12298) @@ -135,7 +135,7 @@ (* Draw the line *) P.plot ~stream [ - P.lines ~width:2 P.Red x y; + P.lines ~width:2.0 P.Red x y; P.axes x_axis y_axis; P.label "(x)" "sin(x)/x" "#frPLplot Example 1 - Sinc Function"; ]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2013-03-20 00:49:52
|
Revision: 12300 http://sourceforge.net/p/plplot/code/12300 Author: jbauck Date: 2013-03-20 00:49:49 +0000 (Wed, 20 Mar 2013) Log Message: ----------- Convert line width types that were Integer to Long_Float (second attempt to commit all the changed files). Modified Paths: -------------- trunk/bindings/ada/plplot.ads trunk/bindings/ada/plplot_traditional.adb trunk/bindings/ada/plplot_traditional.ads trunk/examples/ada/x01a.adb trunk/examples/ada/x02a.adb trunk/examples/ada/xthick01a.adb trunk/examples/ada/xthick02a.adb Modified: trunk/bindings/ada/plplot.ads =================================================================== --- trunk/bindings/ada/plplot.ads 2013-03-20 00:33:32 UTC (rev 12299) +++ trunk/bindings/ada/plplot.ads 2013-03-20 00:49:49 UTC (rev 12300) @@ -2104,7 +2104,7 @@ -- Set pen width. -- plwidth - procedure Set_Pen_Width(Pen_Width : Integer); + procedure Set_Pen_Width(Pen_Width : Long_Float); -- Set up world coordinates of the viewport boundaries (2d plots). Modified: trunk/bindings/ada/plplot_traditional.adb =================================================================== --- trunk/bindings/ada/plplot_traditional.adb 2013-03-20 00:33:32 UTC (rev 12299) +++ trunk/bindings/ada/plplot_traditional.adb 2013-03-20 00:49:49 UTC (rev 12300) @@ -70,7 +70,7 @@ -- Set default pen width. Docs don't say, so I'll make it 1. -- I could make this depend on the type of outut device used. - Default_Pen_Width : constant Integer := 1; + Default_Pen_Width : constant Long_Float := 1.0; procedure Set_Default_Pen_Width is begin plwidth(Default_Pen_Width); @@ -3147,7 +3147,7 @@ -- Set pen width. - procedure plwidth(Pen_Width : Integer) is + procedure plwidth(Pen_Width : Long_Float) is begin PLplot_Thin.plwidth(Pen_Width); end plwidth; Modified: trunk/bindings/ada/plplot_traditional.ads =================================================================== --- trunk/bindings/ada/plplot_traditional.ads 2013-03-20 00:33:32 UTC (rev 12299) +++ trunk/bindings/ada/plplot_traditional.ads 2013-03-20 00:49:49 UTC (rev 12300) @@ -1932,7 +1932,7 @@ -- Set pen width. - procedure plwidth(Pen_Width : Integer); + procedure plwidth(Pen_Width : Long_Float); -- Set up world coordinates of the viewport boundaries (2d plots). Modified: trunk/examples/ada/x01a.adb =================================================================== --- trunk/examples/ada/x01a.adb 2013-03-20 00:33:32 UTC (rev 12299) +++ trunk/examples/ada/x01a.adb 2013-03-20 00:49:49 UTC (rev 12300) @@ -98,9 +98,9 @@ -- Draw the line plcol0(3); - plwidth(2); + plwidth(2.0); plline(x, y); - plwidth(1); + plwidth(1.0); end plot2; Modified: trunk/examples/ada/x02a.adb =================================================================== --- trunk/examples/ada/x02a.adb 2013-03-20 00:33:32 UTC (rev 12299) +++ trunk/examples/ada/x02a.adb 2013-03-20 00:49:49 UTC (rev 12300) @@ -62,14 +62,14 @@ vmin := 0.1; vmax := 0.9; for j in 0..2 loop - plwidth(j + 1); + plwidth(Long_Float(j + 1)); plvpor(vmin, vmax, vmin, vmax); plwind(0.0, 1.0, 0.0, 1.0); plbox("bc", 0.0, 0, "bc", 0.0, 0); vmin := vmin + 0.1; vmax := vmax - 0.1; end loop; - plwidth(1); + plwidth(1.0); plptex(0.5, 0.5, 1.0, 0.0, 0.5, Trim(Integer'image(i), Left)); end loop; end draw_windows; Modified: trunk/examples/ada/xthick01a.adb =================================================================== --- trunk/examples/ada/xthick01a.adb 2013-03-20 00:33:32 UTC (rev 12299) +++ trunk/examples/ada/xthick01a.adb 2013-03-20 00:49:49 UTC (rev 12300) @@ -98,9 +98,9 @@ -- Draw the line Set_Pen_Color(Green); - Set_Pen_Width(2); + Set_Pen_Width(2.0); Draw_Curve(x, y); - Set_Pen_Width(1); + Set_Pen_Width(1.0); end plot2; Modified: trunk/examples/ada/xthick02a.adb =================================================================== --- trunk/examples/ada/xthick02a.adb 2013-03-20 00:33:32 UTC (rev 12299) +++ trunk/examples/ada/xthick02a.adb 2013-03-20 00:49:49 UTC (rev 12300) @@ -62,14 +62,14 @@ vmin := 0.1; vmax := 0.9; for j in 0..2 loop - Set_Pen_Width(j + 1); + Set_Pen_Width(Long_Float(j + 1)); Set_Viewport_Normalized(vmin, vmax, vmin, vmax); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Box_Around_Viewport("bc", 0.0, 0, "bc", 0.0, 0); vmin := vmin + 0.1; vmax := vmax - 0.1; end loop; - Set_Pen_Width(1); + Set_Pen_Width(1.0); Write_Text_World(0.5, 0.5, 1.0, 0.0, 0.5, Trim(Integer'image(i), Left)); end loop; end draw_windows; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2013-04-28 17:37:06
|
Revision: 12310 http://sourceforge.net/p/plplot/code/12310 Author: hezekiahcarty Date: 2013-04-28 17:37:01 +0000 (Sun, 28 Apr 2013) Log Message: ----------- Add support for camlidl (and therefore OCaml) installed via opam This requires findlib which most OCaml users should have. Modified Paths: -------------- trunk/bindings/ocaml/CMakeLists.txt trunk/cmake/modules/ocaml.cmake Modified: trunk/bindings/ocaml/CMakeLists.txt =================================================================== --- trunk/bindings/ocaml/CMakeLists.txt 2013-04-26 22:43:53 UTC (rev 12309) +++ trunk/bindings/ocaml/CMakeLists.txt 2013-04-28 17:37:01 UTC (rev 12310) @@ -100,8 +100,8 @@ ${CMAKE_CURRENT_BINARY_DIR}/plplot_impl.o ${CMAKE_CURRENT_BINARY_DIR}/dllplplot_stubs.so ${CMAKE_CURRENT_BINARY_DIR}/libplplot_stubs.a - COMMAND ${OCAMLC} -c ${CMAKE_CURRENT_BINARY_DIR}/plplot_core_stubs.c - COMMAND ${OCAMLC} -ccopt -I${CMAKE_SOURCE_DIR}/include -ccopt -I${CMAKE_BINARY_DIR}/include -ccopt -I${CMAKE_SOURCE_DIR}/lib/qsastime -ccopt -I${CMAKE_BINARY_DIR} -ccopt -DHAVE_CONFIG_H -c ${CMAKE_CURRENT_SOURCE_DIR}/plplot_impl.c + COMMAND ${OCAMLC} -ccopt -I${CAMLIDL_LIB_DIR} -c ${CMAKE_CURRENT_BINARY_DIR}/plplot_core_stubs.c + COMMAND ${OCAMLC} -ccopt -I${CMAKE_SOURCE_DIR}/include -ccopt -I${CMAKE_BINARY_DIR}/include -ccopt -I${CMAKE_SOURCE_DIR}/lib/qsastime -ccopt -I${CMAKE_BINARY_DIR} -ccopt -I${CAMLIDL_LIB_DIR} -ccopt -DHAVE_CONFIG_H -c ${CMAKE_CURRENT_SOURCE_DIR}/plplot_impl.c COMMAND ${OCAMLMKLIB} -o plplot_stubs -L${CAMLIDL_LIB_DIR} -lcamlidl -L${CMAKE_BINARY_DIR}/src -lplplot${LIB_TAG} ${CMAKE_CURRENT_BINARY_DIR}/plplot_core_stubs.o ${CMAKE_CURRENT_BINARY_DIR}/plplot_impl.o ${ocaml_STATIC_FLAGS} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plplot_core_stubs.c Modified: trunk/cmake/modules/ocaml.cmake =================================================================== --- trunk/cmake/modules/ocaml.cmake 2013-04-26 22:43:53 UTC (rev 12309) +++ trunk/cmake/modules/ocaml.cmake 2013-04-28 17:37:01 UTC (rev 12310) @@ -119,7 +119,15 @@ OUTPUT_STRIP_TRAILING_WHITESPACE ) message(STATUS "OCAML_LIB_PATH = ${OCAML_LIB_PATH}") - find_path(CAMLIDL_LIB_DIR libcamlidl.a PATHS ${OCAML_LIB_PATH} ) + if(OCAMLFIND) + execute_process(COMMAND ${OCAMLFIND} query camlidl + OUTPUT_VARIABLE CAMLIDL_LIB_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + find_path(CAMLIDL_LIB_DIR libcamlidl.a PATHS ${CAMLIDL_LIB_PATH} ${OCAML_LIB_PATH} ) + else(OCAMLFIND) + find_path(CAMLIDL_LIB_DIR libcamlidl.a PATHS ${OCAML_LIB_PATH} ) + endif(OCAMLFIND) if(CAMLIDL_LIB_DIR) message(STATUS "CAMLIDL_LIB_DIR = ${CAMLIDL_LIB_DIR}") else(CAMLIDL_LIB_DIR) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2013-05-01 01:11:45
|
Revision: 12312 http://sourceforge.net/p/plplot/code/12312 Author: hezekiahcarty Date: 2013-05-01 01:11:41 +0000 (Wed, 01 May 2013) Log Message: ----------- Propagate line width changes through C API This should cover pllegend, plcolorbar and the plshade functions in the C API. Affected examples (4, 26, 33) have been updated as well. These changes still need to be propagated to the full suite of language bindings. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/examples/c/x26c.c trunk/examples/c/x33c.c trunk/include/plplot.h trunk/include/plplotP.h trunk/src/plbox.c trunk/src/pllegend.c trunk/src/plot3d.c trunk/src/plshade.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2013-04-30 04:52:56 UTC (rev 12311) +++ trunk/examples/c/x04c.c 2013-05-01 01:11:41 UTC (rev 12312) @@ -52,7 +52,7 @@ PLINT text_colors[2]; PLINT line_colors[2]; PLINT line_styles[2]; - PLINT line_widths[2]; + PLFLT line_widths[2]; PLINT symbol_numbers[2], symbol_colors[2]; PLFLT symbol_scales[2]; PLFLT legend_width, legend_height; Modified: trunk/examples/c/x26c.c =================================================================== --- trunk/examples/c/x26c.c 2013-04-30 04:52:56 UTC (rev 12311) +++ trunk/examples/c/x26c.c 2013-05-01 01:11:41 UTC (rev 12312) @@ -155,7 +155,7 @@ PLINT text_colors[2]; PLINT line_colors[2]; PLINT line_styles[2]; - PLINT line_widths[2]; + PLFLT line_widths[2]; PLINT symbol_numbers[2], symbol_colors[2]; PLFLT symbol_scales[2]; const char *symbols[2]; Modified: trunk/examples/c/x33c.c =================================================================== --- trunk/examples/c/x33c.c 2013-04-30 04:52:56 UTC (rev 12311) +++ trunk/examples/c/x33c.c 2013-05-01 01:11:41 UTC (rev 12312) @@ -315,10 +315,10 @@ PLINT box_colors[MAX_NLEGEND]; PLINT box_patterns[MAX_NLEGEND]; PLFLT box_scales[MAX_NLEGEND]; - PLINT box_line_widths[MAX_NLEGEND]; + PLFLT box_line_widths[MAX_NLEGEND]; PLINT line_colors[MAX_NLEGEND]; PLINT line_styles[MAX_NLEGEND]; - PLINT line_widths[MAX_NLEGEND]; + PLFLT line_widths[MAX_NLEGEND]; PLINT symbol_numbers[MAX_NLEGEND], symbol_colors[MAX_NLEGEND]; PLFLT symbol_scales[MAX_NLEGEND]; char *text[MAX_NLEGEND]; Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2013-04-30 04:52:56 UTC (rev 12311) +++ trunk/include/plplot.h 2013-05-01 01:11:41 UTC (rev 12312) @@ -1242,9 +1242,9 @@ PLFLT text_justification, const PLINT *text_colors, const char * const *text, const PLINT *box_colors, const PLINT *box_patterns, - const PLFLT *box_scales, const PLINT *box_line_widths, + const PLFLT *box_scales, const PLFLT *box_line_widths, const PLINT *line_colors, const PLINT *line_styles, - const PLINT *line_widths, + const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers, const char * const *symbols ); @@ -1255,7 +1255,7 @@ 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, PLINT cont_width, + 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, @@ -1623,9 +1623,9 @@ c_plshade( const PLFLT * const *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLBOOL rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -1634,9 +1634,9 @@ c_plshade1( const PLFLT *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( const PLINT, const PLFLT *, const PLFLT * ), PLBOOL rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -1644,8 +1644,8 @@ PLDLLIMPEXP void c_plshades( const PLFLT * const *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - const PLFLT *clevel, PLINT nlevel, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + const PLFLT *clevel, PLINT nlevel, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLBOOL rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -1654,8 +1654,8 @@ plfshades( PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - const PLFLT *clevel, PLINT nlevel, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + const PLFLT *clevel, PLINT nlevel, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -1668,9 +1668,9 @@ PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLBOOL rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -1680,9 +1680,9 @@ PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); Modified: trunk/include/plplotP.h =================================================================== --- trunk/include/plplotP.h 2013-04-30 04:52:56 UTC (rev 12311) +++ trunk/include/plplotP.h 2013-05-01 01:11:41 UTC (rev 12312) @@ -798,7 +798,7 @@ // Get background parameters (including line width) for 3d plot. void -plP_gzback( PLINT **zbf, PLINT **zbc, PLFLT **zbt, PLINT **zbw ); +plP_gzback( PLINT **zbf, PLINT **zbc, PLFLT **zbt, PLFLT **zbw ); // Move to physical coordinates (x,y). Modified: trunk/src/plbox.c =================================================================== --- trunk/src/plbox.c 2013-04-30 04:52:56 UTC (rev 12311) +++ trunk/src/plbox.c 2013-05-01 01:11:41 UTC (rev 12312) @@ -598,7 +598,8 @@ PLFLT xmin, xmax, ymin, ymax, zmin, zmax, zscale; PLFLT cxx, cxy, cyx, cyy, cyz; PLINT ln; - PLINT *zbflg, *zbcol, *zbwidth; + PLINT *zbflg, *zbcol; + PLFLT *zbwidth; PLFLT *zbtck; PLINT xdigmax, xdigits; PLINT ydigmax, ydigits; Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2013-04-30 04:52:56 UTC (rev 12311) +++ trunk/src/pllegend.c 2013-05-01 01:11:41 UTC (rev 12312) @@ -534,9 +534,9 @@ PLFLT text_justification, const PLINT *text_colors, const char * const *text, const PLINT *box_colors, const PLINT *box_patterns, - const PLFLT *box_scales, const PLINT *box_line_widths, + const PLFLT *box_scales, const PLFLT *box_line_widths, const PLINT *line_colors, const PLINT *line_styles, - const PLINT *line_widths, + const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers, const char * const *symbols ) @@ -1465,7 +1465,7 @@ 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, PLINT cont_width, + PLINT cont_color, PLFLT cont_width, PLINT n_labels, PLINT *label_opts, const char *labels[], PLINT n_axes, const char *axis_opts[], PLFLT *ticks, PLINT *sub_ticks, Modified: trunk/src/plot3d.c =================================================================== --- trunk/src/plot3d.c 2013-04-30 04:52:56 UTC (rev 12311) +++ trunk/src/plot3d.c 2013-05-01 01:11:41 UTC (rev 12312) @@ -34,8 +34,8 @@ static PLINT pl3mode = 0; // 0 3d solid; 1 mesh plot static PLINT pl3upv = 1; // 1 update view; 0 no update -static PLINT zbflg = 0, zbcol, zbwidth; -static PLFLT zbtck; +static PLINT zbflg = 0, zbcol; +static PLFLT zbtck, zbwidth; static PLINT *oldhiview = NULL; static PLINT *oldloview = NULL; @@ -412,7 +412,8 @@ CONT_LEVEL *cont, *clev; CONT_LINE *cline; int ct, ix, iy, iftriangle; - PLINT color = plsc->icol0, width = plsc->width; + PLINT color = plsc->icol0; + PLFLT width = plsc->width; PLFLT ( *getz )( PLPointer, PLINT, PLINT ) = zops->get; if ( plsc->level < 3 ) @@ -972,7 +973,8 @@ PLINT PL_UNUSED( ixstart ), PLINT PL_UNUSED( ixn ), const PLINT * PL_UNUSED( indexymin ), const PLINT * PL_UNUSED( indexymax ) ) { PLFLT cxx, cxy, cyx, cyy, cyz; - PLINT init, ix, iy, color, width; + PLINT init, ix, iy, color; + PLFLT width; PLFLT xmin, xmax, ymin, ymax, zmin, zmax, zscale; PLINT ixmin = 0, ixmax = nx - 1, iymin = 0, iymax = ny - 1; PLINT clipped = 0, base_cont = 0, side = 0; @@ -1546,7 +1548,7 @@ //-------------------------------------------------------------------------- void -plP_gzback( PLINT **zbf, PLINT **zbc, PLFLT **zbt, PLINT **zbw ) +plP_gzback( PLINT **zbf, PLINT **zbc, PLFLT **zbt, PLFLT **zbw ) { *zbf = &zbflg; *zbc = &zbcol; Modified: trunk/src/plshade.c =================================================================== --- trunk/src/plshade.c 2013-04-30 04:52:56 UTC (rev 12311) +++ trunk/src/plshade.c 2013-05-01 01:11:41 UTC (rev 12312) @@ -30,8 +30,8 @@ // void plshade(PLFLT *a, PLINT nx, PLINT ny, char *defined, // PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, // PLFLT shade_min, PLFLT shade_max, -// PLINT sh_color, PLINT sh_width, PLINT min_color, PLINT min_width, -// PLINT max_color, PLINT max_width, void (*fill)(), PLINT +// PLINT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, +// PLINT max_color, PLFLT max_width, void (*fill)(), PLINT // rectangular, ...) // // arguments: @@ -68,11 +68,11 @@ // Defines the interval to be shaded. If shade_max <= shade_min, plshade // does nothing. // -// PLINT sh_cmap, PLFLT sh_color, PLINT sh_width +// PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width // // Defines color map, color map index, and width used by the fill pattern. // -// PLINT min_color, min_width, max_color, max_width +// PLINT min_color, PLFLT min_width, PLINT max_color, PLFLT max_width // // Defines pen color, width used by the boundary of shaded region. The min // values are used for the shade_min boundary, and the max values are used @@ -138,7 +138,7 @@ static int min_points, max_points, n_point; static int min_pts[4], max_pts[4]; static PLINT pen_col_min, pen_col_max; -static PLINT pen_wd_min, pen_wd_max; +static PLFLT pen_wd_min, pen_wd_max; static PLFLT int_val; // Function prototypes @@ -182,9 +182,9 @@ PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -204,8 +204,8 @@ void c_plshades( const PLFLT * const *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - const PLFLT *clevel, PLINT nlevel, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + const PLFLT *clevel, PLINT nlevel, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -235,15 +235,15 @@ plfshades( PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - const PLFLT *clevel, PLINT nlevel, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + const PLFLT *clevel, PLINT nlevel, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) { PLFLT shade_min, shade_max, shade_color; - PLINT i, init_color, init_width; - PLFLT color_min, color_max, color_range; + PLINT i, init_color; + PLFLT init_width, color_min, color_max, color_range; // Color range to use color_min = plsc->cmap1_min; @@ -321,9 +321,9 @@ void c_plshade( const PLFLT * const *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -349,9 +349,9 @@ void c_plshade1( const PLFLT *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -387,9 +387,9 @@ PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -418,9 +418,9 @@ PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -474,17 +474,17 @@ PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) { - PLINT init_width, n, slope = 0, ix, iy; + PLINT n, slope = 0, ix, iy; int count, i, j, nxny; PLFLT *a, *a0, *a1, dx, dy; - PLFLT x[8], y[8], xp[2], tx, ty; + PLFLT x[8], y[8], xp[2], tx, ty, init_width; int *c, *c0, *c1; (void) c2eval; // Cast to void to silence compiler warning about unused parameter This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2013-05-01 01:12:25
|
Revision: 12313 http://sourceforge.net/p/plplot/code/12313 Author: hezekiahcarty Date: 2013-05-01 01:12:18 +0000 (Wed, 01 May 2013) Log Message: ----------- Propagate floating point line width API changes to the OCaml bindings Clean output comparison vs C on my system except for the colorbar additions to example 16 which have not been added to the OCaml version yet. Modified Paths: -------------- trunk/bindings/ocaml/plplot.ml trunk/bindings/ocaml/plplot.mli trunk/bindings/ocaml/plplot_core.idl trunk/bindings/ocaml/plplot_h trunk/bindings/ocaml/plplot_impl.c trunk/examples/ocaml/x04.ml trunk/examples/ocaml/x15.ml trunk/examples/ocaml/x16.ml trunk/examples/ocaml/x21.ml trunk/examples/ocaml/x26.ml trunk/examples/ocaml/x33.ml Modified: trunk/bindings/ocaml/plplot.ml =================================================================== --- trunk/bindings/ocaml/plplot.ml 2013-05-01 01:11:41 UTC (rev 12312) +++ trunk/bindings/ocaml/plplot.ml 2013-05-01 01:12:18 UTC (rev 12313) @@ -187,7 +187,7 @@ (string option * color_t * float array * float array * string * float) | Polygon of (color_t * float array * float array * bool) | Shades of ( - int * color_t * int * bool * float * float * float * float * float array + float * color_t * float * bool * float * float * float * float * float array array * float array ) | Text of (color_t * string * float * float * float * float * float) @@ -550,10 +550,10 @@ let shades ?fill_width ?contour ?(rect = true) (x0, y0) (x1, y1) contours data = let cont_color, cont_width = - contour |? (Index_color 0, 0) + contour |? (Index_color 0, 0.0) in Shades ( - fill_width |? 1, cont_color, cont_width, rect, x0, y0, x1, y1, + fill_width |? 1.0, cont_color, cont_width, rect, x0, y0, x1, y1, data, contours ) @@ -625,8 +625,8 @@ type legend_entry_t = | No_legend (** An empty entry *) - | Box_legend of (int * int * float * int * int * string) - | Line_legend of (int * int * int * int * string) + | Box_legend of (int * int * float * float * int * string) + | Line_legend of (int * int * float * int * string) | Symbol_legend of (int * float * int * string * int * string) let opt_of_entry = function @@ -641,13 +641,13 @@ let no_legend = No_legend - let box_legend ?(pattern = 0) ?(scale = 1.0) ?(line_width = 1) + let box_legend ?(pattern = 0) ?(scale = 1.0) ?(line_width = 1.0) ?(label_color = Black) ~label color = let label_color = int_of_color label_color in let color = int_of_color color in Box_legend (color, pattern, scale, line_width, label_color, label) - let line_legend ?(style = 1) ?(width = 1) ?(label_color = Black) ~label color = + let line_legend ?(style = 1) ?(width = 1.0) ?(label_color = Black) ~label color = let label_color = int_of_color label_color in let color = int_of_color color in Line_legend (color, style, width, label_color, label) @@ -787,10 +787,10 @@ let box_colors = Array.make n_entries 0 in let box_patterns = Array.make n_entries 0 in let box_scales = Array.make n_entries 0.0 in - let box_line_widths = Array.make n_entries 0 in + let box_line_widths = Array.make n_entries 0.0 in let line_colors = Array.make n_entries 0 in let line_styles = Array.make n_entries 0 in - let line_widths = Array.make n_entries 0 in + let line_widths = Array.make n_entries 0.0 in let symbol_colors = Array.make n_entries 0 in let symbol_scales = Array.make n_entries 0.0 in let symbol_numbers = Array.make n_entries 0 in @@ -882,7 +882,7 @@ (* Contours *) let cont_color, cont_width = match contour with - | None -> 0, 0 + | None -> 0, 0.0 | Some (col, wid) -> int_of_color col, wid in (* Orientation *) Modified: trunk/bindings/ocaml/plplot.mli =================================================================== --- trunk/bindings/ocaml/plplot.mli 2013-05-01 01:11:41 UTC (rev 12312) +++ trunk/bindings/ocaml/plplot.mli 2013-05-01 01:12:18 UTC (rev 12313) @@ -319,8 +319,8 @@ (** [shades ?fill_width ?contour ?rect (x0, y0) (x1, y1) contours data] *) val shades : - ?fill_width:int -> - ?contour:color_t * int -> + ?fill_width:float -> + ?contour:color_t * float -> ?rect:bool -> float * float -> float * float -> float array -> float array array -> plot_t @@ -413,13 +413,13 @@ val box_legend : ?pattern:int -> ?scale:float -> - ?line_width:int -> + ?line_width:float -> ?label_color:color_t -> label:string -> color_t -> legend_entry_t (** Line legend entry *) val line_legend : ?style:int -> - ?width:int -> + ?width:float -> ?label_color:color_t -> label:string -> color_t -> legend_entry_t (** Symbol/point legend entry *) @@ -486,7 +486,7 @@ ?bg:color_t -> ?bb:color_t * line_style_t -> ?cap:float option * float option -> - ?contour:color_t * int -> + ?contour:color_t * float -> ?orient:(float * float) plot_side_t -> ?axis:colorbar_axis_t list -> ?label:string plot_side_t list -> @@ -777,7 +777,7 @@ = "camlidl_plplot_core_c_pllab" external plcolorbar : plplot_colorbar_opt -> plplot_position_opt -> float -> float -> float -> float -> int -> int -> int -> float -> float -> int -> - int -> plplot_colorbar_opt array -> string array -> + float -> plplot_colorbar_opt array -> string array -> string array -> float array -> int array -> float array array -> float * float = "ml_plcolorbar_byte" "ml_plcolorbar" @@ -785,7 +785,7 @@ float -> float -> float -> int -> int -> int -> int -> int -> plplot_legend_opt array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> - float array -> int array -> int array -> int array -> int array -> + float array -> float array -> int array -> int array -> float array -> int array -> float array -> int array -> string array -> float * float = "ml_pllegend_byte" "ml_pllegend" external pllightsource : float -> float -> float -> unit @@ -975,13 +975,13 @@ float -> float -> float -> - float -> int -> float -> int -> int -> int -> int -> int -> bool -> unit + float -> int -> float -> float -> int -> float -> int -> float -> bool -> unit = "camlidl_plplot_core_ml_plshade_bytecode" "camlidl_plplot_core_ml_plshade" external plshades : float array array -> float -> - float -> float -> float -> float array -> int -> int -> int -> bool -> unit + float -> float -> float -> float array -> float -> int -> float -> bool -> unit = "camlidl_plplot_core_ml_plshades_bytecode" "camlidl_plplot_core_ml_plshades" external plimagefr : Modified: trunk/bindings/ocaml/plplot_core.idl =================================================================== --- trunk/bindings/ocaml/plplot_core.idl 2013-05-01 01:11:41 UTC (rev 12312) +++ trunk/bindings/ocaml/plplot_core.idl 2013-05-01 01:12:18 UTC (rev 12313) @@ -159,16 +159,16 @@ [size_is(nx,ny)] PLFLT **a, PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, PLBOOL rectangular); [mlname(plshades)] void ml_plshades( [size_is(nx,ny)] PLFLT **a, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - [size_is(nlevel)] PLFLT *clevel, PLINT nlevel, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + [size_is(nlevel)] PLFLT *clevel, PLINT nlevel, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, PLBOOL rectangular); [mlname(plimagefr)] void ml_plimagefr( @@ -200,9 +200,9 @@ // XXX The following are non-standard functions which help retrieve some extra // information from PLplot. int plg_current_col0(void); -float plg_current_col1(void); -float plgwidth(void); -float plgchrht(void); +PLFLT plg_current_col1(void); +PLFLT plgwidth(void); +PLFLT plgchrht(void); #define QUOTEME(x) #x #define RAW_ML(x) quote(mlmli, QUOTEME(x)); @@ -329,6 +329,6 @@ RAW_ML(external plgriddata : float array -> float array -> float array -> float array -> float array -> plplot_grid_method_type -> float -> float array array = "ml_plgriddata_bytecode" "ml_plgriddata") RAW_ML(external plparseopts : string array -> plplot_parse_method_type list -> unit = "ml_plparseopts") -RAW_ML(external pllegend : plplot_legend_opt -> plplot_position_opt -> float -> float -> float -> int -> int -> int -> int -> int -> plplot_legend_opt array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> float array -> int array -> int array -> int array -> int array -> int array -> float array -> int array -> string array -> float * float = "ml_pllegend_byte" "ml_pllegend") -RAW_ML(external plcolorbar : plplot_colorbar_opt -> plplot_position_opt -> float -> float -> float -> float -> int -> int -> int -> float -> float -> int -> int -> plplot_colorbar_opt array -> string array -> string array -> float array -> int array -> float array array -> float * float = "ml_plcolorbar_byte" "ml_plcolorbar") +RAW_ML(external pllegend : plplot_legend_opt -> plplot_position_opt -> float -> float -> float -> int -> int -> int -> int -> int -> plplot_legend_opt array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> float array -> float array -> int array -> int array -> float array -> int array -> float array -> int array -> string array -> float * float = "ml_pllegend_byte" "ml_pllegend") +RAW_ML(external plcolorbar : plplot_colorbar_opt -> plplot_position_opt -> float -> float -> float -> float -> int -> int -> int -> float -> float -> int -> float -> plplot_colorbar_opt array -> string array -> string array -> float array -> int array -> float array array -> float * float = "ml_plcolorbar_byte" "ml_plcolorbar") Modified: trunk/bindings/ocaml/plplot_h =================================================================== --- trunk/bindings/ocaml/plplot_h 2013-05-01 01:11:41 UTC (rev 12312) +++ trunk/bindings/ocaml/plplot_h 2013-05-01 01:12:18 UTC (rev 12313) @@ -254,9 +254,9 @@ PLFLT text_justification, const PLINT *text_colors, const char **text, const PLINT *box_colors, const PLINT *box_patterns, - const PLFLT *box_scales, const PLINT *box_line_widths, + const PLFLT *box_scales, const PLFLT *box_line_widths, const PLINT *line_colors, const PLINT *line_styles, - const PLINT *line_widths, + const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers, const char **symbols ); @@ -266,7 +266,7 @@ 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, PLINT cont_width, + PLINT cont_color, PLFLT cont_width, PLFLT ticks, PLINT sub_ticks, const char *axis_opts, const char *label, PLINT n_values, const PLFLT *values ); @@ -483,9 +483,9 @@ c_plshade(PLFLT **a, PLINT nx, PLINT ny, PLINT (*defined) (PLFLT, PLFLT), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular, void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data); @@ -494,9 +494,9 @@ c_plshade1(PLFLT *a, PLINT nx, PLINT ny, PLINT (*defined) (PLFLT, PLFLT), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular, void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data); @@ -504,8 +504,8 @@ void c_plshades( PLFLT **a, PLINT nx, PLINT ny, PLINT (*defined) (PLFLT, PLFLT), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - PLFLT *clevel, PLINT nlevel, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + PLFLT *clevel, PLINT nlevel, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular, void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data); @@ -514,8 +514,8 @@ plfshades( PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - PLFLT *clevel, PLINT nlevel, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + PLFLT *clevel, PLINT nlevel, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -528,9 +528,9 @@ PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular, void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data); @@ -540,9 +540,9 @@ PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); Modified: trunk/bindings/ocaml/plplot_impl.c =================================================================== --- trunk/bindings/ocaml/plplot_impl.c 2013-05-01 01:11:41 UTC (rev 12312) +++ trunk/bindings/ocaml/plplot_impl.c 2013-05-01 01:12:18 UTC (rev 12313) @@ -410,9 +410,9 @@ void ml_plshade( const PLFLT **a, PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, PLBOOL rectangular ) { c_plshade( a, nx, ny, @@ -449,7 +449,7 @@ // void ml_plshades( const PLFLT **a, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - PLFLT *clevel, PLINT nlevel, PLINT fill_width, + PLFLT *clevel, PLINT nlevel, PLFLT fill_width, PLINT cont_color, PLINT cont_width, PLBOOL rectangular ) { @@ -848,10 +848,8 @@ INIT_INT_ARRAY( text_colors ) INIT_INT_ARRAY( box_colors ) INIT_INT_ARRAY( box_patterns ) - INIT_INT_ARRAY( box_line_widths ) INIT_INT_ARRAY( line_colors ) INIT_INT_ARRAY( line_styles ) - INIT_INT_ARRAY( line_widths ) INIT_INT_ARRAY( symbol_colors ) INIT_INT_ARRAY( symbol_numbers ) INIT_STRING_ARRAY( symbols ) @@ -879,8 +877,8 @@ Double_val( text_justification ), c_text_colors, c_text, c_box_colors, c_box_patterns, (double *) box_scales, - c_box_line_widths, - c_line_colors, c_line_styles, c_line_widths, + (double *) box_line_widths, + c_line_colors, c_line_styles, (double *) line_widths, c_symbol_colors, (double *) symbol_scales, c_symbol_numbers, c_symbols ); @@ -967,7 +965,7 @@ Double_val( x_length ), Double_val( y_length ), Int_val( bg_color ), Int_val( bb_color ), Int_val( bb_style ), Double_val( low_cap_color ), Double_val( high_cap_color ), - Int_val( cont_color ), Int_val( cont_width ), + Int_val( cont_color ), Double_val( cont_width ), n_labels, c_label_opts, c_label, n_axes, c_axis_opts, (double *)ticks, c_sub_ticks, @@ -1075,14 +1073,14 @@ } // Get the current color map 1 color index -float plg_current_col1( void ) +PLFLT plg_current_col1( void ) { return plsc->icol1; } // Get the current pen width. TODO: Remove this, as I think this information // can be retrieved from another proper PLplot function. -float plgwidth( void ) +PLFLT plgwidth( void ) { return plsc->width; } @@ -1090,7 +1088,7 @@ // Get the current character (text) height in mm. TODO: Remove this, as I // think this information can be retrieved from another proper PLplot // function -float plgchrht( void ) +PLFLT plgchrht( void ) { return plsc->chrht; } Modified: trunk/examples/ocaml/x04.ml =================================================================== --- trunk/examples/ocaml/x04.ml 2013-05-01 01:11:41 UTC (rev 12312) +++ trunk/examples/ocaml/x04.ml 2013-05-01 01:12:18 UTC (rev 12313) @@ -74,7 +74,7 @@ let text = [| "Amplitude"; "Phase shift" |] in let line_colors = [| 2; 3 |] in let line_styles = [| 1; 1 |] in - let line_widths = [| 1; 1 |] in + let line_widths = [| 1.0; 1.0 |] in (* note from the above opt_array the first symbol (and box) indices do not matter *) @@ -108,7 +108,7 @@ let text = [| "Amplitude" |] in let line_colors = [| 2 |] in let line_styles = [| 1 |] in - let line_widths = [| 1 |] in + let line_widths = [| 1.0 |] in (* note from the above opt_array the first symbol (and box) indices do not matter *) Modified: trunk/examples/ocaml/x15.ml =================================================================== --- trunk/examples/ocaml/x15.ml 2013-05-01 01:11:41 UTC (rev 12312) +++ trunk/examples/ocaml/x15.ml 2013-05-01 01:12:18 UTC (rev 12313) @@ -57,11 +57,11 @@ let shade_min = zmin +. (zmax -. zmin) *. 0.4 in let shade_max = zmin +. (zmax -. zmin) *. 0.6 in let sh_color = 7.0 in - let sh_width = 2 in + let sh_width = 2.0 in let min_color = 9 in let max_color = 2 in - let min_width = 2 in - let max_width = 2 in + let min_width = 2.0 in + let max_width = 2.0 in plpsty 8; plshade @@ -86,10 +86,10 @@ let plot2 z zmin zmax = let sh_cmap = 0 in let min_color = 0 in - let min_width = 0 in + let min_width = 0.0 in let max_color = 0 in - let max_width = 0 in - let sh_width = 2 in + let max_width = 0.0 in + let sh_width = 2.0 in let inc = [| Modified: trunk/examples/ocaml/x16.ml =================================================================== --- trunk/examples/ocaml/x16.ml 2013-05-01 01:11:41 UTC (rev 12312) +++ trunk/examples/ocaml/x16.ml 2013-05-01 01:12:18 UTC (rev 12313) @@ -51,9 +51,9 @@ * Does several shade plots using different coordinate mappings. \*--------------------------------------------------------------------------*) let () = - let fill_width = 2 in + let fill_width = 2.0 in let cont_color = 0 in - let cont_width = 0 in + let cont_width = 0.0 in (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; @@ -193,7 +193,7 @@ plpsty 0; - plshades z (-1.0) 1.0 (-1.) 1.0 shedge fill_width 2 3 false; + plshades z (-1.0) 1.0 (-1.) 1.0 shedge fill_width 2 3.0 false; plcol0 1; plbox "bcnst" 0.0 0 "bcnstv" 0.0 0; Modified: trunk/examples/ocaml/x21.ml =================================================================== --- trunk/examples/ocaml/x21.ml 2013-05-01 01:11:41 UTC (rev 12312) +++ trunk/examples/ocaml/x21.ml 2013-05-01 01:12:18 UTC (rev 12313) @@ -214,7 +214,7 @@ plenv0 xm xM ym yM 2 0; plcol0 15; pllab "X" "Y" title.(alg - 1); - plshades zg xm xM ym yM clev 1 0 1 true; + plshades zg xm xM ym yM clev 1.0 0 1.0 true; plcol0 2; ) else ( Modified: trunk/examples/ocaml/x26.ml =================================================================== --- trunk/examples/ocaml/x26.ml 2013-05-01 01:11:41 UTC (rev 12312) +++ trunk/examples/ocaml/x26.ml 2013-05-01 01:12:18 UTC (rev 12313) @@ -169,7 +169,7 @@ let text_colors = [| 2; 3 |] in let line_colors = [| 2; 3 |] in let line_styles = [| 1; 1 |] in - let line_widths = [| 1; 1 |] in + let line_widths = [| 1.0; 1.0 |] in (* note from the above opt_array the first symbol (and box) indices do not matter *) Modified: trunk/examples/ocaml/x33.ml =================================================================== --- trunk/examples/ocaml/x33.ml 2013-05-01 01:11:41 UTC (rev 12312) +++ trunk/examples/ocaml/x33.ml 2013-05-01 01:12:18 UTC (rev 12313) @@ -70,10 +70,10 @@ let box_colors = Array.make max_nlegend 0 in let box_patterns = Array.make max_nlegend 0 in let box_scales = Array.make max_nlegend 0.0 in - let box_line_widths = Array.make max_nlegend 0 in + let box_line_widths = Array.make max_nlegend 0.0 in let line_colors = Array.make max_nlegend 0 in let line_styles = Array.make max_nlegend 0 in - let line_widths = Array.make max_nlegend 0 in + let line_widths = Array.make max_nlegend 0.0 in let symbol_numbers = Array.make max_nlegend 0 in let symbol_colors = Array.make max_nlegend 0 in let symbol_scales = Array.make max_nlegend 0.0 in @@ -102,7 +102,7 @@ let opt_base = [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] in opt_array.(0) <- [PL_LEGEND_LINE; PL_LEGEND_SYMBOL]; line_styles.(0) <- 1; - line_widths.(0) <- 1; + line_widths.(0) <- 1.0; symbol_scales.(0) <- 1.; symbol_numbers.(0) <- 4; symbols.(0) <- "*"; @@ -149,7 +149,7 @@ for k = 0 to nlegend - 1 do opt_array.(k) <- [PL_LEGEND_LINE; PL_LEGEND_SYMBOL]; line_styles.(k) <- 1; - line_widths.(k) <- 1; + line_widths.(k) <- 1.0; symbol_scales.(k) <- 1.0; symbol_numbers.(k) <- 2; symbols.(k) <- "*"; @@ -308,7 +308,7 @@ for k = 0 to !nlegend - 1 do opt_array.(k) <- [PL_LEGEND_LINE; PL_LEGEND_SYMBOL]; line_styles.(k) <- 1; - line_widths.(k) <- 1; + line_widths.(k) <- 1.0; symbol_scales.(k) <- 1.; symbol_numbers.(k) <- 2; symbols.(k) <- "*"; @@ -377,14 +377,14 @@ box_colors.(1) <- 2; box_patterns.(1) <- 0; box_scales.(1) <- 0.8; - box_line_widths.(1) <- 1; + box_line_widths.(1) <- 1.0; opt_array.(2) <- [PL_LEGEND_LINE]; text.(2) <- sprintf "%s" "Line"; text_colors.(2) <- 3; line_colors.(2) <- 3; line_styles.(2) <- 1; - line_widths.(2) <- 1; + line_widths.(2) <- 1.0; opt_array.(3) <- [PL_LEGEND_SYMBOL]; text.(3) <- sprintf "%s" "Symbol"; @@ -399,7 +399,7 @@ text_colors.(4) <- 5; line_colors.(4) <- 5; line_styles.(4) <- 1; - line_widths.(4) <- 1; + line_widths.(4) <- 1.0; symbol_colors.(4) <- 5; symbol_scales.(4) <- text_scale; symbol_numbers.(4) <- 4; @@ -482,7 +482,7 @@ box_colors.(i) <- i + 1; box_patterns.(i) <- 0; box_scales.(i) <- 0.8; - box_line_widths.(i) <- 1; + box_line_widths.(i) <- 1.0; done; let opt = opt_base in @@ -512,7 +512,7 @@ box_colors.(i) <- 2; box_patterns.(i) <- i; box_scales.(i) <- 0.8; - box_line_widths.(i) <- 1; + box_line_widths.(i) <- 1.0; done; let opt = opt_base in @@ -539,7 +539,7 @@ box_colors.(i) <- 2; box_patterns.(i) <- 3; box_scales.(i) <- 0.8; - box_line_widths.(i) <- i + 1; + box_line_widths.(i) <- float i +. 1.0; done; let opt = opt_base in @@ -565,7 +565,7 @@ text_colors.(i) <- i + 1; line_colors.(i) <- i + 1; line_styles.(i) <- 1; - line_widths.(i) <- 1; + line_widths.(i) <- 1.0; done; let opt = opt_base in @@ -594,7 +594,7 @@ text_colors.(i) <- 2; line_colors.(i) <- 2; line_styles.(i) <- i + 1; - line_widths.(i) <- 1; + line_widths.(i) <- 1.0; done; let opt = opt_base in @@ -620,7 +620,7 @@ text_colors.(i) <- 2; line_colors.(i) <- 2; line_styles.(i) <- 1; - line_widths.(i) <- i + 1; + line_widths.(i) <- float i +. 1.0; done; let opt = opt_base in This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2013-05-01 09:38:04
|
Revision: 12315 http://sourceforge.net/p/plplot/code/12315 Author: hezekiahcarty Date: 2013-05-01 09:37:59 +0000 (Wed, 01 May 2013) Log Message: ----------- Use polymorphic variants for externally accessible options in the OCaml API This should clean up the API a bit for OCaml users. Modified Paths: -------------- trunk/bindings/ocaml/plplot.ml trunk/bindings/ocaml/plplot.mli trunk/examples/ocaml/xplot01.ml Modified: trunk/bindings/ocaml/plplot.ml =================================================================== --- trunk/bindings/ocaml/plplot.ml 2013-05-01 04:14:20 UTC (rev 12314) +++ trunk/bindings/ocaml/plplot.ml 2013-05-01 09:37:59 UTC (rev 12315) @@ -114,59 +114,59 @@ it does nothing. *) let verify_arg x s = if x then () else (invalid_arg s) - type 'a plot_side_t = - | Top of 'a | Bottom of 'a - | Left of 'a | Right of 'a + type side_t = [`top | `bottom | `left | `right] + type 'a tagged_side_t = + [`top of 'a | `bottom of 'a | `left of 'a | `right of 'a] type axis_options_t = - | Axis - | Frame0 | Frame1 - | Time - | Fixed_point - | Major_grid | Minor_grid - | Invert_ticks - | Log - | Unconventional_label - | Label - | Custom_label - | Minor_ticks - | Minor_tick_count of int - | Major_ticks - | Major_tick_spacing of float - | Vertical_label + [ `axis + | `frame0 | `frame1 + | `time + | `fixed_point + | `major_grid | `minor_grid + | `invert_ticks + | `log + | `unconventional_label + | `label + | `custom_label + | `minor_ticks + | `minor_tick_count of int + | `major_ticks + | `major_tick_spacing of float + | `vertical_label ] type stream_t = { stream : int; } type color_t = - | White - | Red - | Yellow - | Green - | Gray - | Blue - | Light_blue - | Purple - | Pink - | Black - | Brown - | Index_color of int + [ `white + | `red + | `yellow + | `green + | `gray + | `blue + | `light_blue + | `purple + | `pink + | `black + | `brown + | `index of int ] type map_t = - | Globe_outline - | USA_outline - | Countries_outline - | All_outline + [ `globe + | `usa + | `countries + | `all ] type pltr_t = float -> float -> float * float (** Line plotting styles/patterns. *) type line_style_t = - | Solid_line - | Line1 | Line2 | Line3 | Line4 - | Line5 | Line6 | Line7 | Line8 - | Custom_line of ((int * int) list) + [ `solid + | `line1 | `line2 | `line3 | `line4 + | `line5 | `line6 | `line7 | `line8 + | `custom of ((int * int) list) ] type plot_t = (* Standard plot elements *) @@ -192,7 +192,7 @@ ) | Text of (color_t * string * float * float * float * float * float) | Text_outside of - (color_t * string * float plot_side_t * float * float * bool) + (color_t * string * float tagged_side_t * float * float * bool) (* Set/clear UNIVERSAL coordinate transforms *) | Set_transform of pltr_t | Clear_transform @@ -208,20 +208,20 @@ and image_t = (float * float) option * float * float * float * float * float array array type plot_device_family_t = - | Cairo - | Qt - | Core - | Wx + [ `cairo + | `qt + | `core + | `wx ] type plot_device_t = - | Pdf of plot_device_family_t - | Png of plot_device_family_t - | Ps of plot_device_family_t - | Svg of plot_device_family_t - | Window of plot_device_family_t - | Prompt_user - | External of int - | Other_device of string - type plot_scaling_t = Preset | Greedy | Equal | Equal_square + [ `pdf of plot_device_family_t + | `png of plot_device_family_t + | `ps of plot_device_family_t + | `svg of plot_device_family_t + | `window of plot_device_family_t + | `prompt + | `stream of int (* Existing stream *) + | `other_device of string ] + type plot_scaling_t = [ `preset | `greedy | `equal | `equal_square ] type color_palette_t = | Indexed_palette of string @@ -232,7 +232,7 @@ Continuous_palette (filename, interpolate) let default_axis_options = - [Frame0; Frame1; Major_ticks; Minor_ticks; Invert_ticks; Label] + [`frame0; `frame1; `major_ticks; `minor_ticks; `invert_ticks; `label] let string_ticks_of_axis_options ol = let tick = ref 0.0 in @@ -240,91 +240,91 @@ let translated_list = List.map ( function - | Axis -> "a" - | Frame0 -> "b" - | Frame1 -> "c" - | Time -> "d" - | Fixed_point -> "f" - | Major_grid -> "g" - | Minor_grid -> "h" - | Invert_ticks -> "i" - | Log -> "l" - | Unconventional_label -> "m" - | Label -> "n" - | Custom_label -> "o" - | Minor_ticks -> "s" - | Minor_tick_count t_sub -> sub := t_sub; "s" - | Major_ticks -> "t" - | Major_tick_spacing t_space -> tick := t_space; "t" - | Vertical_label -> "v" + | `axis -> "a" + | `frame0 -> "b" + | `frame1 -> "c" + | `time -> "d" + | `fixed_point -> "f" + | `major_grid -> "g" + | `minor_grid -> "h" + | `invert_ticks -> "i" + | `log -> "l" + | `unconventional_label -> "m" + | `label -> "n" + | `custom_label -> "o" + | `minor_ticks -> "s" + | `minor_tick_count t_sub -> sub := t_sub; "s" + | `major_ticks -> "t" + | `major_tick_spacing t_space -> tick := t_space; "t" + | `vertical_label -> "v" ) ol in String.concat "" translated_list, !tick, !sub (** Convert a color to a (red, green, blue) triple *) let rgb_of_color = function - | White -> 255, 255, 255 - | Red -> 255, 0, 0 - | Yellow -> 255, 255, 0 - | Green -> 0, 255, 0 - | Gray -> 200, 200, 200 - | Blue -> 0, 0, 255 - | Light_blue -> 0, 255, 255 - | Purple -> 160, 0, 213 - | Pink -> 255, 0, 255 - | Black -> 0, 0, 0 - | Brown -> 165, 42, 42 - | Index_color i -> plgcol0 i + | `white -> 255, 255, 255 + | `red -> 255, 0, 0 + | `yellow -> 255, 255, 0 + | `green -> 0, 255, 0 + | `gray -> 200, 200, 200 + | `blue -> 0, 0, 255 + | `light_blue -> 0, 255, 255 + | `purple -> 160, 0, 213 + | `pink -> 255, 0, 255 + | `black -> 0, 0, 0 + | `brown -> 165, 42, 42 + | `index i -> plgcol0 i let string_of_map_t = function - | Globe_outline -> "globe" - | USA_outline -> "usa" - | Countries_outline -> "cglobe" - | All_outline -> "usaglobe" + | `globe -> "globe" + | `usa -> "usa" + | `countries -> "cglobe" + | `all -> "usaglobe" (** An internal function for converting a scaling variant value to the associated PLplot integer value. *) let int_of_scaling = function - | Preset -> -1 (* Scaling must be set beforehand *) - | Greedy -> 0 (* Use as much of the plot space as possible *) - | Equal -> 1 (* Square aspect ratio *) - | Equal_square -> 2 (* Square aspect ratio and square plot area *) + | `preset -> -1 (* Scaling must be set beforehand *) + | `greedy -> 0 (* Use as much of the plot space as possible *) + | `equal -> 1 (* Square aspect ratio *) + | `equal_square -> 2 (* Square aspect ratio and square plot area *) (** Get the suffix string which matches the given device family *) let string_of_device_family = function - | Cairo -> "cairo" - | Qt -> "qt" - | Core -> "" - | Wx -> "" + | `cairo -> "cairo" + | `qt -> "qt" + | `core -> "" + | `wx -> "" (** Returns the string to pass to plsdev and a boolean value indicating if the device is interactive or not. *) let devstring_of_plot_device = function - | Prompt_user -> "", false - | External _ -> invalid_arg "External device" - | Other_device s -> s, false - | Pdf family -> "pdf" ^ string_of_device_family family, false - | Png family -> "png" ^ string_of_device_family family , false - | Ps family -> "ps" ^ string_of_device_family family, false - | Svg family -> "svg" ^ string_of_device_family family, false - | Window family -> ( + | `prompt -> "", false + | `stream _ -> invalid_arg "External stream" + | `other_device s -> s, false + | `pdf family -> "pdf" ^ string_of_device_family family, false + | `png family -> "png" ^ string_of_device_family family , false + | `ps family -> "ps" ^ string_of_device_family family, false + | `svg family -> "svg" ^ string_of_device_family family, false + | `window family -> ( match family with - | Cairo -> "xcairo" - | Qt -> "qtwidget" - | Core -> "xwin" - | Wx -> "wxwidgets" + | `cairo -> "xcairo" + | `qt -> "qtwidget" + | `core -> "xwin" + | `wx -> "wxwidgets" ), true let recommended_extension = function - | Png _ -> ".png" - | Ps _ -> ".ps" - | Pdf _ -> ".pdf" - | Svg _ -> ".svg" - | Window _ -> invalid_arg "interactive plot device, no extension" - | External _ -> invalid_arg "external plot device, unknown extension" - | Other_device _ -> invalid_arg "other device, unknown extension" - | Prompt_user -> invalid_arg "user prompted for device, unknown extension" + | `png _ -> ".png" + | `ps _ -> ".ps" + | `pdf _ -> ".pdf" + | `svg _ -> ".svg" + | `window _ -> invalid_arg "interactive plot device, no extension" + | `stream _ -> invalid_arg "external stream, unknown extension" + | `other_device _ -> invalid_arg "other device, unknown extension" + | `prompt -> invalid_arg "user prompted for device, unknown extension" (** Make a new stream, without disturbing the current plot state. *) let make_stream ?stream () = @@ -354,23 +354,23 @@ (** Get the integer representation of the line style for use with pllsty *) let int_of_line_style = function - | Solid_line -> 1 - | Line1 -> 1 - | Line2 -> 2 - | Line3 -> 3 - | Line4 -> 4 - | Line5 -> 5 - | Line6 -> 6 - | Line7 -> 7 - | Line8 -> 8 - | Custom_line _ -> assert false + | `solid -> 1 + | `line1 -> 1 + | `line2 -> 2 + | `line3 -> 3 + | `line4 -> 4 + | `line5 -> 5 + | `line6 -> 6 + | `line7 -> 7 + | `line8 -> 8 + | `custom _ -> assert false (** Set the line drawing style *) let set_line_style ?stream style = with_stream ?stream ( fun () -> match style with - | Custom_line l -> + | `custom l -> let marks, spaces = List.split l in let marks = Array.of_list marks in let spaces = Array.of_list spaces in @@ -381,18 +381,18 @@ (** NOTE that these are for the ALTERNATE color palette, not the DEFAULT color palette. *) let int_of_color = function - | White -> 0 - | Red -> 3 - | Yellow -> 13 - | Green -> 12 - | Gray -> 10 - | Blue -> 2 - | Light_blue -> 11 - | Purple -> 15 - | Pink -> 14 - | Black -> 1 - | Brown -> 4 - | Index_color i -> i + | `white -> 0 + | `red -> 3 + | `yellow -> 13 + | `green -> 12 + | `gray -> 10 + | `blue -> 2 + | `light_blue -> 11 + | `purple -> 15 + | `pink -> 14 + | `black -> 1 + | `brown -> 4 + | `index i -> i (** Set the plotting color (color scale 0). NOTE that these are for the ALTERNATE color palette, not the DEFAULT color palette. *) @@ -419,7 +419,7 @@ with_stream ?stream ( fun () -> (* Start with a black plotting color. *) - set_color Black; + set_color `black; plenv x0 x1 y0 y1 (int_of_scaling axis_scaling) (-2); ) @@ -437,7 +437,7 @@ (* Make a new plot stream. *) let stream, init = match device with - | External stream -> make_stream ~stream (), false + | `stream stream -> make_stream ~stream (), false | _ -> make_stream (), true in (* If an external stream is provided, assume all initialization has been @@ -497,7 +497,7 @@ Arc (color, x, y, a, b, angle1, angle2, rotation, fill) (** [axes ?color ?style ?width xopt yopt] *) - let axes ?(color = Black) ?(style = Solid_line) ?(width = 1.0) ?labelfunc xopt yopt = + let axes ?(color = `black) ?(style = `solid) ?(width = 1.0) ?labelfunc xopt yopt = Axes (color, xopt, yopt, width, style, labelfunc) (** Default axes *) @@ -519,15 +519,15 @@ (** [join color (x0, y0) (x1, y1)] *) let join ?style ?width color (x0, y0) (x1, y1) = - Join (color, x0, y0, x1, y1, width |? 1.0, style |? Solid_line) + Join (color, x0, y0, x1, y1, width |? 1.0, style |? `solid) (** [label x y title] labels the axes and adds plot title *) - let label ?(color = Black) x y title = + let label ?(color = `black) x y title = Labels (color, x, y, title) (** [lines ?label color xs ys] *) let lines ?label ?style ?width color xs ys = - Lines (label, color, xs, ys, width |? 1.0, style |? Solid_line) + Lines (label, color, xs, ys, width |? 1.0, style |? `solid) (** [map ?sw ?ne color outline] *) let map ?sw ?ne color outline = @@ -550,7 +550,7 @@ let shades ?fill_width ?contour ?(rect = true) (x0, y0) (x1, y1) contours data = let cont_color, cont_width = - contour |? (Index_color 0, 0.0) + contour |? (`index 0, 0.0) in Shades ( fill_width |? 1.0, cont_color, cont_width, rect, x0, y0, x1, y1, @@ -642,17 +642,17 @@ let no_legend = No_legend let box_legend ?(pattern = 0) ?(scale = 1.0) ?(line_width = 1.0) - ?(label_color = Black) ~label color = + ?(label_color = `black) ~label color = let label_color = int_of_color label_color in let color = int_of_color color in Box_legend (color, pattern, scale, line_width, label_color, label) - let line_legend ?(style = 1) ?(width = 1.0) ?(label_color = Black) ~label color = + let line_legend ?(style = 1) ?(width = 1.0) ?(label_color = `black) ~label color = let label_color = int_of_color label_color in let color = int_of_color color in Line_legend (color, style, width, label_color, label) - let symbol_legend ?(scale = 1.0) ?(number = 3) ?(label_color = Black) ~label + let symbol_legend ?(scale = 1.0) ?(number = 3) ?(label_color = `black) ~label color symbol = let label_color = int_of_color label_color in let color = int_of_color color in @@ -663,8 +663,8 @@ let column_major x y = Column_major (x, y) type position_t = - | Viewport of unit plot_side_t option * unit plot_side_t option * float * float * bool option - | Subpage of unit plot_side_t option * unit plot_side_t option * float * float * bool option + | Viewport of side_t option * side_t option * float * float * bool option + | Subpage of side_t option * side_t option * float * float * bool option let viewport_pos ?side1 ?side2 ?inside x y = Viewport (side1, side2, x, y, inside) @@ -673,10 +673,10 @@ Subpage (side1, side2, x, y, inside) let pos_opt_of_side = function - | Right _ -> PL_POSITION_RIGHT - | Left _ -> PL_POSITION_LEFT - | Top _ -> PL_POSITION_TOP - | Bottom _ -> PL_POSITION_BOTTOM + | `right -> PL_POSITION_RIGHT + | `left -> PL_POSITION_LEFT + | `top -> PL_POSITION_TOP + | `bottom -> PL_POSITION_BOTTOM (** Convert a position_t to a low-level position definition. *) let convert_position pos_maybe = @@ -758,7 +758,7 @@ 0, 0, [] in (* Default drawing color *) - let color = color |? Black in + let color = color |? `black in (* Text on the left? *) let text_left_opt = if text_left then [PL_LEGEND_TEXT_LEFT] @@ -851,7 +851,7 @@ | Shade_colorbar of (bool * colorbar_axis_t) let default_colorbar_axis = - [Frame0; Frame1; Invert_ticks; Unconventional_label; Major_ticks; Vertical_label] + [`frame0; `frame1; `invert_ticks; `unconventional_label; `major_ticks; `vertical_label] let colorbar_axis ?(axis = default_colorbar_axis) vs = { axis_def = axis; axis_values = vs } @@ -891,10 +891,10 @@ | Some o -> begin (* TODO: Pick something better to use as a type here... *) match o with - | Right (l, w) -> w, l, [PL_COLORBAR_ORIENT_RIGHT] - | Left (l, w) -> w, l, [PL_COLORBAR_ORIENT_LEFT] - | Top (l, w) -> l, w, [PL_COLORBAR_ORIENT_TOP] - | Bottom (l, w) -> l, w, [PL_COLORBAR_ORIENT_BOTTOM] + | `right (l, w) -> w, l, [PL_COLORBAR_ORIENT_RIGHT] + | `left (l, w) -> w, l, [PL_COLORBAR_ORIENT_LEFT] + | `top (l, w) -> l, w, [PL_COLORBAR_ORIENT_TOP] + | `bottom (l, w) -> l, w, [PL_COLORBAR_ORIENT_BOTTOM] end | None -> let default_length = 0.75 in @@ -925,10 +925,10 @@ List.map ( fun p -> match p with - | Right l -> l, [PL_COLORBAR_LABEL_RIGHT] - | Left l -> l, [PL_COLORBAR_LABEL_LEFT] - | Top l -> l, [PL_COLORBAR_LABEL_TOP] - | Bottom l -> l, [PL_COLORBAR_LABEL_BOTTOM] + | `right l -> l, [PL_COLORBAR_LABEL_RIGHT] + | `left l -> l, [PL_COLORBAR_LABEL_LEFT] + | `top l -> l, [PL_COLORBAR_LABEL_TOP] + | `bottom l -> l, [PL_COLORBAR_LABEL_BOTTOM] ) l end | None -> ["", []] @@ -938,7 +938,7 @@ let labels = Array.of_list labels in let label_opts = Array.of_list label_opts in (* Color for labels, axes, etc. *) - let color = color |? Black in + let color = color |? `black in (* Values and colorbar type *) let { axis_def = main_axis; axis_values = values}, kind_opt = match kind with @@ -1027,7 +1027,7 @@ Option.may plslabelfunc labelfunc; plot_axes xopt yopt; Option.may (fun _ -> plunset_labelfunc ()) labelfunc; - set_line_style Solid_line; + set_line_style `solid; plwidth old_width; ) in @@ -1060,7 +1060,7 @@ plwidth width; set_line_style style; pljoin x0 y0 x1 y1; - set_line_style Solid_line; + set_line_style `solid; plwidth old_width; ) in @@ -1076,7 +1076,7 @@ plwidth width; set_line_style style; plline xs ys; - set_line_style Solid_line; + set_line_style `solid; plwidth old_width; ) in @@ -1143,10 +1143,10 @@ let plot_text_outside (color, s, side, displacement, just, perp) = let side_string, position = match side with - | Right p -> "r", p - | Left p -> "l", p - | Top p -> "t", p - | Bottom p -> "b", p + | `right p -> "r", p + | `left p -> "l", p + | `top p -> "t", p + | `bottom p -> "b", p in let side_string = side_string ^ if perp then "v" else "" in set_color_in color @@ -1234,8 +1234,8 @@ let y_axis = default_axis_options in Option.map_default ( fun (x_log, y_log) -> - (if x_log then Log :: x_axis else x_axis), - (if y_log then Log :: y_axis else y_axis) + (if x_log then `log :: x_axis else x_axis), + (if y_log then `log :: y_axis else y_axis) ) (x_axis, y_axis) log let maybe_line_legend names colors = @@ -1267,14 +1267,14 @@ (** [points [xs, ys; ...] plots the points described by the coordinates [xs] and [ys]. *) - let points ?filename ?size ?(device = Window Cairo) ?labels ?names ?log xs_ys_list = + let points ?filename ?size ?(device = `window `cairo) ?labels ?names ?log xs_ys_list = let xs_list, ys_list = List.split xs_ys_list in let xmin, xmax, ymin, ymax = extents xs_list ys_list in let ys_array = Array.of_list ys_list in let stream = - init ?filename ?size (xmin, ymin) (xmax, ymax) Greedy device + init ?filename ?size (xmin, ymin) (xmax, ymax) `greedy device in - let colors = Array.mapi (fun i _ -> Index_color (i + 1)) ys_array in + let colors = Array.mapi (fun i _ -> `index (i + 1)) ys_array in let symbols = Array.init (Array.length ys_array) (fun i -> sprintf "#(%03d)" (i + 135)) in @@ -1301,13 +1301,13 @@ (** [lines [xs, ys; ...] plots the line segments described by the coordinates [xs] and [ys]. *) let lines - ?filename ?size ?(device = Window Cairo) ?labels ?names ?log + ?filename ?size ?(device = `window `cairo) ?labels ?names ?log xs_ys_list = let xs_list, ys_list = List.split xs_ys_list in let xmin, xmax, ymin, ymax = extents xs_list ys_list in let ys_array = Array.of_list ys_list in - let stream = init ?filename ?size (xmin, ymin) (xmax, ymax) Greedy device in - let colors = Array.mapi (fun i _ -> Index_color (i + 1)) ys_array in + let stream = init ?filename ?size (xmin, ymin) (xmax, ymax) `greedy device in + let colors = Array.mapi (fun i _ -> `index (i + 1)) ys_array in let plottable_lines = Array.to_list ( Array.mapi ( @@ -1327,7 +1327,7 @@ (** [image ?log m] plots the image [m] with a matching colorbar. If [log] is true then the data in [m] are assumed to be log10(x) values. *) - let image ?filename ?size ?(device = Window Cairo) ?labels ?log ?palette m = + let image ?filename ?size ?(device = `window `cairo) ?labels ?log ?palette m = let m_max, m_min = plMinMax2dGrid m in let xmin, ymin = 0.0, 0.0 in let xmax, ymax = Array_ext.matrix_dims m in @@ -1336,13 +1336,13 @@ Option.map_default ( fun l -> if l then - Log :: default_colorbar_axis + `log :: default_colorbar_axis else default_colorbar_axis ) default_colorbar_axis log in let stream = - init ?filename ?size (xmin, ymin) (xmax, ymax) Equal_square device + init ?filename ?size (xmin, ymin) (xmax, ymax) `equal_square device in Option.may (load_palette ~stream) palette; plot ~stream [ @@ -1359,10 +1359,10 @@ to [x = max]. [step] can be used to tighten or coarsen the sampling of plot points. *) let func - ?filename ?size ?(device = Window Cairo) ?labels ?names ?symbol ?step + ?filename ?size ?(device = `window `cairo) ?labels ?names ?symbol ?step fs (xmin, xmax) = let fs_array = Array.of_list fs in - let colors = Array.mapi (fun i _ -> Index_color (i + 1)) fs_array in + let colors = Array.mapi (fun i _ -> `index (i + 1)) fs_array in let plot_content = Array.to_list ( Array.mapi ( @@ -1383,7 +1383,7 @@ in let ymax, ymin = plMinMax2dGrid ys in let stream = - init ?filename ?size (xmin, ymin) (xmax, ymax) Greedy device + init ?filename ?size (xmin, ymin) (xmax, ymax) `greedy device in plot ~stream [ list plot_content; @@ -1394,7 +1394,7 @@ end_stream ~stream (); () - let shades ?filename ?size ?(device = Window Cairo) ?labels ?log ?palette + let shades ?filename ?size ?(device = `window `cairo) ?labels ?log ?palette ?contours m = let xmin, ymin = 0.0, 0.0 in let xmax, ymax = Array_ext.matrix_dims m in @@ -1403,13 +1403,13 @@ Option.map_default ( fun l -> if l then - Log :: default_colorbar_axis + `log :: default_colorbar_axis else default_colorbar_axis ) default_colorbar_axis log in let stream = - init ?filename ?size (xmin, ymin) (xmax, ymax) Equal_square device + init ?filename ?size (xmin, ymin) (xmax, ymax) `equal_square device in Option.may (load_palette ~stream) palette; let contours = Modified: trunk/bindings/ocaml/plplot.mli =================================================================== --- trunk/bindings/ocaml/plplot.mli 2013-05-01 04:14:20 UTC (rev 12314) +++ trunk/bindings/ocaml/plplot.mli 2013-05-01 09:37:59 UTC (rev 12315) @@ -35,35 +35,33 @@ (** {b THIS API IS NOT FIXED AND MAY CHANGE BEFORE THE 5.10.0 RELEASE} *) + type side_t = [`top | `bottom | `left | `right] + type 'a tagged_side_t = + [`top of 'a | `bottom of 'a | `left of 'a | `right of 'a] (** The different sides of a (2D) plot. These values are used to represent, e.g., offsets along axes and text placement. *) - type 'a plot_side_t = - | Top of 'a - | Bottom of 'a - | Left of 'a - | Right of 'a (** These are the available options for drawing plot axes. These values map to individual letters provided to {!Plplot.plbox} and similar functions. *) type axis_options_t = - | Axis - | Frame0 - | Frame1 - | Time - | Fixed_point - | Major_grid - | Minor_grid - | Invert_ticks - | Log - | Unconventional_label - | Label - | Custom_label - | Minor_ticks - | Minor_tick_count of int - | Major_ticks - | Major_tick_spacing of float - | Vertical_label + [ `axis + | `frame0 + | `frame1 + | `time + | `fixed_point + | `major_grid + | `minor_grid + | `invert_ticks + | `log + | `unconventional_label + | `label + | `custom_label + | `minor_ticks + | `minor_tick_count of int + | `major_ticks + | `major_tick_spacing of float + | `vertical_label ] (** A plot stream. *) type stream_t @@ -72,25 +70,25 @@ [cmapo_alternate.pal] file! Note that these will NOT match up with colors from the default color palette! *) type color_t = - | White - | Red - | Yellow - | Green - | Gray - | Blue - | Light_blue - | Purple - | Pink - | Black - | Brown - | Index_color of int + [ `white + | `red + | `yellow + | `green + | `gray + | `blue + | `light_blue + | `purple + | `pink + | `black + | `brown + | `index of int ] (** Different map outlines available for {!map} *) type map_t = - | Globe_outline - | USA_outline - | Countries_outline - | All_outline + [ `globe + | `usa + | `countries + | `all ] (** Type signature for coordinate transform functions *) type pltr_t = float -> float -> float * float @@ -101,41 +99,41 @@ (** The different available plot device families. This is not a complete representation of all of the available devices provided by PLplot. *) type plot_device_family_t = - | Cairo - | Qt - | Core - | Wx + [ `cairo + | `qt + | `core + | `wx ] (** Plot devices. The constructor argument allows one to define which device family is used. *) type plot_device_t = - | Pdf of plot_device_family_t - | Png of plot_device_family_t - | Ps of plot_device_family_t - | Svg of plot_device_family_t - | Window of plot_device_family_t - | Prompt_user (** Ask for the correct device to use at run-time *) - | External of int (** Pre-defined plot streams *) - | Other_device of string (** PLplot plotting devices otherwise not - available from this list *) + [ `pdf of plot_device_family_t + | `png of plot_device_family_t + | `ps of plot_device_family_t + | `svg of plot_device_family_t + | `window of plot_device_family_t + | `prompt (** Ask for the correct device to use at run-time *) + | `stream of int (** Pre-defined plot streams *) + | `other_device of string ] (** PLplot plotting devices otherwise not + available from this list *) (** Type of scaling to use for plot axes, as in {!Plplot.plenv}. *) - type plot_scaling_t = Preset | Greedy | Equal | Equal_square + type plot_scaling_t = [ `preset | `greedy | `equal | `equal_square ] (** A color palette, usually loaded from disk *) type color_palette_t (** Line plotting styles/patterns. *) type line_style_t = - | Solid_line - | Line1 | Line2 | Line3 | Line4 - | Line5 | Line6 | Line7 | Line8 (** These correspond to PLplot's - pre-defined line styles as set by - {!pllsty}. *) - | Custom_line of ((int * int) list) (** A custom line style, with each - (mark, space) pair defining the - length of one segment and gap - in the line drawing pattern. *) + [ `solid + | `line1 | `line2 | `line3 | `line4 + | `line5 | `line6 | `line7 | `line8 (** These correspond to PLplot's + pre-defined line styles as set by + {!pllsty}. *) + | `custom of ((int * int) list) ] (** A custom line style, with each + (mark, space) pair defining the + length of one segment and gap + in the line drawing pattern. *) (** The default list of axis rendering options, used for all plots generated with {!init} if no custom options are provided. *) @@ -340,7 +338,7 @@ val text_outside : ?just:float -> ?perp:bool -> - color_t -> float plot_side_t -> float -> string -> plot_t + color_t -> float tagged_side_t -> float -> string -> plot_t (** [func ?symbol ?step color f (min, max)] plots the function [f] from [x = min] to [x = max]. [step] can be used to tighten or coarsen the @@ -392,13 +390,13 @@ (** Position relative to the plot viewport *) val viewport_pos : - ?side1:unit plot_side_t -> - ?side2:unit plot_side_t -> ?inside:bool -> float -> float -> position_t + ?side1:side_t -> + ?side2:side_t -> ?inside:bool -> float -> float -> position_t (** Position relative to the plot subpage *) val subpage_pos : - ?side1:unit plot_side_t -> - ?side2:unit plot_side_t -> ?inside:bool -> float -> float -> position_t + ?side1:side_t -> + ?side2:side_t -> ?inside:bool -> float -> float -> position_t (** Legend entry *) type legend_entry_t @@ -487,9 +485,9 @@ ?bb:color_t * line_style_t -> ?cap:float option * float option -> ?contour:color_t * float -> - ?orient:(float * float) plot_side_t -> + ?orient:(float * float) tagged_side_t -> ?axis:colorbar_axis_t list -> - ?label:string plot_side_t list -> + ?label:string tagged_side_t list -> ?color:color_t -> ?scale:float -> colorbar_kind_t -> plot_t Modified: trunk/examples/ocaml/xplot01.ml =================================================================== --- trunk/examples/ocaml/xplot01.ml 2013-05-01 04:14:20 UTC (rev 12314) +++ trunk/examples/ocaml/xplot01.ml 2013-05-01 09:37:59 UTC (rev 12315) @@ -69,7 +69,7 @@ (* plplot initialization *) let stream = P.init ~pre ~pages:(2, 2) (xmin, ymin) (xmax, ymax) - P.Greedy P.Prompt_user + `greedy `prompt in (* Select font set as per input flag *) @@ -80,8 +80,8 @@ (* Set up the viewport and window. The range in X is 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are scaled separately, and we just draw a labelled box. *) - P.set_color ~stream:s P.Black; - P.start_page ~stream:s (xmin, ymin) (xmax, ymax) P.Greedy; + P.set_color ~stream:s `black; + P.start_page ~stream:s (xmin, ymin) (xmax, ymax) `greedy; s ) | _ -> invalid_arg "Provide a stream or font option, not both" @@ -90,13 +90,13 @@ let xs = Array.init 6 (fun i -> x.(i * 10 + 3)) in let ys = Array.init 6 (fun i -> y.(i * 10 + 3)) in - P.set_color ~stream P.Blue; + P.set_color ~stream `blue; P.plot ~stream [ (* Plot the data points *) - P.points ~symbol:"⊙" P.Green xs ys; + P.points ~symbol:"⊙" `green xs ys; (* Draw the line through the data *) - P.lines P.Red x y; + P.lines `red x y; (* Show the axes *) P.default_axes; (* Title and axis labels *) @@ -110,10 +110,10 @@ (* Set up the viewport and window. The range in X is -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately, and we draw a box with axes. *) - P.set_color ~stream P.Black; - P.start_page ~stream (-2.0, -0.4) (10.0, 1.2) P.Greedy; + P.set_color ~stream `black; + P.start_page ~stream (-2.0, -0.4) (10.0, 1.2) `greedy; - P.set_color ~stream P.Blue; + P.set_color ~stream `blue; (* Fill up the arrays *) let x = Array.init 100 (fun i -> (float_of_int i -. 19.0) /. 6.0) in @@ -129,13 +129,13 @@ (* Show the axes *) let x_axis, y_axis = - P.Axis :: P.default_axis_options, - P.Axis :: P.default_axis_options + `axis :: P.default_axis_options, + `axis :: P.default_axis_options in (* Draw the line *) P.plot ~stream [ - P.lines ~width:2.0 P.Red x y; + P.lines ~width:2.0 `red x y; P.axes x_axis y_axis; P.label "(x)" "sin(x)/x" "#frPLplot Example 1 - Sinc Function"; ]; @@ -149,9 +149,9 @@ (* Use standard viewport, and define X range from 0 to 360 degrees, Y range from -1.2 to 1.2.*) - P.start_page ~stream (0.0, -1.2) (360.0, 1.2) P.Greedy; + P.start_page ~stream (0.0, -1.2) (360.0, 1.2) `greedy; - P.set_color ~stream P.Red; + P.set_color ~stream `red; let x = Array.init 101 (fun i -> 3.6 *. float_of_int i) in let y = Array.init 101 (fun i -> sin (x.(i) *. pi /. 180.0)) in @@ -161,20 +161,20 @@ Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. *) let x_axis, y_axis = (* x-axis *) - [P.Frame0; P.Frame1; P.Label; P.Minor_ticks; P.Major_tick_spacing 60.0], + [`frame0; `frame1; `label; `minor_ticks; `major_tick_spacing 60.0], (* y-axis *) [ - P.Frame0; P.Frame1; P.Label; P.Minor_ticks; P.Major_tick_spacing 0.2; - P.Vertical_label + `frame0; `frame1; `label; `minor_ticks; `major_tick_spacing 0.2; + `vertical_label ] in P.plot ~stream [ (* Superimpose a dashed line grid, with 1.5 mm marks and spaces. *) - P.axes ~color:P.Yellow ~style:(P.Custom_line [mark1, space1]) - [P.Major_grid; P.Major_tick_spacing 30.0] - [P.Major_grid; P.Major_tick_spacing 0.2]; - P.lines P.Brown x y; + P.axes ~color:`yellow ~style:(`custom [mark1, space1]) + [`major_grid; `major_tick_spacing 30.0] + [`major_grid; `major_tick_spacing 0.2]; + P.lines `brown x y; (* The normal plot axes *) P.axes x_axis y_axis; (* Plot title and axis labels *) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2013-05-02 01:20:35
|
Revision: 12320 http://sourceforge.net/p/plplot/code/12320 Author: arjenmarkus Date: 2013-05-02 01:20:31 +0000 (Thu, 02 May 2013) Log Message: ----------- Propagate the API changes to pllegend and plshade(s) to the Fortran bindings. The examples that are affected produce the same PostScript files as their C equivalents - excepting x16 because of the colour bars. Modified Paths: -------------- trunk/bindings/f95/sccont.c trunk/bindings/f95/scstubs.c trunk/bindings/f95/sfstubs.f90 trunk/bindings/f95/sfstubsf95.f90 trunk/examples/f95/x04f.f90 trunk/examples/f95/x15f.f90 trunk/examples/f95/x16af.f90 trunk/examples/f95/x16f.f90 trunk/examples/f95/x21f.f90 trunk/examples/f95/x26f.f90 trunk/examples/f95/x33f.f90 Modified: trunk/bindings/f95/sccont.c =================================================================== --- trunk/bindings/f95/sccont.c 2013-05-01 21:51:24 UTC (rev 12319) +++ trunk/bindings/f95/sccont.c 2013-05-02 01:20:31 UTC (rev 12320) @@ -47,47 +47,47 @@ void PLSHADE07( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined, PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, PLFLT *shade_min, PLFLT *shade_max, - PLINT *sh_cmap, PLFLT *sh_color, PLINT *sh_width, - PLINT *min_color, PLINT *min_width, - PLINT *max_color, PLINT *max_width, PLINT *lx ); + PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width, + PLINT *min_color, PLFLT *min_width, + PLINT *max_color, PLFLT *max_width, PLINT *lx ); void PLSHADE17( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined, PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, PLFLT *shade_min, PLFLT *shade_max, - PLINT *sh_cmap, PLFLT *sh_color, PLINT *sh_width, - PLINT *min_color, PLINT *min_width, - PLINT *max_color, PLINT *max_width, + PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width, + PLINT *min_color, PLFLT *min_width, + PLINT *max_color, PLFLT *max_width, PLFLT *xg1, PLFLT *yg1, PLINT *lx ); void PLSHADE27( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined, PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, PLFLT *shade_min, PLFLT *shade_max, - PLINT *sh_cmap, PLFLT *sh_color, PLINT *sh_width, - PLINT *min_color, PLINT *min_width, - PLINT *max_color, PLINT *max_width, + PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width, + PLINT *min_color, PLFLT *min_width, + PLINT *max_color, PLFLT *max_width, PLFLT *xg2, PLFLT *yg2, PLINT *lx ); void PLSHADE7( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined, PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, PLFLT *shade_min, PLFLT *shade_max, - PLINT *sh_cmap, PLFLT *sh_color, PLINT *sh_width, - PLINT *min_color, PLINT *min_width, - PLINT *max_color, PLINT *max_width, PLFLT *ftr, PLINT *lx ); + PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width, + PLINT *min_color, PLFLT *min_width, + PLINT *max_color, PLFLT *max_width, PLFLT *ftr, PLINT *lx ); void PLSHADES07( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined, PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, - PLFLT *clevel, PLINT *nlevel, PLINT *fill_width, - PLINT *cont_color, PLINT *cont_width, PLINT *lx ); + PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width, + PLINT *cont_color, PLFLT *cont_width, PLINT *lx ); void PLSHADES17( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined, PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, - PLFLT *clevel, PLINT *nlevel, PLINT *fill_width, - PLINT *cont_color, PLINT *cont_width, + PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width, + PLINT *cont_color, PLFLT *cont_width, PLFLT *xg1, PLFLT *yg1, PLINT *lx ); void PLSHADES27( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined, PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, - PLFLT *clevel, PLINT *nlevel, PLINT *fill_width, - PLINT *cont_color, PLINT *cont_width, + PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width, + PLINT *cont_color, PLFLT *cont_width, PLFLT *xg2, PLFLT *yg2, PLINT *lx ); void PLSHADES7( PLFLT *z, PLINT *nx, PLINT *ny, const char *defined, PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, - PLFLT *clevel, PLINT *nlevel, PLINT *fill_width, - PLINT *cont_color, PLINT *cont_width, PLFLT *ftr, PLINT *lx ); + PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width, + PLINT *cont_color, PLFLT *cont_width, PLFLT *ftr, PLINT *lx ); void PLGRIDDATA( PLFLT *x, PLFLT *y, PLFLT *z, PLINT *npts, PLFLT *xg, PLINT *nx, PLFLT *yg, PLINT *ny, PLFLT *zg, PLINT *type, PLFLT *data ); @@ -356,9 +356,9 @@ PLSHADE07( PLFLT *z, PLINT *nx, PLINT *ny, const char *PL_UNUSED( defined ), PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, PLFLT *shade_min, PLFLT *shade_max, - PLINT *sh_cmap, PLFLT *sh_color, PLINT *sh_width, - PLINT *min_color, PLINT *min_width, - PLINT *max_color, PLINT *max_width, PLINT *lx ) + PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width, + PLINT *min_color, PLFLT *min_width, + PLINT *max_color, PLFLT *max_width, PLINT *lx ) { PLINT rect = 1; PLFLT ** a; @@ -392,9 +392,9 @@ PLSHADE17( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ), PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, PLFLT *shade_min, PLFLT *shade_max, - PLINT *sh_cmap, PLFLT *sh_color, PLINT *sh_width, - PLINT *min_color, PLINT *min_width, - PLINT *max_color, PLINT *max_width, + PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width, + PLINT *min_color, PLFLT *min_width, + PLINT *max_color, PLFLT *max_width, PLFLT *xg1, PLFLT *yg1, PLINT *lx ) { PLINT rect = 1; @@ -433,9 +433,9 @@ PLSHADE27( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ), PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, PLFLT *shade_min, PLFLT *shade_max, - PLINT *sh_cmap, PLFLT *sh_color, PLINT *sh_width, - PLINT *min_color, PLINT *min_width, - PLINT *max_color, PLINT *max_width, + PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width, + PLINT *min_color, PLFLT *min_width, + PLINT *max_color, PLFLT *max_width, PLFLT *xg2, PLFLT *yg2, PLINT *lx ) { PLINT rect = 0; @@ -476,9 +476,9 @@ PLSHADE7( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ), PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, PLFLT *shade_min, PLFLT *shade_max, - PLINT *sh_cmap, PLFLT *sh_color, PLINT *sh_width, - PLINT *min_color, PLINT *min_width, - PLINT *max_color, PLINT *max_width, PLFLT *ftr, PLINT *lx ) + PLINT *sh_cmap, PLFLT *sh_color, PLFLT *sh_width, + PLINT *min_color, PLFLT *min_width, + PLINT *max_color, PLFLT *max_width, PLFLT *ftr, PLINT *lx ) { PLINT rect = 1; PLFLT ** a; @@ -518,8 +518,8 @@ void PLSHADES07( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ), PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, - PLFLT *clevel, PLINT *nlevel, PLINT *fill_width, - PLINT *cont_color, PLINT *cont_width, PLINT *lx ) + PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width, + PLINT *cont_color, PLFLT *cont_width, PLINT *lx ) { PLINT rect = 1; PLFLT ** a; @@ -548,8 +548,8 @@ void PLSHADES17( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ), PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, - PLFLT *clevel, PLINT *nlevel, PLINT *fill_width, - PLINT *cont_color, PLINT *cont_width, + PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width, + PLINT *cont_color, PLFLT *cont_width, PLFLT *xg1, PLFLT *yg1, PLINT *lx ) { PLINT rect = 1; @@ -585,8 +585,8 @@ void PLSHADES27( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ), PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, - PLFLT *clevel, PLINT *nlevel, PLINT *fill_width, - PLINT *cont_color, PLINT *cont_width, + PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width, + PLINT *cont_color, PLFLT *cont_width, PLFLT *xg2, PLFLT *yg2, PLINT *lx ) { PLINT rect = 0; @@ -625,8 +625,8 @@ void PLSHADES7( PLFLT *z, PLINT *nx, PLINT *ny, const char * PL_UNUSED( defined ), PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax, - PLFLT *clevel, PLINT *nlevel, PLINT *fill_width, - PLINT *cont_color, PLINT *cont_width, PLFLT *ftr, PLINT *lx ) + PLFLT *clevel, PLINT *nlevel, PLFLT *fill_width, + PLINT *cont_color, PLFLT *cont_width, PLFLT *ftr, PLINT *lx ) { PLINT rect = 1; PLFLT ** a; Modified: trunk/bindings/f95/scstubs.c =================================================================== --- trunk/bindings/f95/scstubs.c 2013-05-01 21:51:24 UTC (rev 12319) +++ trunk/bindings/f95/scstubs.c 2013-05-02 01:20:31 UTC (rev 12320) @@ -138,9 +138,9 @@ PLFLT *text_justification, const PLINT *text_colors, const PLINT *box_colors, const PLINT *box_patterns, - const PLFLT *box_scales, const PLINT *box_line_widths, + const PLFLT *box_scales, const PLFLT *box_line_widths, const PLINT *line_colors, const PLINT *line_styles, - const PLINT *line_widths, + const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers ); void PLLIGHTSOURCE( PLFLT *x, PLFLT *y, PLFLT *z ); @@ -816,9 +816,9 @@ PLFLT *text_justification, const PLINT *text_colors, const PLINT *box_colors, const PLINT *box_patterns, - const PLFLT *box_scales, const PLINT *box_line_widths, + const PLFLT *box_scales, const PLFLT *box_line_widths, const PLINT *line_colors, const PLINT *line_styles, - const PLINT *line_widths, + const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers ) { Modified: trunk/bindings/f95/sfstubs.f90 =================================================================== --- trunk/bindings/f95/sfstubs.f90 2013-05-01 21:51:24 UTC (rev 12319) +++ trunk/bindings/f95/sfstubs.f90 2013-05-02 01:20:31 UTC (rev 12320) @@ -396,8 +396,9 @@ implicit none character defined*(*) - integer sh_cmap, sh_width - integer min_color, min_width, max_color, max_width + integer sh_cmap + integer min_color, max_color + real(kind=plflt) sh_width, min_width, max_width real(kind=plflt) shade_min, shade_max, sh_color real(kind=plflt) z(:,:), xmin, xmax, ymin, ymax @@ -423,8 +424,9 @@ implicit none character defined*(*) - integer sh_cmap, sh_width - integer min_color, min_width, max_color, max_width + integer sh_cmap + integer min_color, max_color + real(kind=plflt) sh_width, min_width, max_width real(kind=plflt) shade_min, shade_max, sh_color real(kind=plflt) z(:,:), xmin, xmax, ymin, ymax, xg(:), yg(:) @@ -451,8 +453,9 @@ implicit none character defined*(*) - integer sh_cmap, sh_width - integer min_color, min_width, max_color, max_width + integer sh_cmap + integer min_color, max_color + real(kind=plflt) sh_width, min_width, max_width real(kind=plflt) shade_min, shade_max, sh_color real(kind=plflt) z(:,:), xmin, xmax, ymin, ymax, xg(:,:), yg(:,:) @@ -478,8 +481,9 @@ implicit none character(len=*) defined - integer sh_cmap, sh_width - integer min_color, min_width, max_color, max_width + integer sh_cmap + integer min_color, max_color + real(kind=plflt) sh_width, min_width, max_width real(kind=plflt) shade_min, shade_max, sh_color real(kind=plflt) z(:,:), xmin, xmax, ymin, ymax real(kind=plflt) tr(6) @@ -502,7 +506,8 @@ implicit none character defined*(*) - integer fill_width, cont_color, cont_width + integer cont_color + real(kind=plflt) fill_width, cont_width real(kind=plflt) clevel(:) real(kind=plflt) z(:,:), xmin, xmax, ymin, ymax @@ -525,7 +530,8 @@ implicit none character defined*(*) - integer fill_width, cont_color, cont_width + integer cont_color + real(kind=plflt) fill_width, cont_width real(kind=plflt) clevel(:) real(kind=plflt) z(:,:), xmin, xmax, ymin, ymax, & xg1(:), yg1(:) @@ -549,7 +555,8 @@ implicit none character defined*(*) - integer fill_width, cont_color, cont_width + integer cont_color + real(kind=plflt)fill_width, cont_width real(kind=plflt) clevel(:) real(kind=plflt) z(:,:), xmin, xmax, ymin, ymax, & xg2(:,:), yg2(:,:) @@ -573,7 +580,8 @@ implicit none character defined*(*) - integer fill_width, cont_color, cont_width + integer cont_color + real(kind=plflt) fill_width, cont_width real(kind=plflt) clevel(:) real(kind=plflt) z(:,:), xmin, xmax, ymin, ymax real(kind=plflt) tr(6) Modified: trunk/bindings/f95/sfstubsf95.f90 =================================================================== --- trunk/bindings/f95/sfstubsf95.f90 2013-05-01 21:51:24 UTC (rev 12319) +++ trunk/bindings/f95/sfstubsf95.f90 2013-05-02 01:20:31 UTC (rev 12320) @@ -1099,8 +1099,10 @@ character(len=*), dimension(:) :: text, symbols integer, dimension(:) :: opt_array, text_colors, box_colors - integer, dimension(:) :: box_patterns, box_line_widths - integer, dimension(:) :: line_colors, line_styles, line_widths + integer, dimension(:) :: box_patterns + real(kind=plflt), dimension(:) :: box_line_widths + integer, dimension(:) :: line_colors, line_styles + real(kind=plflt), dimension(:) :: line_widths integer, dimension(:) :: symbol_colors, symbol_numbers real(kind=plflt), dimension(:) :: box_scales, symbol_scales @@ -1145,8 +1147,10 @@ character(len=*), dimension(:) :: text, symbols integer, dimension(:) :: opt_array, text_colors, box_colors - integer, dimension(:) :: box_patterns, box_line_widths - integer, dimension(:) :: line_colors, line_styles, line_widths + integer, dimension(:) :: box_patterns + real(kind=plflt), dimension(:) :: box_line_widths + integer, dimension(:) :: line_colors, line_styles + real(kind=plflt), dimension(:) :: line_widths integer, dimension(:) :: symbol_colors, symbol_numbers real(kind=plflt), dimension(:) :: box_scales, symbol_scales Modified: trunk/examples/f95/x04f.f90 =================================================================== --- trunk/examples/f95/x04f.f90 2013-05-01 21:51:24 UTC (rev 12319) +++ trunk/examples/f95/x04f.f90 2013-05-02 01:20:31 UTC (rev 12320) @@ -43,11 +43,10 @@ real(kind=plflt) :: legend_width, legend_height integer :: opt_array(2), text_colors(2), line_colors(2), & - line_styles(2), line_widths(2), symbol_colors(2), & - symbol_numbers(2) - real(kind=plflt) :: symbol_scales(2), box_scales(0) + line_styles(2), symbol_colors(2), symbol_numbers(2) + real(kind=plflt) :: line_widths(2), symbol_scales(2), box_scales(0) integer :: box_colors(0), box_patterns(0) - integer :: box_line_widths(0) + real(kind=plflt) :: box_line_widths(0) character(len=20) :: text(2) character(len=1) :: symbols(2) Modified: trunk/examples/f95/x15f.f90 =================================================================== --- trunk/examples/f95/x15f.f90 2013-05-01 21:51:24 UTC (rev 12319) +++ trunk/examples/f95/x15f.f90 2013-05-02 01:20:31 UTC (rev 12320) @@ -160,8 +160,9 @@ character(len=1) undefined real(kind=plflt) shade_min, shade_max, sh_color - integer sh_cmap, sh_width - integer min_color, min_width, max_color, max_width + integer sh_cmap + integer min_color, max_color + real(kind=plflt) sh_width, min_width, max_width sh_cmap = 0 min_color = 0 @@ -216,22 +217,23 @@ character(len=1) undefined real(kind=plflt) shade_min, shade_max, sh_color - integer sh_cmap, sh_width - integer min_color, min_width, max_color, max_width + integer sh_cmap + integer min_color, max_color + real(kind=plflt) sh_width, min_width, max_width integer i, j integer nlin(10), inc(2,10), del(2,10) data nlin /1, 1, 1, 1, 1, 2, 2, 2, 2, 2/ data ( (inc(i,j), i=1,2), j=1,10) / & 450, 0, -450, 0, 0, 0, 900, 0, & - 300, 0, 450,-450, 0, 900, 0, 450, & + 300, 0, 450,-450, 0, 900, 0, 450, & 450, -450, 0, 900/ data ( (del(i,j), i=1,2), j=1,10) / & 2000, 2000, 2000, 2000, 2000, 2000, & 2000, 2000, 2000, 2000, 2000, 2000, & 2000, 2000, 2000, 2000, 4000, 4000, & 4000, 2000/ - + sh_cmap = 0 min_color = 0 min_width = 0 @@ -267,8 +269,8 @@ !-------------------------------------------------------------------------- ! plot3 ! -! Illustrates shaded regions in 3d, using a different fill pattern for -! each region. +! Illustrates shaded regions in 3d, using a different fill pattern for +! each region. !-------------------------------------------------------------------------- subroutine plot3 @@ -289,8 +291,8 @@ call plw3d(1._plflt, 1._plflt, 1._plflt, -1.0_plflt, 1.0_plflt, & -1.0_plflt, 1.0_plflt, 0.0_plflt,1.5_plflt, 30._plflt, -40._plflt) -! Plot using identity transform - +! Plot using identity transform + call plcol0(1) call plbox3("bntu", "X", 0.0_plflt, 0, "bntu", "Y", 0.0_plflt, 0, & "bcdfntu", "Z", 0.5_plflt, 0) Modified: trunk/examples/f95/x16af.f90 =================================================================== --- trunk/examples/f95/x16af.f90 2013-05-01 21:51:24 UTC (rev 12319) +++ trunk/examples/f95/x16af.f90 2013-05-02 01:20:31 UTC (rev 12320) @@ -57,8 +57,9 @@ real(kind=plflt) z(xdim, ydim), w(xdim, ydim), clevel(NCONTR) real(kind=plflt) xmin, xmax, ymin, ymax, zmin, zmax, x, y real(kind=plflt) shade_min, shade_max, sh_color - integer i, j, sh_cmap, sh_width - integer min_color, min_width, max_color, max_width + integer i, j, sh_cmap + integer min_color, max_color + real(kind=plflt) sh_width, min_width, max_width xmin = -1._plflt ymin = -1._plflt @@ -145,8 +146,9 @@ integer nxsub, nysub integer ncolbox, ncollab integer i, j, kx, lx, ky, ly - integer sh_cmap, sh_width - integer min_color, min_width, max_color, max_width + integer sh_cmap + integer min_color, max_color + real(kind=plflt) sh_width, min_width, max_width character(len=8) xopt, yopt ! Set up for plshade call Modified: trunk/examples/f95/x16f.f90 =================================================================== --- trunk/examples/f95/x16f.f90 2013-05-01 21:51:24 UTC (rev 12319) +++ trunk/examples/f95/x16f.f90 2013-05-02 01:20:31 UTC (rev 12320) @@ -33,7 +33,8 @@ z(xdim,ydim), w(xdim,ydim), xg1(xdim), yg1(ydim), & xg2(xdim,ydim), yg2(xdim,ydim), zmin, zmax, & px(PERIMETERPTS), py(PERIMETERPTS) - integer fill_width, cont_color, cont_width + integer cont_color + real(kind=plflt) fill_width, cont_width integer i, j ! dummy to fill argument list with something not currently used. character(len=1) defined Modified: trunk/examples/f95/x21f.f90 =================================================================== --- trunk/examples/f95/x21f.f90 2013-05-01 21:51:24 UTC (rev 12319) +++ trunk/examples/f95/x21f.f90 2013-05-02 01:20:31 UTC (rev 12320) @@ -40,7 +40,7 @@ parameter (rosen = 0) real(kind=plflt) xmin, xmax, ymin, ymax - + real(kind=plflt) x(pts), y(pts), z(pts), clev(nl) real(kind=plflt) xg(xp), yg(yp), zg(xp,yp) real(kind=plflt) zmin, zmax, lzmin, lzmax @@ -102,7 +102,7 @@ z(i) = log((1._plflt-x(i))**2 + 100._plflt*(y(i)-x(i)**2)**2) endif enddo - + zmin = z(1) zmax = z(1) do i=2,pts @@ -116,7 +116,7 @@ do i=1,yp yg(i) = ymin + (ymax-ymin)*(i-1._plflt)/(yp-1._plflt) enddo - + call plcol0(1) call plenv(xmin, xmax, ymin, ymax, 2, 0) call plcol0(15) @@ -158,15 +158,15 @@ if ((alg.eq.GRID_CSA).or.(alg.eq.GRID_DTLI).or. & (alg.eq.GRID_NNLI).or.(alg.eq.GRID_NNI)) then - + do i=1,xp do j=1,yp if (myisnan(zg(i,j))) then ! average (IDW) over the 8 neighbors - + zg(i,j) = 0._plflt dist = 0._plflt - + ii=i-1 do while ((ii.le.i+1).and.(ii.le.xp)) jj = j-1 @@ -194,7 +194,7 @@ enddo enddo endif - + call a2mnmx(zg, xp, yp, lzmin, lzmax, xp) lzmin = min(lzmin, zmin) @@ -205,9 +205,9 @@ call plcol0(1) call pladv(alg) - + if (k.eq.1) then - + do i=1,nl clev(i) = lzmin + (lzmax-lzmin)/(nl-1._plflt)*(i-1._plflt) enddo @@ -215,23 +215,23 @@ call plcol0(15) call pllab("X", "Y", title(alg)) call plshades(zg, defined, xmin, xmax, ymin, & - ymax, clev, 1, 0, 1) + ymax, clev, 1._plflt, 0, 1._plflt) call plcol0(2) else - + do i = 1,nl clev(i) = lzmin + (lzmax-lzmin)/(nl-1._plflt)*(i-1._plflt) enddo call plvpor(0._plflt, 1._plflt, 0._plflt, 0.9_plflt) call plwind(-1.1_plflt, 0.75_plflt, -0.65_plflt, 1.20_plflt) -! +! ! For the comparison to be fair, all plots should have the ! same z values, but to get the max/min of the data generated ! by all algorithms would imply two passes. Keep it simple. ! ! plw3d(1., 1., 1., xmin, xmax, ymin, ymax, zmin, zmax, 30, -60); ! - + call plw3d(1._plflt, 1._plflt, 1._plflt, xmin, xmax, ymin, ymax, & lzmin, lzmax, 30._plflt, -40._plflt) call plbox3("bntu", "X", 0._plflt, 0, & @@ -246,26 +246,26 @@ enddo call plend - + end subroutine cmap1_init use plplot implicit none real(kind=plflt) i(2), h(2), l(2), s(2) - + i(1) = 0._plflt i(2) = 1._plflt - + h(1) = 240._plflt h(2) = 0._plflt - + l(1) = 0.6_plflt l(2) = 0.6_plflt - + s(1) = 0.8_plflt s(2) = 0.8_plflt - + call plscmap1n(256) call plscmap1l(.false., i, h, l, s) end subroutine cmap1_init @@ -281,7 +281,7 @@ integer i, j, nx, ny, xdim real(kind=plflt) f(xdim, ny), fmin, fmax - + fmax = f(1, 1) fmin = fmax do j = 1, ny Modified: trunk/examples/f95/x26f.f90 =================================================================== --- trunk/examples/f95/x26f.f90 2013-05-01 21:51:24 UTC (rev 12319) +++ trunk/examples/f95/x26f.f90 2013-05-02 01:20:31 UTC (rev 12320) @@ -155,13 +155,13 @@ integer text_colors(nlegend) integer line_colors(nlegend) integer line_styles(nlegend) - integer line_widths(nlegend) + real(kind=plflt) line_widths(nlegend) integer symbol_numbers(nlegend) integer symbol_colors(nlegend) real(kind=plflt) symbol_scales(nlegend) character(len=20) symbols(nlegend) - integer box_colors(0), box_patterns(0), box_line_widths(0) - real(kind=plflt) box_scales(0) + integer box_colors(0), box_patterns(0) + real(kind=plflt) box_scales(0), box_line_widths(0) real(kind=plflt) legend_width, legend_height call pladv(0) Modified: trunk/examples/f95/x33f.f90 =================================================================== --- trunk/examples/f95/x33f.f90 2013-05-01 21:51:24 UTC (rev 12319) +++ trunk/examples/f95/x33f.f90 2013-05-02 01:20:31 UTC (rev 12320) @@ -51,10 +51,10 @@ integer :: box_colors(MAX_NLEGEND) integer :: box_patterns(MAX_NLEGEND) real(kind=plflt) :: box_scales(MAX_NLEGEND) - integer :: box_line_widths(MAX_NLEGEND) + real(kind=plflt) :: box_line_widths(MAX_NLEGEND) integer :: line_colors(MAX_NLEGEND) integer :: line_styles(MAX_NLEGEND) - integer :: line_widths(MAX_NLEGEND) + real(kind=plflt) :: line_widths(MAX_NLEGEND) integer :: symbol_numbers(MAX_NLEGEND), symbol_colors(MAX_NLEGEND) real(kind=plflt) :: symbol_scales(MAX_NLEGEND) character(len=200) :: text(MAX_NLEGEND) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2013-05-02 10:25:46
|
Revision: 12322 http://sourceforge.net/p/plplot/code/12322 Author: arjenmarkus Date: 2013-05-02 10:25:42 +0000 (Thu, 02 May 2013) Log Message: ----------- Propagate the changes in the API to Tcl and Tcl-related bindings. Enabling these bindings by default. Modified Paths: -------------- trunk/bindings/tcl/plapi.tpl trunk/bindings/tcl/tclAPI.c trunk/cmake/modules/tcl-related.cmake trunk/examples/tcl/x04.tcl trunk/examples/tcl/x15.tcl trunk/examples/tcl/x16.tcl trunk/examples/tcl/x21.tcl trunk/examples/tcl/x26.tcl trunk/examples/tcl/x33.tcl Modified: trunk/bindings/tcl/plapi.tpl =================================================================== --- trunk/bindings/tcl/plapi.tpl 2013-05-02 01:24:58 UTC (rev 12321) +++ trunk/bindings/tcl/plapi.tpl 2013-05-02 10:25:42 UTC (rev 12322) @@ -1061,7 +1061,7 @@ # Set pen width. pltclcmd plwidth void -width PLINT +width PLFLT # Set up world coordinates of the viewport boundaries (2d plots). Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2013-05-02 01:24:58 UTC (rev 12321) +++ trunk/bindings/tcl/tclAPI.c 2013-05-02 10:25:42 UTC (rev 12322) @@ -2595,8 +2595,10 @@ PLFLT **z, **zused, **zwrapped; PLFLT xmin, xmax, ymin, ymax, sh_min, sh_max, sh_col; - PLINT sh_cmap = 1, sh_wid = 2; - PLINT min_col = 1, min_wid = 0, max_col = 0, max_wid = 0; + PLINT sh_cmap = 1; + PLFLT sh_wid = 2.; + PLINT min_col = 1, max_col = 0; + PLFLT min_wid = 0., max_wid = 0.; PLINT rect = 1; const char *pltrname = "pltr0"; void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ); @@ -2647,11 +2649,11 @@ sh_max = atof( argv[7] ); sh_cmap = atoi( argv[8] ); sh_col = atof( argv[9] ); - sh_wid = atoi( argv[10] ); + sh_wid = atof( argv[10] ); min_col = atoi( argv[11] ); min_wid = atoi( argv[12] ); max_col = atoi( argv[13] ); - max_wid = atoi( argv[14] ); + max_wid = atof( argv[14] ); rect = atoi( argv[15] ); argc -= 16, argv += 16; @@ -2916,7 +2918,8 @@ tclMatrix *matclevel = NULL; PLFLT **z, **zused, **zwrapped; PLFLT xmin, xmax, ymin, ymax; - PLINT fill_width = 0, cont_color = 0, cont_width = 0; + PLINT cont_color = 0; + PLFLT fill_width = 0., cont_width = 0.; PLINT rect = 1; const char *pltrname = "pltr0"; void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ); @@ -2974,9 +2977,9 @@ return TCL_ERROR; } - fill_width = atoi( argv[7] ); + fill_width = atof( argv[7] ); cont_color = atoi( argv[8] ); - cont_width = atoi( argv[9] ); + cont_width = atof( argv[9] ); rect = atoi( argv[10] ); argc -= 11, argv += 11; @@ -4134,7 +4137,8 @@ PLINT *text_colors; PLINT *box_colors, *box_patterns; PLFLT *box_scales; - PLINT *box_line_widths, *line_colors, *line_styles, *line_widths; + PLINT *line_colors, *line_styles; + PLFLT *box_line_widths, *line_widths; PLINT *symbol_colors, *symbol_numbers; PLFLT *symbol_scales; char **text; @@ -4175,10 +4179,10 @@ box_colors = argv_to_ints( interp, argv[18], &dummy ); box_patterns = argv_to_ints( interp, argv[19], &dummy ); box_scales = argv_to_doubles( interp, argv[20], &dummy ); - box_line_widths = argv_to_ints( interp, argv[21], &dummy ); + box_line_widths = argv_to_doubles( interp, argv[21], &dummy ); line_colors = argv_to_ints( interp, argv[22], &dummy ); line_styles = argv_to_ints( interp, argv[23], &dummy ); - line_widths = argv_to_ints( interp, argv[24], &dummy ); + line_widths = argv_to_doubles( interp, argv[24], &dummy ); symbol_colors = argv_to_ints( interp, argv[25], &dummy ); symbol_scales = argv_to_doubles( interp, argv[26], &dummy ); symbol_numbers = argv_to_ints( interp, argv[27], &dummy ); Modified: trunk/cmake/modules/tcl-related.cmake =================================================================== --- trunk/cmake/modules/tcl-related.cmake 2013-05-02 01:24:58 UTC (rev 12321) +++ trunk/cmake/modules/tcl-related.cmake 2013-05-02 10:25:42 UTC (rev 12322) @@ -26,10 +26,10 @@ option(ENABLE_tk "Enable Tk interface code" OFF) option(ENABLE_itk "Enable incr TK interface code" OFF) else(DEFAULT_NO_BINDINGS) - option(ENABLE_tcl "Enable Tcl bindings" OFF) - option(ENABLE_itcl "Enable incr Tcl interface code" OFF) - option(ENABLE_tk "Enable Tk interface code" OFF) - option(ENABLE_itk "Enable incr TK interface code" OFF) + option(ENABLE_tcl "Enable Tcl bindings" ON) + option(ENABLE_itcl "Enable incr Tcl interface code" ON) + option(ENABLE_tk "Enable Tk interface code" ON) + option(ENABLE_itk "Enable incr TK interface code" ON) endif(DEFAULT_NO_BINDINGS) # Depending on these above options and system resources may also determine Modified: trunk/examples/tcl/x04.tcl =================================================================== --- trunk/examples/tcl/x04.tcl 2013-05-02 01:24:58 UTC (rev 12321) +++ trunk/examples/tcl/x04.tcl 2013-05-02 10:25:42 UTC (rev 12322) @@ -79,7 +79,7 @@ set text [list Amplitude] set line_colors [list 2] set line_styles [list 1] - set line_widths [list 1] + set line_widths [list 1.0] # note from the above opt_array the first symbol (and box) indices # will not be used, but they have to be specified anyway! Modified: trunk/examples/tcl/x15.tcl =================================================================== --- trunk/examples/tcl/x15.tcl 2013-05-02 01:24:58 UTC (rev 12321) +++ trunk/examples/tcl/x15.tcl 2013-05-02 10:25:42 UTC (rev 12322) @@ -73,8 +73,8 @@ set sh_width 2 set min_color 9 set max_color 2 - set min_width 2 - set max_width 2 + set min_width 2. + set max_width 2. # N.B. this flag set to use cmap0 set sh_cmap 0 @@ -101,8 +101,8 @@ set sh_width 2 set min_color 0 set max_color 0 - set min_width 0 - set max_width 0 + set min_width 0. + set max_width 0. # N.B. this flag set to use cmap0 set sh_cmap 0 Modified: trunk/examples/tcl/x16.tcl =================================================================== --- trunk/examples/tcl/x16.tcl 2013-05-02 01:24:58 UTC (rev 12321) +++ trunk/examples/tcl/x16.tcl 2013-05-02 10:25:42 UTC (rev 12322) @@ -10,7 +10,7 @@ set nx 35 set ny 46 - set fill_width 2; set cont_color 0; set cont_width 0 + set fill_width 2.; set cont_color 0; set cont_width 0. matrix clevel f $ns matrix shedge f [expr $ns+1] Modified: trunk/examples/tcl/x21.tcl =================================================================== --- trunk/examples/tcl/x21.tcl 2013-05-02 01:24:58 UTC (rev 12321) +++ trunk/examples/tcl/x21.tcl 2013-05-02 10:25:42 UTC (rev 12322) @@ -209,7 +209,7 @@ $w cmd plenv0 $xmin $xmax $ymin $ymax 2 0 $w cmd plcol0 15 $w cmd pllab "X" "Y" [lindex $title $alg] - $w cmd plshades zg $xmin $xmax $ymin $ymax clev 1 0 1 1 "NULL" + $w cmd plshades zg $xmin $xmax $ymin $ymax clev 1. 0 1. 1 "NULL" $w cmd plcol0 2 } else { Modified: trunk/examples/tcl/x26.tcl =================================================================== --- trunk/examples/tcl/x26.tcl 2013-05-02 01:24:58 UTC (rev 12321) +++ trunk/examples/tcl/x26.tcl 2013-05-02 10:25:42 UTC (rev 12322) @@ -192,7 +192,7 @@ set text_colors [list 2] set line_colors [list 2] set line_styles [list 1] - set line_widths [list 1] + set line_widths [list 1.] # note from the above opt_array the first symbol (and box) indices # will not be used, but they have to be specified anyway! # (make sure the values are reasonable) @@ -202,7 +202,7 @@ lappend text_colors 3 lappend line_colors 3 lappend line_styles 1 - lappend line_widths 1 + lappend line_widths 1. set symbol_colors [list 0 3] set symbol_scales [list 0.0 1.] set symbol_numbers [list 0 4] Modified: trunk/examples/tcl/x33.tcl =================================================================== --- trunk/examples/tcl/x33.tcl 2013-05-02 01:24:58 UTC (rev 12321) +++ trunk/examples/tcl/x33.tcl 2013-05-02 10:25:42 UTC (rev 12322) @@ -111,7 +111,7 @@ set opt_base [expr {$::PLPLOT::PL_LEGEND_BACKGROUND | $::PLPLOT::PL_LEGEND_BOUNDING_BOX}] set opt_array [list [expr {$::PLPLOT::PL_LEGEND_LINE | $::PLPLOT::PL_LEGEND_SYMBOL}]] set line_styles [list 1] - set line_widths [list 1] + set line_widths [list 1.] set symbol_scales [list 1.] set symbol_numbers [list 4] set symbols [list "*"] @@ -165,7 +165,7 @@ for {set k 0} {$k < $nlegend} {incr k} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_LINE | $::PLPLOT::PL_LEGEND_SYMBOL}] lappend line_styles 1 - lappend line_widths 1 + lappend line_widths 1. lappend symbol_scales 1. lappend symbol_numbers 2 lappend symbols "*" @@ -314,7 +314,7 @@ for {set k 0} {$k < $nlegend} {incr k} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_LINE | $::PLPLOT::PL_LEGEND_SYMBOL}] lappend line_styles 1 - lappend line_widths 1 + lappend line_widths 1. lappend symbol_scales 1. lappend symbol_numbers 2 lappend symbols "*" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-05-02 17:41:58
|
Revision: 12323 http://sourceforge.net/p/plplot/code/12323 Author: airwin Date: 2013-05-02 17:41:54 +0000 (Thu, 02 May 2013) Log Message: ----------- Adjust python/numpy bindings and examples for backwards-incompatible C API change from PLINT to PLFLT type for line-width related arguments of plshade* and pllegend. N.B. Few modern Linux distros support Numeric any more because Numeric development was stopped in favour of numpy in 2005. Therefore, I did not update the python/Numeric variant of our bindings here because that change would have been impossible for me to test. Modified Paths: -------------- trunk/bindings/python/plplot.py.numpy trunk/bindings/swig-support/plplotcapi.i trunk/cmake/modules/python.cmake trunk/examples/python/xw04.py trunk/examples/python/xw15.py trunk/examples/python/xw16.py trunk/examples/python/xw21.py trunk/examples/python/xw26.py trunk/examples/python/xw33.py Modified: trunk/bindings/python/plplot.py.numpy =================================================================== --- trunk/bindings/python/plplot.py.numpy 2013-05-02 10:25:42 UTC (rev 12322) +++ trunk/bindings/python/plplot.py.numpy 2013-05-02 17:41:54 UTC (rev 12323) @@ -386,22 +386,22 @@ raise ValueError, "Missing clev argument" # fill_width must be present - if len(args) > 0 and type(args[0]) == types.IntType: + if len(args) > 0 and (type(args[0]) == types.FloatType or type(args[0]) == numpy.float64): fill_width = args[0] args = args[1:] else: - raise ValueError, "Missing fill_width argument" + raise ValueError, "fill_width argument must be present and of types.FloatType or numpy.float64 type" # cont_color and cont_width are optional. if len(args) > 2 and \ type(args[0]) == types.IntType and \ - type(args[1]) == types.IntType: + (type(args[1]) == types.FloatType or type(args[1]) == numpy.float64): # These 2 args are cont_color, cont_width = args[0:2] args = args[2:] else: # Turn off contouring. - cont_color, cont_width = (0,0) + cont_color, cont_width = (0,0.) # rect must be present. if len(args) > 0 and type(args[0]) == types.IntType: @@ -492,10 +492,6 @@ # [min_color, min_width, max_color, max_width,] rect, \ # [pltr, [pltr_data] or [xg, yg, [wrap]]]) -# plshade(z, [xmin, xmax, ymin, ymax,] clev, \ -# fill_width, [cont_color, cont_width,], rect, \ -# [pltr, [pltr_data] or [xg, yg, [wrap]]]) - _plshade = plshade def plshade(z, *args): z = numpy.asarray(z) @@ -528,25 +524,25 @@ (type(args[1]) == types.FloatType or type(args[1]) == numpy.float64) and \ type(args[2]) == types.IntType and \ (type(args[3]) == types.FloatType or type(args[3]) == numpy.float64 or type(args[3]) == types.IntType) and \ - type(args[4]) == types.IntType: + (type(args[4]) == types.FloatType or type(args[4]) == numpy.float64): shade_min, shade_max, sh_cmap, sh_color, sh_width = args[0:5] args = args[5:] else: raise ValueError, \ - "shade_min, shade_max, sh_cmap, sh_color, sh_width, must be present" + "shade_min, shade_max, sh_cmap, sh_color, sh_width, must be present with sh_cmap of types.IntType type and the rest of types.FloatType or numpy.float64 type" # min_color, min_width, max_color, max_width are optional. if len(args) > 4 and \ type(args[0]) == types.IntType and \ - type(args[1]) == types.IntType and \ + (type(args[1]) == types.FloatType or type(args[1]) == numpy.float64) and \ type(args[2]) == types.IntType and \ - type(args[3]) == types.IntType: + (type(args[3]) == types.FloatType or type(args[3]) == numpy.float64): # These 4 args are min_color, min_width, max_color, max_width = args[0:4] args = args[4:] else: # Turn off boundary colouring - min_color, min_width, max_color, max_width = (0,0,0,0) + min_color, min_width, max_color, max_width = (0,0.,0,0.) # rect must be present. if len(args) > 0 and type(args[0]) == types.IntType: Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2013-05-02 10:25:42 UTC (rev 12322) +++ trunk/bindings/swig-support/plplotcapi.i 2013-05-02 17:41:54 UTC (rev 12323) @@ -468,18 +468,24 @@ PLFLT text_justification, const PLINT *ArrayCk, const char **ArrayCk, const PLINT *ArrayCkNull, const PLINT *ArrayCkNull, - const PLFLT *ArrayCkNull, const PLINT *ArrayCkNull, + const PLFLT *ArrayCkNull, const PLFLT *ArrayCkNull, const PLINT *ArrayCkNull, const PLINT *ArrayCkNull, - const PLINT *ArrayCkNull, + const PLFLT *ArrayCkNull, const PLINT *ArrayCkNull, const PLFLT *ArrayCkNull, const PLINT *ArrayCkNull, const char **ArrayCk ); #if 0 void -plcolorbar( PLINT opt, PLFLT x, PLFLT y, PLFLT length, PLFLT width, - PLFLT ticks, PLFLT sub_ticks, - const char *axis_opts, const char *label, - PLINT n, const PLFLT *Array, const PLFLT *ArrayCk ); +plcolorbar( PLFLT *OUTPUT, PLFLT *OUTPUT, + PLINT opt, 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 ); #endif void @@ -664,8 +670,8 @@ void plshades( const PLFLT **Matrix, PLINT nx, PLINT ny, defined_func df, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - const PLFLT *Array, PLINT n, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + const PLFLT *Array, PLINT n, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, fill_func ff, PLBOOL rectangular, pltr_func pltr, PLPointer SWIG_OBJECT_DATA ); @@ -674,9 +680,9 @@ plshade( const PLFLT **Matrix, PLINT nx, PLINT ny, defined_func df, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, fill_func ff, PLBOOL rectangular, pltr_func pltr, PLPointer SWIG_OBJECT_DATA ); Modified: trunk/cmake/modules/python.cmake =================================================================== --- trunk/cmake/modules/python.cmake 2013-05-02 10:25:42 UTC (rev 12322) +++ trunk/cmake/modules/python.cmake 2013-05-02 17:41:54 UTC (rev 12323) @@ -23,7 +23,7 @@ if(DEFAULT_NO_BINDINGS) option(ENABLE_python "Enable Python bindings" OFF) else(DEFAULT_NO_BINDINGS) - option(ENABLE_python "Enable Python bindings" OFF) + option(ENABLE_python "Enable Python bindings" ON) endif(DEFAULT_NO_BINDINGS) if(ENABLE_python AND NOT BUILD_SHARED_LIBS) Modified: trunk/examples/python/xw04.py =================================================================== --- trunk/examples/python/xw04.py 2013-05-02 10:25:42 UTC (rev 12322) +++ trunk/examples/python/xw04.py 2013-05-02 17:41:54 UTC (rev 12323) @@ -89,10 +89,10 @@ box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) - box_line_widths = zeros(nlegend, "int") + box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") - line_widths = zeros(nlegend, "int") + line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") @@ -106,7 +106,7 @@ text[0] = "Amplitude" line_colors[0] = 2 line_styles[0] = 1 - line_widths[0] = 1 + line_widths[0] = 1. # Data for second legend entry. if nlegend > 1: @@ -115,7 +115,7 @@ text[1] = "Phase shift" line_colors[1] = 3 line_styles[1] = 1 - line_widths[1] = 1 + line_widths[1] = 1. symbol_colors[1] = 3 symbol_scales[1] = 1. symbol_numbers[1] = 4 Modified: trunk/examples/python/xw15.py =================================================================== --- trunk/examples/python/xw15.py 2013-05-02 10:25:42 UTC (rev 12322) +++ trunk/examples/python/xw15.py 2013-05-02 17:41:54 UTC (rev 12323) @@ -60,11 +60,11 @@ shade_max = zmin + (zmax-zmin)*0.6 sh_cmap = 0 sh_color = 7 - sh_width = 2 + sh_width = 2. min_color = 9 - min_width = 2 + min_width = 2. max_color = 2 - max_width = 2 + max_width = 2. plpsty(8) @@ -97,11 +97,11 @@ plwind(-1.0, 1.0, -1.0, 1.0) sh_cmap = 0 - sh_width = 2 + sh_width = 2. min_color = 0 - min_width = 0 + min_width = 0. max_color = 0 - max_width = 0 + max_width = 0. for i in range(10): shade_min = zmin + (zmax - zmin) * i / 10.0 Modified: trunk/examples/python/xw16.py =================================================================== --- trunk/examples/python/xw16.py 2013-05-02 10:25:42 UTC (rev 12322) +++ trunk/examples/python/xw16.py 2013-05-02 17:41:54 UTC (rev 12323) @@ -40,9 +40,9 @@ def main(): - fill_width = 2 + fill_width = 2. cont_color = 2 - cont_width = 3 + cont_width = 3. # Set up data array Modified: trunk/examples/python/xw21.py =================================================================== --- trunk/examples/python/xw21.py 2013-05-02 10:25:42 UTC (rev 12322) +++ trunk/examples/python/xw21.py 2013-05-02 17:41:54 UTC (rev 12323) @@ -160,7 +160,7 @@ plenv0(xm,xM,ym,yM,2,0) plcol0(15) pllab('X','Y',title[alg-1]) - plshades(zg, xm, xM, ym, yM, clev, 1, 1, None, None) + plshades(zg, xm, xM, ym, yM, clev, 1., 1, None, None) plcol0(2) else: clev = lzm + (lzM-lzm)*arange(nl)/(nl-1) Modified: trunk/examples/python/xw26.py =================================================================== --- trunk/examples/python/xw26.py 2013-05-02 10:25:42 UTC (rev 12322) +++ trunk/examples/python/xw26.py 2013-05-02 17:41:54 UTC (rev 12323) @@ -159,10 +159,10 @@ box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) - box_line_widths = zeros(nlegend, "int") + box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") - line_widths = zeros(nlegend, "int") + line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") @@ -176,7 +176,7 @@ text[0] = legend_text[0] line_colors[0] = 2 line_styles[0] = 1 - line_widths[0] = 1 + line_widths[0] = 1. # Data for second legend entry. if nlegend > 1: @@ -185,7 +185,7 @@ text[1] = legend_text[1] line_colors[1] = 3 line_styles[1] = 1 - line_widths[1] = 1 + line_widths[1] = 1. symbol_colors[1] = 3 symbol_scales[1] = 1. symbol_numbers[1] = 4 Modified: trunk/examples/python/xw33.py =================================================================== --- trunk/examples/python/xw33.py 2013-05-02 10:25:42 UTC (rev 12322) +++ trunk/examples/python/xw33.py 2013-05-02 17:41:54 UTC (rev 12323) @@ -178,10 +178,10 @@ box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) - box_line_widths = zeros(nlegend, "int") + box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") - line_widths = zeros(nlegend, "int") + line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") @@ -192,7 +192,7 @@ opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX opt_array[0] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL line_styles[0] = 1 - line_widths[0] = 1 + line_widths[0] = 1. symbol_scales[0] = 1. symbol_numbers[0] = 4 symbols[0] = "*" @@ -235,10 +235,10 @@ box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) - box_line_widths = zeros(nlegend, "int") + box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") - line_widths = zeros(nlegend, "int") + line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") @@ -250,7 +250,7 @@ for k in range(nlegend): opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL line_styles[k] = 1 - line_widths[k] = 1 + line_widths[k] = 1. symbol_scales[k] = 1. symbol_numbers[k] = 2 symbols[k] = "*" @@ -388,10 +388,10 @@ box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) - box_line_widths = zeros(nlegend, "int") + box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") - line_widths = zeros(nlegend, "int") + line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") @@ -402,7 +402,7 @@ for k in range(nlegend): opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL line_styles[k] = 1 - line_widths[k] = 1 + line_widths[k] = 1. symbol_scales[k] = 1. symbol_numbers[k] = 2 symbols[k] = "*" @@ -456,10 +456,10 @@ box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) - box_line_widths = zeros(nlegend, "int") + box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") - line_widths = zeros(nlegend, "int") + line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") @@ -481,14 +481,14 @@ box_colors[1] = 2 box_patterns[1] = 0 box_scales[1] = 0.8 - box_line_widths[1] = 1 + box_line_widths[1] = 1. opt_array[2] = PL_LEGEND_LINE text[2] = "Line" text_colors[2] = 3 line_colors[2] = 3 line_styles[2] = 1 - line_widths[2] = 1 + line_widths[2] = 1. opt_array[3] = PL_LEGEND_SYMBOL text[3] = "Symbol" @@ -503,7 +503,7 @@ text_colors[4] = 5 line_colors[4] = 5 line_styles[4] = 1 - line_widths[4] = 1 + line_widths[4] = 1. symbol_colors[4] = 5 symbol_scales[4] = text_scale symbol_numbers[4] = 4 @@ -572,7 +572,7 @@ box_colors[i] = i+1 box_patterns[i] = 0 box_scales[i] = 0.8 - box_line_widths[i] = 1 + box_line_widths[i] = 1. opt = opt_base # Use new origin @@ -597,7 +597,7 @@ box_colors[i] = 2 box_patterns[i] = i box_scales[i] = 0.8 - box_line_widths[i] = 1 + box_line_widths[i] = 1. opt = opt_base x += legend_width @@ -619,7 +619,7 @@ box_colors[i] = 2 box_patterns[i] = 3 box_scales[i] = 0.8 - box_line_widths[i] = i+1 + box_line_widths[i] = float(i+1) opt = opt_base x += legend_width @@ -640,7 +640,7 @@ text_colors[i] = i+1 line_colors[i] = i+1 line_styles[i] = 1 - line_widths[i] = 1 + line_widths[i] = 1. opt = opt_base # Use new origin @@ -664,7 +664,7 @@ text_colors[i] = 2 line_colors[i] = 2 line_styles[i] = i+1 - line_widths[i] = 1 + line_widths[i] = 1. opt = opt_base x += legend_width @@ -685,7 +685,7 @@ text_colors[i] = 2 line_colors[i] = 2 line_styles[i] = 1 - line_widths[i] = i+1 + line_widths[i] = float(i+1) opt = opt_base x += legend_width This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-05-02 22:44:54
|
Revision: 12329 http://sourceforge.net/p/plplot/code/12329 Author: airwin Date: 2013-05-02 22:44:50 +0000 (Thu, 02 May 2013) Log Message: ----------- Adjust java bindings and examples for backwards-incompatible C API change from PLINT to PLFLT type for line-width related arguments of plshade* and pllegend. Modified Paths: -------------- trunk/bindings/java/PLStream.java trunk/cmake/modules/java.cmake trunk/examples/java/x04.java trunk/examples/java/x15.java trunk/examples/java/x16.java trunk/examples/java/x21.java trunk/examples/java/x26.java trunk/examples/java/x33.java Modified: trunk/bindings/java/PLStream.java =================================================================== --- trunk/bindings/java/PLStream.java 2013-05-02 21:56:16 UTC (rev 12328) +++ trunk/bindings/java/PLStream.java 2013-05-02 22:44:50 UTC (rev 12329) @@ -536,9 +536,9 @@ double text_spacing, double text_justification, int[] text_colors, String[] text, int[] box_colors, int[] box_patterns, - double[] box_scales, int[] box_line_widths, + double[] box_scales, double[] box_line_widths, int[] line_colors, int[] line_styles, - int[] line_widths, + double[] line_widths, int[] symbol_colors, double[] symbol_scales, int[] symbol_numbers, String[] symbols ) { @@ -922,8 +922,8 @@ } public void shades( double[][] a, double xmin, double xmax, double ymin, - double ymax, double[] clevel, int fill_width, int cont_color, - int cont_width, boolean rectangular, + double ymax, double[] clevel, double fill_width, int cont_color, + double cont_width, boolean rectangular, double[][] pltr, double[][] OBJECT_DATA ) { if ( set_stream() == -1 ) return; @@ -933,8 +933,8 @@ public void shade( double[][] a, double left, double right, double bottom, double top, double shade_min, double shade_max, int sh_cmap, - double sh_color, int sh_width, int min_color, int min_width, - int max_color, int max_width, boolean rectangular, + double sh_color, double sh_width, int min_color, double min_width, + int max_color, double max_width, boolean rectangular, double[][] pltr, double[][] OBJECT_DATA ) { if ( set_stream() == -1 ) return; @@ -1259,8 +1259,8 @@ } public void shades( double[][] a, double xmin, double xmax, double ymin, - double ymax, double[] clevel, int fill_width, int cont_color, - int cont_width, int rectangular, + double ymax, double[] clevel, double fill_width, int cont_color, + double cont_width, int rectangular, double[][] pltr, double[][] OBJECT_DATA ) { if ( set_stream() == -1 ) return; @@ -1270,8 +1270,8 @@ public void shade( double[][] a, double left, double right, double bottom, double top, double shade_min, double shade_max, int sh_cmap, - double sh_color, int sh_width, int min_color, int min_width, - int max_color, int max_width, int rectangular, + double sh_color, double sh_width, int min_color, double min_width, + int max_color, double max_width, int rectangular, double[][] pltr, double[][] OBJECT_DATA ) { if ( set_stream() == -1 ) return; Modified: trunk/cmake/modules/java.cmake =================================================================== --- trunk/cmake/modules/java.cmake 2013-05-02 21:56:16 UTC (rev 12328) +++ trunk/cmake/modules/java.cmake 2013-05-02 22:44:50 UTC (rev 12329) @@ -25,7 +25,7 @@ if(DEFAULT_NO_BINDINGS) option(ENABLE_java "Enable Java bindings" OFF) else(DEFAULT_NO_BINDINGS) - option(ENABLE_java "Enable Java bindings" OFF) + option(ENABLE_java "Enable Java bindings" ON) endif(DEFAULT_NO_BINDINGS) if(ENABLE_java AND NOT BUILD_SHARED_LIBS) Modified: trunk/examples/java/x04.java =================================================================== --- trunk/examples/java/x04.java 2013-05-02 21:56:16 UTC (rev 12328) +++ trunk/examples/java/x04.java 2013-05-02 22:44:50 UTC (rev 12329) @@ -77,7 +77,7 @@ int[] text_colors; int[] line_colors; int[] line_styles; - int[] line_widths; + double[] line_widths; int[] symbol_numbers; int[] symbol_colors; double[] symbol_scales; @@ -150,7 +150,7 @@ text_colors = new int[nlegend]; line_colors = new int[nlegend]; line_styles = new int[nlegend]; - line_widths = new int[nlegend]; + line_widths = new double[nlegend]; symbol_numbers = new int[nlegend]; symbol_colors = new int[nlegend]; symbol_scales = new double[nlegend]; @@ -162,7 +162,7 @@ text[0] = "Amplitude"; line_colors[0] = 2; line_styles[0] = 1; - line_widths[0] = 1; + line_widths[0] = 1.; // note from the above opt_array the first symbol (and box) indices // do not have to be specified EXCEPT for symbols. // Although this is unused, it can't be undefined as the String @@ -177,7 +177,7 @@ text[1] = "Phase shift"; line_colors[1] = 3; line_styles[1] = 1; - line_widths[1] = 1; + line_widths[1] = 1.; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; Modified: trunk/examples/java/x15.java =================================================================== --- trunk/examples/java/x15.java 2013-05-02 21:56:16 UTC (rev 12328) +++ trunk/examples/java/x15.java 2013-05-02 22:44:50 UTC (rev 12329) @@ -126,8 +126,9 @@ void plot1( double[][] xg0, double[][] yg0, double[][] z, double zmin, double zmax ) { double shade_min, shade_max, sh_color; - int sh_cmap = 0, sh_width; - int min_color = 0, min_width = 0, max_color = 0, max_width = 0; + int sh_cmap = 0; + int min_color = 0, max_color = 0; + double sh_width, min_width = 0., max_width = 0.; pls.adv( 0 ); pls.vpor( 0.1, 0.9, 0.1, 0.9 ); @@ -138,11 +139,11 @@ shade_min = zmin + ( zmax - zmin ) * 0.4; shade_max = zmin + ( zmax - zmin ) * 0.6; sh_color = 7; - sh_width = 2; + sh_width = 2.; min_color = 9; max_color = 2; - min_width = 2; - max_width = 2; + min_width = 2.; + max_width = 2.; pls.psty( 8 ); @@ -164,8 +165,9 @@ void plot2( double[][] xg0, double[][] yg0, double[][] z, double zmin, double zmax ) { double shade_min, shade_max, sh_color; - int sh_cmap = 0, sh_width; - int min_color = 0, min_width = 0, max_color = 0, max_width = 0; + int sh_cmap = 0; + int min_color = 0, max_color = 0; + double sh_width, min_width = 0., max_width = 0.; int i; int[][] inc = { { 450 }, { -450 }, { 0 }, { 900 }, { 300 }, {450, -450 }, { 0, 900 }, { 0, 450 }, @@ -173,7 +175,7 @@ int[][] del = { { 2000 }, { 2000 }, { 2000 }, { 2000 }, { 2000 }, {2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, {4000, 4000 }, { 4000, 2000 } }; - sh_width = 2; + sh_width = 2.; pls.adv( 0 ); pls.vpor( 0.1, 0.9, 0.1, 0.9 ); Modified: trunk/examples/java/x16.java =================================================================== --- trunk/examples/java/x16.java 2013-05-02 21:56:16 UTC (rev 12328) +++ trunk/examples/java/x16.java 2013-05-02 22:44:50 UTC (rev 12329) @@ -88,7 +88,8 @@ double[][] yg2 = new double[XPTS][YPTS]; double[] clevel = new double[NSHADES]; double[] shedge = new double[NSHADES + 1]; - final int fill_width = 2, cont_color = 0, cont_width = 0; + final int cont_color = 0; + final double fill_width = 2., cont_width = 0.; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); @@ -242,7 +243,7 @@ pls.shades( z, -1., 1., -1., 1., shedge, fill_width, - 2, 3, + 2, 3., false, xg2, yg2 ); pls.col0( 1 ); Modified: trunk/examples/java/x21.java =================================================================== --- trunk/examples/java/x21.java 2013-05-02 21:56:16 UTC (rev 12328) +++ trunk/examples/java/x21.java 2013-05-02 22:44:50 UTC (rev 12329) @@ -305,7 +305,7 @@ pls.col0( 15 ); pls.lab( "X", "Y", title[alg - 1] ); pls.shades( zg, xm, xM, ym, yM, - clev, 1, 0, 1, true, xg0, yg0 ); + clev, 1., 0, 1., true, xg0, yg0 ); pls.col0( 2 ); } else Modified: trunk/examples/java/x26.java =================================================================== --- trunk/examples/java/x26.java 2013-05-02 21:56:16 UTC (rev 12328) +++ trunk/examples/java/x26.java 2013-05-02 22:44:50 UTC (rev 12329) @@ -154,7 +154,7 @@ int[] text_colors = new int[2]; int[] line_colors = new int[2]; int[] line_styles = new int[2]; - int[] line_widths = new int[2]; + double[] line_widths = new double[2]; int[] symbol_numbers = new int[2]; int[] symbol_colors = new int[2]; double[] symbol_scales = new double[2]; @@ -226,7 +226,7 @@ text_colors[0] = 2; line_colors[0] = 2; line_styles[0] = 1; - line_widths[0] = 1; + line_widths[0] = 1.; // note from the above opt_array the first symbol (and box) indices // do not have to be specified EXCEPT for symbols. // Although this is unused, it can't be undefined as the String @@ -238,7 +238,7 @@ text_colors[1] = 3; line_colors[1] = 3; line_styles[1] = 1; - line_widths[1] = 1; + line_widths[1] = 1.; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; Modified: trunk/examples/java/x33.java =================================================================== --- trunk/examples/java/x33.java 2013-05-02 21:56:16 UTC (rev 12328) +++ trunk/examples/java/x33.java 2013-05-02 22:44:50 UTC (rev 12329) @@ -219,10 +219,10 @@ int[] box_colors; int[] box_patterns; double[] box_scales; - int[] box_line_widths; + double[] box_line_widths; int[] line_colors; int[] line_styles; - int[] line_widths; + double[] line_widths; int[] symbol_numbers; int[] symbol_colors; double[] symbol_scales; @@ -274,7 +274,7 @@ text_colors = new int[nlegend]; line_colors = new int[nlegend]; line_styles = new int[nlegend]; - line_widths = new int[nlegend]; + line_widths = new double[nlegend]; symbol_numbers = new int[nlegend]; symbol_colors = new int[nlegend]; symbol_scales = new double[nlegend]; @@ -285,7 +285,7 @@ opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; opt_array[0] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[0] = 1; - line_widths[0] = 1; + line_widths[0] = 1.; symbol_scales[0] = 1.; symbol_numbers[0] = 4; symbols[0] = "*"; @@ -327,11 +327,11 @@ text_colors = new int[nlegend]; line_colors = new int[nlegend]; line_styles = new int[nlegend]; - line_widths = new int[nlegend]; + line_widths = new double[nlegend]; box_colors = new int[nlegend]; box_patterns = new int[nlegend]; box_scales = new double[nlegend]; - box_line_widths = new int[nlegend]; + box_line_widths = new double[nlegend]; symbol_numbers = new int[nlegend]; symbol_colors = new int[nlegend]; symbol_scales = new double[nlegend]; @@ -345,7 +345,7 @@ { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; - line_widths[k] = 1; + line_widths[k] = 1.; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; @@ -483,11 +483,11 @@ text_colors = new int[nlegend]; line_colors = new int[nlegend]; line_styles = new int[nlegend]; - line_widths = new int[nlegend]; + line_widths = new double[nlegend]; box_colors = new int[nlegend]; box_patterns = new int[nlegend]; box_scales = new double[nlegend]; - box_line_widths = new int[nlegend]; + box_line_widths = new double[nlegend]; symbol_numbers = new int[nlegend]; symbol_colors = new int[nlegend]; symbol_scales = new double[nlegend]; @@ -500,7 +500,7 @@ { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; - line_widths[k] = 1; + line_widths[k] = 1.; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; @@ -557,11 +557,11 @@ text_colors = new int[nlegend]; line_colors = new int[nlegend]; line_styles = new int[nlegend]; - line_widths = new int[nlegend]; + line_widths = new double[nlegend]; box_colors = new int[nlegend]; box_patterns = new int[nlegend]; box_scales = new double[nlegend]; - box_line_widths = new int[nlegend]; + box_line_widths = new double[nlegend]; symbol_numbers = new int[nlegend]; symbol_colors = new int[nlegend]; symbol_scales = new double[nlegend]; @@ -588,14 +588,14 @@ box_colors[1] = 2; box_patterns[1] = 0; box_scales[1] = 0.8; - box_line_widths[1] = 1; + box_line_widths[1] = 1.; opt_array[2] = PL_LEGEND_LINE; text[2] = "Line"; text_colors[2] = 3; line_colors[2] = 3; line_styles[2] = 1; - line_widths[2] = 1; + line_widths[2] = 1.; opt_array[3] = PL_LEGEND_SYMBOL; text[3] = "Symbol"; @@ -610,7 +610,7 @@ text_colors[4] = 5; line_colors[4] = 5; line_styles[4] = 1; - line_widths[4] = 1; + line_widths[4] = 1.; symbol_colors[4] = 5; symbol_scales[4] = text_scale; symbol_numbers[4] = 4; @@ -687,7 +687,7 @@ box_colors[i] = i + 1; box_patterns[i] = 0; box_scales[i] = 0.8; - box_line_widths[i] = 1; + box_line_widths[i] = 1.; } opt = opt_base; @@ -715,7 +715,7 @@ box_colors[i] = 2; box_patterns[i] = i; box_scales[i] = 0.8; - box_line_widths[i] = 1; + box_line_widths[i] = 1.; } opt = opt_base; @@ -764,7 +764,7 @@ text_colors[i] = i + 1; line_colors[i] = i + 1; line_styles[i] = 1; - line_widths[i] = 1; + line_widths[i] = 1.; } opt = opt_base; @@ -791,7 +791,7 @@ text_colors[i] = 2; line_colors[i] = 2; line_styles[i] = i + 1; - line_widths[i] = 1; + line_widths[i] = 1.; } opt = opt_base; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-05-03 02:02:09
|
Revision: 12330 http://sourceforge.net/p/plplot/code/12330 Author: airwin Date: 2013-05-03 02:02:05 +0000 (Fri, 03 May 2013) Log Message: ----------- Adjust Octave bindings and examples for backwards-incompatible C API change from PLINT to PLFLT type for line-width related arguments of plshade* and pllegend. Modified Paths: -------------- trunk/cmake/modules/octave.cmake trunk/examples/octave/x04c.m trunk/examples/octave/x15c.m trunk/examples/octave/x16c.m trunk/examples/octave/x21c.m trunk/examples/octave/x26c.m trunk/examples/octave/x33c.m Modified: trunk/cmake/modules/octave.cmake =================================================================== --- trunk/cmake/modules/octave.cmake 2013-05-02 22:44:50 UTC (rev 12329) +++ trunk/cmake/modules/octave.cmake 2013-05-03 02:02:05 UTC (rev 12330) @@ -23,7 +23,7 @@ if(DEFAULT_NO_BINDINGS) option(ENABLE_octave "Enable Octave bindings" OFF) else(DEFAULT_NO_BINDINGS) - option(ENABLE_octave "Enable Octave bindings" OFF) + option(ENABLE_octave "Enable Octave bindings" ON) endif(DEFAULT_NO_BINDINGS) if(ENABLE_octave AND NOT CMAKE_CXX_COMPILER_WORKS) Modified: trunk/examples/octave/x04c.m =================================================================== --- trunk/examples/octave/x04c.m 2013-05-02 22:44:50 UTC (rev 12329) +++ trunk/examples/octave/x04c.m 2013-05-03 02:02:05 UTC (rev 12330) @@ -111,7 +111,7 @@ text = " "; line_colors = 0; line_styles = 0; - line_widths = 0; + line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; @@ -122,7 +122,7 @@ text(nlegend,1:length(" ")) = " "; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; - line_widths(nlegend,1) = 0; + line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; @@ -137,7 +137,7 @@ text(1,1:length("Amplitude")) = "Amplitude"; line_colors(1) = 2; line_styles(1) = 1; - line_widths(1) = 1; + line_widths(1) = 1.; ## Data for second legend entry. if(nlegend > 1) @@ -146,7 +146,7 @@ text(2,1:length("Phase shift")) = "Phase shift"; line_colors(2) = 3; line_styles(2) = 1; - line_widths(2) = 1; + line_widths(2) = 1.; symbol_colors(2) = 3; symbol_scales(2) = 1.; symbol_numbers(2) = 4; Modified: trunk/examples/octave/x15c.m =================================================================== --- trunk/examples/octave/x15c.m 2013-05-02 22:44:50 UTC (rev 12329) +++ trunk/examples/octave/x15c.m 2013-05-03 02:02:05 UTC (rev 12330) @@ -135,7 +135,7 @@ function plot1(z,zmin,zmax) global tr sh_cmap = 0; - min_color = 0; min_width = 0; max_color = 0; max_width = 0; + min_color = 0; min_width = 0.; max_color = 0; max_width = 0.; pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); @@ -146,11 +146,11 @@ shade_min = zmin + (zmax-zmin)*0.4; shade_max = zmin + (zmax-zmin)*0.6; sh_color = 7; - sh_width = 2; + sh_width = 2.; min_color = 9; max_color = 2; - min_width = 2; - max_width = 2; + min_width = 2.; + max_width = 2.; plpsty(8); plshade(z, 0, -1., 1., -1., 1., @@ -169,7 +169,7 @@ function plot2(z,zmin,zmax) global tr sh_cmap = 0; - min_color = 0; min_width = 0; max_color = 0; max_width = 0; + min_color = 0; min_width = 0.; max_color = 0; max_width = 0.; nlin = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2]; inc = [450, 0; -450, 0; 0, 0; 900, 0; 300, 0; @@ -187,7 +187,7 @@ shade_min = zmin + (zmax - zmin) * i / 10.0; shade_max = zmin + (zmax - zmin) * (i +1) / 10.0; sh_color = i+6; - sh_width = 2; + sh_width = 2.; n = nlin(i+1); plpat(inc(i+1,1:n)',del(i+1,1:n)'); Modified: trunk/examples/octave/x16c.m =================================================================== --- trunk/examples/octave/x16c.m 2013-05-02 22:44:50 UTC (rev 12329) +++ trunk/examples/octave/x16c.m 2013-05-03 02:02:05 UTC (rev 12330) @@ -42,8 +42,7 @@ "test results from ns around 5 and nx, ny around 25."]; sh_cmap = 1; - fill_width = 2; cont_color = 0; cont_width = 0; - min_color = 1; min_width = 0; max_color = 0; max_width = 0; + fill_width = 2.; cont_color = 0; cont_width = 0.; ## Parse and process command line arguments @@ -185,7 +184,7 @@ plshades2(z, -1., 1., -1., 1., shedge', fill_width, - 2, 3, + 2, 3., 0, xg2, yg2); plcol0(1); Modified: trunk/examples/octave/x21c.m =================================================================== --- trunk/examples/octave/x21c.m 2013-05-02 22:44:50 UTC (rev 12329) +++ trunk/examples/octave/x21c.m 2013-05-03 02:02:05 UTC (rev 12330) @@ -167,7 +167,7 @@ plenv0(xm, xM, ym, yM, 2, 0); plcol0(15); pllab("X", "Y", deblank(title(alg,:))); - plshades(zg, xm, xM, ym, yM, clev, 1, 0, 1, 1); + plshades(zg, xm, xM, ym, yM, clev, 1., 0, 1., 1); plcol0(2); else Modified: trunk/examples/octave/x26c.m =================================================================== --- trunk/examples/octave/x26c.m 2013-05-02 22:44:50 UTC (rev 12329) +++ trunk/examples/octave/x26c.m 2013-05-03 02:02:05 UTC (rev 12330) @@ -193,10 +193,10 @@ box_colors = 0; box_patterns = 0; box_scales = 0.; - box_line_widths = 0; + box_line_widths = 0.; line_colors = 0; line_styles = 0; - line_widths = 0; + line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; @@ -208,10 +208,10 @@ box_colors(nlegend,1) = 0; box_patterns(nlegend,1) = 0; box_scales(nlegend,1) = 0.; - box_line_widths(nlegend,1) = 0; + box_line_widths(nlegend,1) = 0.; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; - line_widths(nlegend,1) = 0; + line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; @@ -226,7 +226,7 @@ text(1,1:length(legend_text(1,:))) = legend_text(1,:); line_colors(1) = 2; line_styles(1) = 1; - line_widths(1) = 1; + line_widths(1) = 1.; ## Data for second legend entry. if(nlegend > 1) @@ -235,7 +235,7 @@ text(2,1:length(legend_text(1,:))) = legend_text(2,:); line_colors(2) = 3; line_styles(2) = 1; - line_widths(2) = 1; + line_widths(2) = 1.; symbol_colors(2) = 3; symbol_scales(2) = 1.; symbol_numbers(2) = 4; Modified: trunk/examples/octave/x33c.m =================================================================== --- trunk/examples/octave/x33c.m 2013-05-02 22:44:50 UTC (rev 12329) +++ trunk/examples/octave/x33c.m 2013-05-03 02:02:05 UTC (rev 12330) @@ -206,10 +206,10 @@ box_colors = 0; box_patterns = 0; box_scales = 0.; - box_line_widths = 0; + box_line_widths = 0.; line_colors = 0; line_styles = 0; - line_widths = 0; + line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; @@ -220,7 +220,7 @@ text(nlegend,1:length(" ")) = " "; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; - line_widths(nlegend,1) = 0; + line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; @@ -231,7 +231,7 @@ opt_base = bitor(PL_LEGEND_BACKGROUND, PL_LEGEND_BOUNDING_BOX); opt_array(1) = bitor(PL_LEGEND_LINE, PL_LEGEND_SYMBOL); line_styles(1) = 1; - line_widths(1) = 1; + line_widths(1) = 1.; symbol_scales(1) = 1.; symbol_numbers(1) = 4; symbols(1,1:length("*")) = "*"; @@ -281,10 +281,10 @@ box_colors = 0; box_patterns = 0; box_scales = 0.; - box_line_widths = 0; + box_line_widths = 0.; line_colors = 0; line_styles = 0; - line_widths = 0; + line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; @@ -295,7 +295,7 @@ text(nlegend,1:length(" ")) = " "; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; - line_widths(nlegend,1) = 0; + line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; @@ -307,7 +307,7 @@ for k=0:nlegend-1 opt_array(k+1) = bitor(PL_LEGEND_LINE, PL_LEGEND_SYMBOL); line_styles(k+1) = 1; - line_widths(k+1) = 1; + line_widths(k+1) = 1.; symbol_scales(k+1) = 1.; symbol_numbers(k+1) = 2; symbols(k+1,1:length("*")) = "*"; @@ -456,10 +456,10 @@ box_colors = 0; box_patterns = 0; box_scales = 0.; - box_line_widths = 0; + box_line_widths = 0.; line_colors = 0; line_styles = 0; - line_widths = 0; + line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; @@ -471,10 +471,10 @@ box_colors(nlegend,1) = 0; box_patterns(nlegend,1) = 0; box_scales(nlegend,1) = 0.; - box_line_widths(nlegend,1) = 0; + box_line_widths(nlegend,1) = 0.; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; - line_widths(nlegend,1) = 0; + line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; @@ -485,7 +485,7 @@ for k=0:nlegend-1 opt_array(k+1) = bitor(PL_LEGEND_LINE, PL_LEGEND_SYMBOL); line_styles(k+1) = 1; - line_widths(k+1) = 1; + line_widths(k+1) = 1.; symbol_scales(k+1) = 1.; symbol_numbers(k+1) = 2; symbols(k+1,1:length("*")) = "*"; @@ -550,10 +550,10 @@ box_colors = 0; box_patterns = 0; box_scales = 0.; - box_line_widths = 0; + box_line_widths = 0.; line_colors = 0; line_styles = 0; - line_widths = 0; + line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; @@ -565,10 +565,10 @@ box_colors(nlegend,1) = 0; box_patterns(nlegend,1) = 0; box_scales(nlegend,1) = 0.; - box_line_widths(nlegend,1) = 0; + box_line_widths(nlegend,1) = 0.; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; - line_widths(nlegend,1) = 0; + line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; @@ -590,14 +590,14 @@ box_colors(2) = 2; box_patterns(2) = 0; box_scales(2) = 0.8; - box_line_widths(2) = 1; + box_line_widths(2) = 1.; opt_array(3) = PL_LEGEND_LINE; text(3,1:length("Line")) = "Line"; text_colors(3) = 3; line_colors(3) = 3; line_styles(3) = 1; - line_widths(3) = 1; + line_widths(3) = 1.; opt_array(4) = PL_LEGEND_SYMBOL; text(4,1:length("Symbol")) = "Symbol"; @@ -612,7 +612,7 @@ text_colors(5) = 5; line_colors(5) = 5; line_styles(5) = 1; - line_widths(5) = 1; + line_widths(5) = 1.; symbol_colors(5) = 5; symbol_scales(5) = text_scale; symbol_numbers(5) = 4; @@ -707,7 +707,7 @@ box_colors(i+1) = i+1; box_patterns(i+1) = 0; box_scales(i+1) = 0.8; - box_line_widths(i+1) = 1; + box_line_widths(i+1) = 1.; endfor opt = opt_base; @@ -741,7 +741,7 @@ box_colors(i+1) = 2; box_patterns(i+1) = i; box_scales(i+1) = 0.8; - box_line_widths(i+1) = 1; + box_line_widths(i+1) = 1.; endfor opt = opt_base; @@ -772,7 +772,7 @@ box_colors(i+1) = 2; box_patterns(i+1) = 3; box_scales(i+1) = 0.8; - box_line_widths(i+1) = i+1; + box_line_widths(i+1) = double(i+1); endfor opt = opt_base; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-05-03 02:41:26
|
Revision: 12331 http://sourceforge.net/p/plplot/code/12331 Author: airwin Date: 2013-05-03 02:41:21 +0000 (Fri, 03 May 2013) Log Message: ----------- Adjust Lua bindings and examples for backwards-incompatible C API change from PLINT to PLFLT type for line-width related arguments of plshade* and pllegend. Modified Paths: -------------- trunk/cmake/modules/lua.cmake trunk/examples/lua/x04.lua trunk/examples/lua/x15.lua trunk/examples/lua/x16.lua trunk/examples/lua/x21.lua trunk/examples/lua/x26.lua trunk/examples/lua/x33.lua Modified: trunk/cmake/modules/lua.cmake =================================================================== --- trunk/cmake/modules/lua.cmake 2013-05-03 02:02:05 UTC (rev 12330) +++ trunk/cmake/modules/lua.cmake 2013-05-03 02:41:21 UTC (rev 12331) @@ -25,7 +25,7 @@ if(DEFAULT_NO_BINDINGS) option(ENABLE_lua "Enable Lua bindings" OFF) else(DEFAULT_NO_BINDINGS) - option(ENABLE_lua "Enable Lua bindings" OFF) + option(ENABLE_lua "Enable Lua bindings" ON) endif(DEFAULT_NO_BINDINGS) if(ENABLE_lua AND NOT BUILD_SHARED_LIBS) Modified: trunk/examples/lua/x04.lua =================================================================== --- trunk/examples/lua/x04.lua 2013-05-03 02:02:05 UTC (rev 12330) +++ trunk/examples/lua/x04.lua 2013-05-03 02:41:21 UTC (rev 12331) @@ -125,10 +125,10 @@ box_colors[1] = 0 box_patterns[1] = 0 box_scales[1] = 0 - box_line_widths[1] = 0 + box_line_widths[1] = 0. line_colors[1] = 2 line_styles[1] = 1 - line_widths[1] = 1 + line_widths[1] = 1. -- unused arbitrary data symbol_colors[1] = 0 symbol_scales[1] = 0 @@ -144,10 +144,10 @@ box_colors[2] = 0 box_patterns[2] = 0 box_scales[2] = 0 - box_line_widths[2] = 0 + box_line_widths[2] = 0. line_colors[2] = 3 line_styles[2] = 1 - line_widths[2] = 1 + line_widths[2] = 1. symbol_colors[2] = 3 symbol_scales[2] = 1. symbol_numbers[2] = 4 Modified: trunk/examples/lua/x15.lua =================================================================== --- trunk/examples/lua/x15.lua 2013-05-03 02:02:05 UTC (rev 12330) +++ trunk/examples/lua/x15.lua 2013-05-03 02:41:21 UTC (rev 12331) @@ -87,11 +87,11 @@ shade_min = zmin + (zmax-zmin)*0.4 shade_max = zmin + (zmax-zmin)*0.6 sh_color = 7 - sh_width = 2 + sh_width = 2. min_color = 9 max_color = 2 - min_width = 2 - max_width = 2 + min_width = 2. + max_width = 2. pl.psty(8) pl.shade(z, -1, 1, -1, 1, shade_min, shade_max, sh_cmap, sh_color, sh_width, @@ -114,16 +114,16 @@ function plot2() sh_cmap = 0 min_color = 0 - min_width = 0 + min_width = 0. max_color = 0 - max_width = 0 + max_width = 0. inc = { {450}, {-450}, {0}, {900}, {300}, {450,-450}, {0, 900}, {0, 450}, {450, -450}, {0, 900} } del = { {2000}, {2000}, {2000}, {2000}, {2000}, {2000, 2000}, {2000, 2000}, {2000, 2000}, {4000, 4000}, {4000, 2000} } - sh_width = 2 + sh_width = 2. pl.adv(0) pl.vpor(0.1, 0.9, 0.1, 0.9) Modified: trunk/examples/lua/x16.lua =================================================================== --- trunk/examples/lua/x16.lua 2013-05-03 02:02:05 UTC (rev 12330) +++ trunk/examples/lua/x16.lua 2013-05-03 02:41:21 UTC (rev 12331) @@ -82,9 +82,9 @@ px = {} py = {} -fill_width = 2 +fill_width = 2. cont_color = 0 -cont_width = 0 +cont_width = 0. -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) @@ -237,7 +237,7 @@ pl.psty(0) -pl.shades(z, -1, 1, -1, 1, shedge, fill_width, 2, 3, 0, "pltr2", cgrid2) +pl.shades(z, -1, 1, -1, 1, shedge, fill_width, 2, 3., 0, "pltr2", cgrid2) pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) Modified: trunk/examples/lua/x21.lua =================================================================== --- trunk/examples/lua/x21.lua 2013-05-03 02:02:05 UTC (rev 12330) +++ trunk/examples/lua/x21.lua 2013-05-03 02:41:21 UTC (rev 12331) @@ -232,7 +232,7 @@ pl.env0(xm, xM, ym, yM, 2, 0) pl.col0(15) pl.lab("X", "Y", title[alg]) - pl.shades(zg, xm, xM, ym, yM, clev, 1, 0, 1, 1) + pl.shades(zg, xm, xM, ym, yM, clev, 1., 0, 1., 1) pl.col0(2) else for i = 1, nl do Modified: trunk/examples/lua/x26.lua =================================================================== --- trunk/examples/lua/x26.lua 2013-05-03 02:02:05 UTC (rev 12330) +++ trunk/examples/lua/x26.lua 2013-05-03 02:41:21 UTC (rev 12331) @@ -177,10 +177,10 @@ box_colors[1] = 0 box_patterns[1] = 0 box_scales[1] = 0 - box_line_widths[1] = 0 + box_line_widths[1] = 0. line_colors[1] = 2 line_styles[1] = 1 - line_widths[1] = 1 + line_widths[1] = 1. -- unused arbitrary data symbol_colors[1] = 0 symbol_scales[1] = 0 @@ -196,10 +196,10 @@ box_colors[2] = 0 box_patterns[2] = 0 box_scales[2] = 0 - box_line_widths[2] = 0 + box_line_widths[2] = 0. line_colors[2] = 3 line_styles[2] = 1 - line_widths[2] = 1 + line_widths[2] = 1. symbol_colors[2] = 3 symbol_scales[2] = 1. symbol_numbers[2] = 4 Modified: trunk/examples/lua/x33.lua =================================================================== --- trunk/examples/lua/x33.lua 2013-05-03 02:02:05 UTC (rev 12330) +++ trunk/examples/lua/x33.lua 2013-05-03 02:41:21 UTC (rev 12331) @@ -67,10 +67,10 @@ box_colors[i] = 0 box_patterns[i] = 0 box_scales[i] = 0.0 - box_line_widths[i] = 0 + box_line_widths[i] = 0. line_colors[i] = 0 line_styles[i] = 0 - line_widths[i] = 0 + line_widths[i] = 0. symbol_colors[i] = 0 symbol_scales[i] = 0.0 symbol_numbers[i] = 0 @@ -135,7 +135,7 @@ opt_base = lor(pl.PL_LEGEND_BACKGROUND, pl.PL_LEGEND_BOUNDING_BOX) opt_array[1] = lor(pl.PL_LEGEND_LINE, pl.PL_LEGEND_SYMBOL) line_styles[1] = 1 -line_widths[1] = 1 +line_widths[1] = 1. symbol_scales[1] = 1.0 symbol_numbers[1] = 4 symbols[1] = "*" @@ -180,7 +180,7 @@ for k = 0, nlegend-1 do opt_array[k+1] = lor(pl.PL_LEGEND_LINE, pl.PL_LEGEND_SYMBOL) line_styles[k+1] = 1 - line_widths[k+1] = 1 + line_widths[k+1] = 1. symbol_scales[k+1] = 1.0 symbol_numbers[k+1] = 2 symbols[k+1] = "*" @@ -320,7 +320,7 @@ for k = 0, nlegend-1 do opt_array[k+1] = lor(pl.PL_LEGEND_LINE, pl.PL_LEGEND_SYMBOL) line_styles[k+1] = 1 - line_widths[k+1] = 1 + line_widths[k+1] = 1. symbol_scales[k+1] = 1.0 symbol_numbers[k+1] = 2 symbols[k+1] = "*" @@ -387,14 +387,14 @@ box_colors[2] = 2 box_patterns[2] = 0 box_scales[2] = 0.8 -box_line_widths[2] = 1 +box_line_widths[2] = 1. opt_array[3] = pl.PL_LEGEND_LINE text[3] = "Line" text_colors[3] = 3 line_colors[3] = 3 line_styles[3] = 1 -line_widths[3] = 1 +line_widths[3] = 1. opt_array[4] = pl.PL_LEGEND_SYMBOL text[4] = "Symbol" @@ -409,7 +409,7 @@ text_colors[5] = 5 line_colors[5] = 5 line_styles[5] = 1 -line_widths[5] = 1 +line_widths[5] = 1. symbol_colors[5] = 5 symbol_scales[5] = text_scale symbol_numbers[5] = 4 @@ -479,7 +479,7 @@ box_colors[i+1] = i+1 box_patterns[i+1] = 0 box_scales[i+1] = 0.8 - box_line_widths[i+1] = 1 + box_line_widths[i+1] = 1. end opt = opt_base @@ -505,7 +505,7 @@ box_colors[i+1] = 2 box_patterns[i+1] = i box_scales[i+1] = 0.8 - box_line_widths[i+1] = 1 + box_line_widths[i+1] = 1. end opt = opt_base @@ -550,7 +550,7 @@ text_colors[i+1] = i+1 line_colors[i+1] = i+1 line_styles[i+1] = 1 - line_widths[i+1] = 1 + line_widths[i+1] = 1. end opt = opt_base @@ -575,7 +575,7 @@ text_colors[i+1] = 2 line_colors[i+1] = 2 line_styles[i+1] = i+1 - line_widths[i+1] = 1 + line_widths[i+1] = 1. end opt = opt_base This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-05-04 16:43:38
|
Revision: 12334 http://sourceforge.net/p/plplot/code/12334 Author: airwin Date: 2013-05-04 16:43:33 +0000 (Sat, 04 May 2013) Log Message: ----------- Solve name clash with HAVE_FREETYPE defined in octave headers by renaming the PLplot version PL_HAVE_FREETYPE. This change should be complete because it was done using a combination of find on the whole source tree and sed, i.e., using the command for FILE in $(find -type f |grep -v .svn |xargs grep -l HAVE_FREETYPE); do echo $FILE sed -e "s?HAVE_FREETYPE?PL_HAVE_FREETYPE?g" <$FILE >| /tmp/test_software \mv /tmp/test_software $FILE done One tab was changed afterwards by hand in the output for cmake/modules/summary.cmake, but otherwise visual inspection of these changes showed no issues with this find/sed approach to implement this wholesale change. Tested by: Alan W. Irwin <ai...@us...> using the test_interactive target. Modified Paths: -------------- trunk/bindings/gnome2/lib/gcw-lib.c trunk/bindings/wxwidgets/wxPLplotstream.cpp trunk/bindings/wxwidgets/wxPLplotstream.h.in trunk/cmake/modules/freetype.cmake trunk/cmake/modules/summary.cmake trunk/config.h.cmake trunk/doc/docbook/src/advanced.xml trunk/drivers/gcw.c trunk/drivers/gd.c trunk/drivers/wingcc.c trunk/drivers/wxwidgets.cpp trunk/drivers/wxwidgets.h trunk/drivers/wxwidgets_agg.cpp trunk/drivers/wxwidgets_dc.cpp trunk/drivers/wxwidgets_gc.cpp trunk/include/plfreetype.h trunk/include/plplotP.h trunk/src/plfreetype.c Modified: trunk/bindings/gnome2/lib/gcw-lib.c =================================================================== --- trunk/bindings/gnome2/lib/gcw-lib.c 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/bindings/gnome2/lib/gcw-lib.c 2013-05-04 16:43:33 UTC (rev 12334) @@ -886,7 +886,7 @@ gcw_debug( "<gcw_use_text>\n" ); #endif -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( use_text ) plsc->dev_text = 1; // Allow text handling Modified: trunk/bindings/wxwidgets/wxPLplotstream.cpp =================================================================== --- trunk/bindings/wxwidgets/wxPLplotstream.cpp 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/bindings/wxwidgets/wxPLplotstream.cpp 2013-05-04 16:43:33 UTC (rev 12334) @@ -59,7 +59,7 @@ // use freetype, antialized canvas? char drvopt[bufferSize], buffer[bufferSize]; drvopt[0] = '\0'; -#ifdef WX_TEMP_HAVE_FREETYPE_IS_ON +#ifdef WX_TEMP_PL_HAVE_FREETYPE_IS_ON sprintf( buffer, "freetype=%d,smooth=%d,", m_style & wxPLPLOT_FREETYPE ? 1 : 0, m_style & wxPLPLOT_SMOOTH_TEXT ? 1 : 0 ); Modified: trunk/bindings/wxwidgets/wxPLplotstream.h.in =================================================================== --- trunk/bindings/wxwidgets/wxPLplotstream.h.in 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/bindings/wxwidgets/wxPLplotstream.h.in 2013-05-04 16:43:33 UTC (rev 12334) @@ -32,7 +32,7 @@ // if freetype is available - in the code we have checks // for the WX_TEMP_...._IS_ON macros (otherwise WX_TEMP_...._IS_OFF // is defined) -#define WX_TEMP_HAVE_FREETYPE_IS_@HAVE_FREETYPE@ +#define WX_TEMP_PL_HAVE_FREETYPE_IS_@PL_HAVE_FREETYPE@ //! Style options for wxPLplotstream: // wxPLPLOT_NONE: no option @@ -47,7 +47,7 @@ enum { wxPLPLOT_NONE = 0, -#ifdef WX_TEMP_HAVE_FREETYPE_IS_ON +#ifdef WX_TEMP_PL_HAVE_FREETYPE_IS_ON wxPLPLOT_FREETYPE = 1 << 0, wxPLPLOT_SMOOTH_TEXT = 1 << 1, #endif Modified: trunk/cmake/modules/freetype.cmake =================================================================== --- trunk/cmake/modules/freetype.cmake 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/cmake/modules/freetype.cmake 2013-05-04 16:43:33 UTC (rev 12334) @@ -121,5 +121,5 @@ endif (WITH_FREETYPE) if (WITH_FREETYPE) - set(HAVE_FREETYPE ON) + set(PL_HAVE_FREETYPE ON) endif (WITH_FREETYPE) Modified: trunk/cmake/modules/summary.cmake =================================================================== --- trunk/cmake/modules/summary.cmake 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/cmake/modules/summary.cmake 2013-05-04 16:43:33 UTC (rev 12334) @@ -106,7 +106,7 @@ Optional libraries: PL_HAVE_QHULL: ${PL_HAVE_QHULL} WITH_CSA: ${WITH_CSA} -HAVE_FREETYPE: ${HAVE_FREETYPE} PL_HAVE_PTHREAD: ${PL_HAVE_PTHREAD} +PL_HAVE_FREETYPE: ${PL_HAVE_FREETYPE} PL_HAVE_PTHREAD: ${PL_HAVE_PTHREAD} HAVE_AGG: ${HAVE_AGG} HAVE_SHAPELIB: ${HAVE_SHAPELIB} Language Bindings: Modified: trunk/config.h.cmake =================================================================== --- trunk/config.h.cmake 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/config.h.cmake 2013-05-04 16:43:33 UTC (rev 12334) @@ -52,7 +52,7 @@ #cmakedefine HAVE_DLFCN_H 1 // Define if [freetype] is available -#cmakedefine HAVE_FREETYPE +#cmakedefine PL_HAVE_FREETYPE // Define if [shapelib] is available #cmakedefine HAVE_SHAPELIB Modified: trunk/doc/docbook/src/advanced.xml =================================================================== --- trunk/doc/docbook/src/advanced.xml 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/doc/docbook/src/advanced.xml 2013-05-04 16:43:33 UTC (rev 12334) @@ -766,7 +766,7 @@ <filename>gd.c</filename> driver. Here we make some notes to accompany this driver which should make it easier to migrate other drivers to use the FreeType library. Every code fragment we mention below should be surrounded - with a <literal>#ifdef HAVE_FREETYPE...#endif</literal> to quarantine these + with a <literal>#ifdef PL_HAVE_FREETYPE...#endif</literal> to quarantine these fragments for systems without the FreeType library. For interactive devices that need caching of text drawing, reference should also be made to <filename>wingcc.c</filename>.</para> @@ -938,7 +938,7 @@ if (dev->waiting==1) { plRemakePlot(pls); - #ifdef HAVE_FREETYPE + #ifdef PL_HAVE_FREETYPE pl_RemakeFreeType_text_from_buffer(pls); #endif } @@ -978,7 +978,7 @@ { fclose(pls->OutFile); - #ifdef HAVE_FREETYPE + #ifdef PL_HAVE_FREETYPE FT_Data *FT=(FT_Data *)pls->FT; plscmap0n(FT->ncol0_org); Modified: trunk/drivers/gcw.c =================================================================== --- trunk/drivers/gcw.c 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/drivers/gcw.c 2013-05-04 16:43:33 UTC (rev 12334) @@ -75,7 +75,7 @@ #include "gcw.h" #include "plplotcanvas-hacktext.h" -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE #include "plfreetype.h" #include "plfci-truetype.h" @@ -83,7 +83,7 @@ // Font lookup table that is constructed in plD_FreeType_init extern FCI_to_FontName_Table FontLookup[N_TrueTypeLookup]; -#endif // HAVE_FREETYPE +#endif // PL_HAVE_FREETYPE // Device info @@ -91,7 +91,7 @@ // Global driver options -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE static PLINT text = 1; #else static PLINT text = 0; @@ -204,7 +204,7 @@ pls->dev = dev; // Set text handling -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( text ) { pls->dev_text = TRUE; @@ -724,7 +724,7 @@ gcw_debug( "<plD_tidy_gcw>\n" ); #endif -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( pls->dev_text ) { FT_Data *FT = (FT_Data *) pls->FT; @@ -952,7 +952,7 @@ } } -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE //-------------------------------------------------------------------------- // proc_str() // @@ -1252,7 +1252,7 @@ gcw_debug( "</proc_str>\n" ); #endif } -#endif //HAVE_FREETYPE +#endif //PL_HAVE_FREETYPE //-------------------------------------------------------------------------- @@ -1298,7 +1298,7 @@ fill_polygon( pls ); break; -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE case PLESC_HAS_TEXT: proc_str( pls, ptr ); // Draw the text break; Modified: trunk/drivers/gd.c =================================================================== --- trunk/drivers/gd.c 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/drivers/gd.c 2013-05-04 16:43:33 UTC (rev 12334) @@ -145,12 +145,12 @@ ; #if GD2_VERS >= 2 -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE #define SMOOTH_LINES_OK #endif #endif -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE // // Freetype support has been added to the GD family of drivers using the @@ -159,7 +159,7 @@ // "PLESC_HAS_TEXT" command for rendering within the driver. // // Freetype support is turned on/off at compile time by defining -// "HAVE_FREETYPE". +// "PL_HAVE_FREETYPE". // // To give the user some level of control over the fonts that are used, // environmental variables can be set to over-ride the definitions used by @@ -185,7 +185,7 @@ static void plD_init_gif_Dev( PLStream *pls ); #endif -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE static void plD_pixel_gd( PLStream *pls, short x, short y ); static PLINT plD_read_pixel_gd( PLStream *pls, short x, short y ); @@ -368,7 +368,7 @@ static int palette = 0; static int smooth_line = 0; #endif -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE static int freetype = 1; static int smooth_text = 1; FT_Data *FT; @@ -382,7 +382,7 @@ { "24bit", DRV_INT, &truecolour, "Truecolor (24 bit) mode" }, { "smoothlines", DRV_INT, &smooth_line, "Turn line Anti Aliasing on (1) or off (0)" }, #endif -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE { "text", DRV_INT, &freetype, "Use driver text (FreeType)" }, { "smooth", DRV_INT, &smooth_text, "Turn text smoothing on (1) or off (0)" }, #endif @@ -432,7 +432,7 @@ #endif -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( freetype ) { pls->dev_text = 1; // want to draw text @@ -529,7 +529,7 @@ plP_setphy( 0, dev->scale * dev->pngx, 0, dev->scale * dev->pngy ); -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( pls->dev_text ) { init_freetype_lv2( pls ); @@ -558,7 +558,7 @@ static int black15 = 0; static int red15 = 0; -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE static int freetype = 1; static int smooth_text = 0; FT_Data *FT; @@ -566,7 +566,7 @@ DrvOpt gd_options[] = { { "def_black15", DRV_INT, &black15, "Define idx 15 as black. If the background is \"whiteish\" (from \"-bg\" option), force index 15 (traditionally white) to be \"black\"" }, { "swp_red15", DRV_INT, &red15, "Swap index 1 (usually red) and 1 (usually white); always done after \"black15\"; quite useful for quick changes to web pages" }, -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE { "text", DRV_INT, &freetype, "Use driver text (FreeType)" }, { "smooth", DRV_INT, &smooth_text, "Turn text smoothing on (1) or off (0)" }, #endif @@ -597,7 +597,7 @@ dev->palette = 1; // Always use palette mode for GIF files dev->truecolour = 0; // Never have truecolour in GIFS -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( freetype ) { pls->dev_text = 1; // want to draw text @@ -684,7 +684,7 @@ plP_setphy( 0, dev->scale * dev->pngx, 0, dev->scale * dev->pngy ); -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( pls->dev_text ) { init_freetype_lv2( pls ); @@ -1046,7 +1046,7 @@ fill_polygon( pls ); break; -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE case PLESC_HAS_TEXT: plD_render_freetype_text( pls, (EscText *) ptr ); break; @@ -1145,7 +1145,7 @@ void plD_tidy_png( PLStream *pls ) { -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( pls->dev_text ) { plD_FreeType_Destroy( pls ); @@ -1352,7 +1352,7 @@ #endif -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE //-------------------------------------------------------------------------- // void plD_pixel_gd (PLStream *pls, short x, short y) Modified: trunk/drivers/wingcc.c =================================================================== --- trunk/drivers/wingcc.c 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/drivers/wingcc.c 2013-05-04 16:43:33 UTC (rev 12334) @@ -37,7 +37,7 @@ #include "drivers.h" #include "plevent.h" -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE // // Freetype support has been added to the wingcc driver using the @@ -46,7 +46,7 @@ // "PLESC_HAS_TEXT" command for rendering within the driver. // // Freetype support is turned on/off at compile time by defining -// "HAVE_FREETYPE". +// "PL_HAVE_FREETYPE". // // To give the user some level of control over the fonts that are used, // environmental variables can be set to over-ride the definitions used by @@ -129,7 +129,7 @@ void plD_state_wingcc( PLStream *, PLINT ); void plD_esc_wingcc( PLStream *, PLINT, void * ); -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE static void plD_pixel_wingcc( PLStream *pls, short x, short y ); static void plD_pixelV_wingcc( PLStream *pls, short x, short y ); @@ -408,7 +408,7 @@ { wingcc_Dev *dev; -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE static int freetype = 0; static int smooth_text = 0; static int save_reg = 0; @@ -424,7 +424,7 @@ #endif DrvOpt wingcc_options[] = { -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE { "text", DRV_INT, &freetype, "Use driver text (FreeType)" }, { "smooth", DRV_INT, &smooth_text, "Turn text smoothing on (1) or off (0)" }, { "save", DRV_INT, &save_reg, "Save defaults to registary" }, @@ -464,7 +464,7 @@ pls->color = 1; -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE // // Read registry to see if the user has set up default values @@ -482,7 +482,7 @@ plParseDrvOpts( wingcc_options ); -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE // // We will now save the settings to the registary if the user wants @@ -603,7 +603,7 @@ AppendMenu( dev->PopupMenu, MF_STRING, PopupNextPage, _T( "Next Page" ) ); AppendMenu( dev->PopupMenu, MF_STRING, PopupQuit, _T( "Quit" ) ); -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( freetype ) { @@ -674,7 +674,7 @@ else SetPolyFillMode( dev->hdc, WINDING ); -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( pls->dev_text ) { init_freetype_lv2( pls ); @@ -900,7 +900,7 @@ plD_bop_wingcc( PLStream *pls ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE FT_Data *FT = (FT_Data *) pls->FT; #endif Debug( "Start of Page\t" ); @@ -922,7 +922,7 @@ { wingcc_Dev *dev = NULL; -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( pls->dev_text ) { FT_Data *FT = (FT_Data *) pls->FT; @@ -1010,7 +1010,7 @@ SetROP2( dev->hdc, R2_XORPEN ); break; -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE case PLESC_HAS_TEXT: plD_render_freetype_text( pls, (EscText *) ptr ); break; @@ -1039,7 +1039,7 @@ static void Resize( PLStream *pls ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE FT_Data *FT = (FT_Data *) pls->FT; #endif Debug( "Resizing" ); @@ -1066,7 +1066,7 @@ dev->scale = (PLFLT) PIXELS_Y / dev->height; } -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( FT ) { FT->scale = dev->scale; @@ -1146,7 +1146,7 @@ return ( ret ); } -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE //-------------------------------------------------------------------------- // void plD_pixel_wingcc (PLStream *pls, short x, short y) @@ -1330,7 +1330,7 @@ static void UpdatePageMetrics( PLStream *pls, char flag ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; - #ifdef HAVE_FREETYPE + #ifdef PL_HAVE_FREETYPE FT_Data *FT = (FT_Data *) pls->FT; #endif @@ -1355,7 +1355,7 @@ dev->scale = (PLFLT) PIXELS_Y / dev->height; } - #ifdef HAVE_FREETYPE + #ifdef PL_HAVE_FREETYPE if ( FT ) // If we are using freetype, then set it up next { FT->scale = dev->scale; @@ -1384,7 +1384,7 @@ static void PrintPage( PLStream *pls ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; - #ifdef HAVE_FREETYPE + #ifdef PL_HAVE_FREETYPE FT_Data *FT = (FT_Data *) pls->FT; #endif PRINTDLG Printer; @@ -1435,7 +1435,7 @@ UpdatePageMetrics( pls, 1 ); - #ifdef HAVE_FREETYPE + #ifdef PL_HAVE_FREETYPE if ( FT ) // If we are using freetype, then set it up next { dev->FT_smooth_text = FT->smooth_text; // When printing, we don't want smoothing @@ -1458,7 +1458,7 @@ dev->hdc = dev->SCRN_hdc; // Reset the screen HDC to the default UpdatePageMetrics( pls, 0 ); - #ifdef HAVE_FREETYPE + #ifdef PL_HAVE_FREETYPE if ( FT ) // If we are using freetype, then set it up next { FT->smooth_text = dev->FT_smooth_text; Modified: trunk/drivers/wxwidgets.cpp =================================================================== --- trunk/drivers/wxwidgets.cpp 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/drivers/wxwidgets.cpp 2013-05-04 16:43:33 UTC (rev 12334) @@ -42,7 +42,7 @@ #include "wxwidgets.h" // Static function prototypes -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE static void plD_pixel_wxwidgets( PLStream *pls, short x, short y ); static PLINT plD_read_pixel_wxwidgets( PLStream *pls, short x, short y ); static void plD_set_pixel_wxwidgets( PLStream *pls, short x, short y, PLINT colour ); @@ -352,7 +352,7 @@ #endif DrvOpt wx_options[] = { -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE { "freetype", DRV_INT, &freetype, "Use FreeType library" }, { "smooth", DRV_INT, &smooth_text, "Turn text smoothing on (1) or off (0)" }, #endif @@ -431,7 +431,7 @@ pls->dev_hrshsym = 1; } -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE // own text routines have higher priority over freetype // if text and freetype option are set to 1 if ( !text ) @@ -498,7 +498,7 @@ // set dpi plspage( VIRTUAL_PIXELS_PER_IN / dev->scalex, VIRTUAL_PIXELS_PER_IN / dev->scaley, 0, 0, 0, 0 ); -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( dev->freetype ) init_freetype_lv2( pls ); #endif @@ -781,7 +781,7 @@ wxPLDevBase* dev = (wxPLDevBase *) pls->dev; -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( dev->freetype ) { FT_Data *FT = (FT_Data *) pls->FT; @@ -886,7 +886,7 @@ if ( dev->freetype ) { -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE plD_render_freetype_text( pls, (EscText *) ptr ); #endif } @@ -1001,7 +1001,7 @@ } // freetype parameters must also be changed -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE if ( dev->freetype ) { FT_Data *FT = (FT_Data *) pls->FT; @@ -1049,7 +1049,7 @@ -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE //-------------------------------------------------------------------------- // static void plD_pixel_wxwidgets( PLStream *pls, short x, short y ) Modified: trunk/drivers/wxwidgets.h =================================================================== --- trunk/drivers/wxwidgets.h 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/drivers/wxwidgets.h 2013-05-04 16:43:33 UTC (rev 12334) @@ -26,7 +26,7 @@ #include <wx/spinctrl.h> // freetype headers and macros -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE #include "plfreetype.h" #endif @@ -100,11 +100,11 @@ virtual void SetColor0( PLStream *pls ) = 0; virtual void SetColor1( PLStream *pls ) = 0; virtual void SetExternalBuffer( void* buffer ) = 0; -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE virtual void PutPixel( short x, short y, PLINT color ) = 0; virtual void PutPixel( short x, short y ) = 0; virtual PLINT GetPixel( short x, short y ) = 0; -#endif // HAVE_FREETYPE +#endif // PL_HAVE_FREETYPE virtual void ProcessString( PLStream* pls, EscText* args ) = 0; virtual void PSDrawText( PLUNICODE* ucs4, int ucs4Len, bool drawText ); virtual void PSDrawTextToDC( char* utf8_string, bool drawText ) = 0; @@ -193,11 +193,11 @@ void SetColor0( PLStream *pls ); void SetColor1( PLStream *pls ); void SetExternalBuffer( void* buffer ); -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE void PutPixel( short x, short y, PLINT color ); void PutPixel( short x, short y ); PLINT GetPixel( short x, short y ); -#endif // HAVE_FREETYPE +#endif // PL_HAVE_FREETYPE void ProcessString( PLStream* pls, EscText* args ); void PSDrawTextToDC( char* utf8_string, bool drawText ); void PSSetFont( PLUNICODE fci ); @@ -256,11 +256,11 @@ void SetColor0( PLStream *pls ); void SetColor1( PLStream *pls ); void SetExternalBuffer( void* buffer ); -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE void PutPixel( short x, short y, PLINT color ); void PutPixel( short x, short y ); PLINT GetPixel( short x, short y ); -#endif // HAVE_FREETYPE +#endif // PL_HAVE_FREETYPE void ProcessString( PLStream* pls, EscText* args ); void PSDrawTextToDC( char* utf8_string, bool drawText ); void PSSetFont( PLUNICODE fci ); @@ -324,11 +324,11 @@ void SetColor0( PLStream *pls ); void SetColor1( PLStream *pls ); void SetExternalBuffer( void* buffer ); -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE void PutPixel( short x, short y, PLINT color ); void PutPixel( short x, short y ); PLINT GetPixel( short x, short y ); -#endif // HAVE_FREETYPE +#endif // PL_HAVE_FREETYPE void ProcessString( PLStream* pls, EscText* args ); void PSDrawTextToDC( char* utf8_string, bool drawText ); void PSSetFont( PLUNICODE fci ); Modified: trunk/drivers/wxwidgets_agg.cpp =================================================================== --- trunk/drivers/wxwidgets_agg.cpp 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/drivers/wxwidgets_agg.cpp 2013-05-04 16:43:33 UTC (rev 12334) @@ -442,7 +442,7 @@ } -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE //-------------------------------------------------------------------------- // void wxPLDevAGG::PutPixel( short x, short y, PLINT color ) @@ -478,7 +478,7 @@ return RGB( mBuffer->GetRed( x, y ), mBuffer->GetGreen( x, y ), mBuffer->GetBlue( x, y ) ); } -#endif // HAVE_FREETYPE +#endif // PL_HAVE_FREETYPE void wxPLDevAGG::PSDrawTextToDC( char* utf8_string, bool drawText ) Modified: trunk/drivers/wxwidgets_dc.cpp =================================================================== --- trunk/drivers/wxwidgets_dc.cpp 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/drivers/wxwidgets_dc.cpp 2013-05-04 16:43:33 UTC (rev 12334) @@ -272,7 +272,7 @@ } -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE //-------------------------------------------------------------------------- // void wxPLDevDC::PutPixel( short x, short y, PLINT color ) @@ -323,7 +323,7 @@ #endif } -#endif // HAVE_FREETYPE +#endif // PL_HAVE_FREETYPE //-------------------------------------------------------------------------- Modified: trunk/drivers/wxwidgets_gc.cpp =================================================================== --- trunk/drivers/wxwidgets_gc.cpp 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/drivers/wxwidgets_gc.cpp 2013-05-04 16:43:33 UTC (rev 12334) @@ -321,7 +321,7 @@ } -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE void wxPLDevGC::PutPixel( short x, short y, PLINT color ) { @@ -363,7 +363,7 @@ #endif } -#endif // HAVE_FREETYPE +#endif // PL_HAVE_FREETYPE void wxPLDevGC::PSDrawTextToDC( char* utf8_string, bool drawText ) Modified: trunk/include/plfreetype.h =================================================================== --- trunk/include/plfreetype.h 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/include/plfreetype.h 2013-05-04 16:43:33 UTC (rev 12334) @@ -28,7 +28,7 @@ #ifndef __PLFREETY_H__ #define __PLFREETY_H__ -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE #include <ft2build.h> #include FT_FREETYPE_H Modified: trunk/include/plplotP.h =================================================================== --- trunk/include/plplotP.h 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/include/plplotP.h 2013-05-04 16:43:33 UTC (rev 12334) @@ -1208,7 +1208,7 @@ plGetDrvDir( void ); #endif -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE PLDLLIMPEXP void plD_FreeType_init( PLStream * ); Modified: trunk/src/plfreetype.c =================================================================== --- trunk/src/plfreetype.c 2013-05-04 16:35:59 UTC (rev 12333) +++ trunk/src/plfreetype.c 2013-05-04 16:43:33 UTC (rev 12334) @@ -91,7 +91,7 @@ #include "plDevs.h" #include "plplotP.h" #include "drivers.h" -#ifdef HAVE_FREETYPE +#ifdef PL_HAVE_FREETYPE #include "plfreetype.h" #include "plfci-truetype.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2013-05-10 19:01:19
|
Revision: 12336 http://sourceforge.net/p/plplot/code/12336 Author: andrewross Date: 2013-05-10 19:01:13 +0000 (Fri, 10 May 2013) Log Message: ----------- Update C++ bindings for changes to pllegend line width arguments from PLINT to PLFLT. Modified Paths: -------------- trunk/bindings/c++/plstream.cc trunk/bindings/c++/plstream.h trunk/cmake/modules/c++.cmake trunk/examples/c++/x04.cc trunk/examples/c++/x26.cc trunk/examples/c++/x33.cc Modified: trunk/bindings/c++/plstream.cc =================================================================== --- trunk/bindings/c++/plstream.cc 2013-05-04 17:18:54 UTC (rev 12335) +++ trunk/bindings/c++/plstream.cc 2013-05-10 19:01:13 UTC (rev 12336) @@ -995,11 +995,11 @@ PLINT nlegend, const PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLFLT text_justification, - const PLINT *text_colors, const char **text, + const PLINT *text_colors, const char * const *text, const PLINT *box_colors, const PLINT *box_patterns, - const PLFLT *box_scales, const PLINT *box_line_widths, + const PLFLT *box_scales, const PLFLT *box_line_widths, const PLINT *line_colors, const PLINT *line_styles, - const PLINT *line_widths, + const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers, const char **symbols ) { Modified: trunk/bindings/c++/plstream.h =================================================================== --- trunk/bindings/c++/plstream.h 2013-05-04 17:18:54 UTC (rev 12335) +++ trunk/bindings/c++/plstream.h 2013-05-10 19:01:13 UTC (rev 12336) @@ -434,11 +434,11 @@ PLINT nlegend, const PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLFLT text_justification, - const PLINT *text_colors, const char **text, + const PLINT *text_colors, const char * const *text, const PLINT *box_colors, const PLINT *box_patterns, - const PLFLT *box_scales, const PLINT *box_line_widths, + const PLFLT *box_scales, const PLFLT *box_line_widths, const PLINT *line_colors, const PLINT *line_styles, - const PLINT *line_widths, + const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers, const char **symbols ); Modified: trunk/cmake/modules/c++.cmake =================================================================== --- trunk/cmake/modules/c++.cmake 2013-05-04 17:18:54 UTC (rev 12335) +++ trunk/cmake/modules/c++.cmake 2013-05-10 19:01:13 UTC (rev 12336) @@ -25,7 +25,7 @@ if(DEFAULT_NO_BINDINGS) OPTION(ENABLE_cxx "Enable C++ bindings" OFF) else(DEFAULT_NO_BINDINGS) - OPTION(ENABLE_cxx "Enable C++ bindings" OFF) + OPTION(ENABLE_cxx "Enable C++ bindings" ON) endif(DEFAULT_NO_BINDINGS) if(NOT PLPLOT_CXX_COMPILER_WORKS) Modified: trunk/examples/c++/x04.cc =================================================================== --- trunk/examples/c++/x04.cc 2013-05-04 17:18:54 UTC (rev 12335) +++ trunk/examples/c++/x04.cc 2013-05-10 19:01:13 UTC (rev 12336) @@ -80,7 +80,7 @@ PLINT text_colors[2]; PLINT line_colors[2]; PLINT line_styles[2]; - PLINT line_widths[2]; + PLFLT line_widths[2]; PLINT symbol_numbers[2], symbol_colors[2]; PLFLT symbol_scales[2]; PLFLT legend_width, legend_height; @@ -152,7 +152,7 @@ text[0] = "Amplitude"; line_colors[0] = 2; line_styles[0] = 1; - line_widths[0] = 1; + line_widths[0] = 1.0; // note from the above opt_array the first symbol (and box) indices // do not have to be specified @@ -162,7 +162,7 @@ text[1] = "Phase shift"; line_colors[1] = 3; line_styles[1] = 1; - line_widths[1] = 1; + line_widths[1] = 1.0; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; @@ -177,7 +177,7 @@ 1, 1, 0, 0, nlegend, opt_array, 1.0, 1.0, 2.0, - 1., text_colors, (const char **) text, + 1., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); Modified: trunk/examples/c++/x26.cc =================================================================== --- trunk/examples/c++/x26.cc 2013-05-04 17:18:54 UTC (rev 12335) +++ trunk/examples/c++/x26.cc 2013-05-10 19:01:13 UTC (rev 12336) @@ -163,7 +163,7 @@ PLINT text_colors[2]; PLINT line_colors[2]; PLINT line_styles[2]; - PLINT line_widths[2]; + PLFLT line_widths[2]; PLINT symbol_numbers[2], symbol_colors[2]; PLFLT symbol_scales[2]; const char *symbols[2]; @@ -234,7 +234,7 @@ text_colors[0] = 2; line_colors[0] = 2; line_styles[0] = 1; - line_widths[0] = 1; + line_widths[0] = 1.0; // note from the above opt_array the first symbol (and box) indices // do not have to be specified @@ -243,7 +243,7 @@ text_colors[1] = 3; line_colors[1] = 3; line_styles[1] = 1; - line_widths[1] = 1; + line_widths[1] = 1.0; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; @@ -258,7 +258,7 @@ 1, 1, 0, 0, nlegend, opt_array, 1.0, 1.0, 2.0, - 1., text_colors, (const char **) legend_text, + 1., text_colors, (const char * const *) legend_text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, Modified: trunk/examples/c++/x33.cc =================================================================== --- trunk/examples/c++/x33.cc 2013-05-04 17:18:54 UTC (rev 12335) +++ trunk/examples/c++/x33.cc 2013-05-10 19:01:13 UTC (rev 12336) @@ -259,10 +259,10 @@ PLINT box_colors[MAX_NLEGEND]; PLINT box_patterns[MAX_NLEGEND]; PLFLT box_scales[MAX_NLEGEND]; - PLINT box_line_widths[MAX_NLEGEND]; + PLFLT box_line_widths[MAX_NLEGEND]; PLINT line_colors[MAX_NLEGEND]; PLINT line_styles[MAX_NLEGEND]; - PLINT line_widths[MAX_NLEGEND]; + PLFLT line_widths[MAX_NLEGEND]; PLINT symbol_numbers[MAX_NLEGEND], symbol_colors[MAX_NLEGEND]; PLFLT symbol_scales[MAX_NLEGEND]; char *text[MAX_NLEGEND]; @@ -298,7 +298,7 @@ opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; opt_array[0] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[0] = 1; - line_widths[0] = 1; + line_widths[0] = 1.0; symbol_scales[0] = 1.; symbol_numbers[0] = 4; symbols[0] = "*"; @@ -344,7 +344,7 @@ { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; - line_widths[k] = 1; + line_widths[k] = 1.0; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; @@ -484,7 +484,7 @@ { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; - line_widths[k] = 1; + line_widths[k] = 1.0; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; @@ -553,14 +553,14 @@ box_colors[1] = 2; box_patterns[1] = 0; box_scales[1] = 0.8; - box_line_widths[1] = 1; + box_line_widths[1] = 1.0; opt_array[2] = PL_LEGEND_LINE; sprintf( text[2], "%s", "Line" ); text_colors[2] = 3; line_colors[2] = 3; line_styles[2] = 1; - line_widths[2] = 1; + line_widths[2] = 1.0; opt_array[3] = PL_LEGEND_SYMBOL; sprintf( text[3], "%s", "Symbol" ); @@ -575,7 +575,7 @@ text_colors[4] = 5; line_colors[4] = 5; line_styles[4] = 1; - line_widths[4] = 1; + line_widths[4] = 1.0; symbol_colors[4] = 5; symbol_scales[4] = text_scale; symbol_numbers[4] = 4; @@ -652,7 +652,7 @@ box_colors[i] = i + 1; box_patterns[i] = 0; box_scales[i] = 0.8; - box_line_widths[i] = 1; + box_line_widths[i] = 1.0; } opt = opt_base; @@ -680,7 +680,7 @@ box_colors[i] = 2; box_patterns[i] = i; box_scales[i] = 0.8; - box_line_widths[i] = 1; + box_line_widths[i] = 1.0; } opt = opt_base; @@ -705,7 +705,7 @@ box_colors[i] = 2; box_patterns[i] = 3; box_scales[i] = 0.8; - box_line_widths[i] = i + 1; + box_line_widths[i] = i + 1.0; } opt = opt_base; @@ -729,7 +729,7 @@ text_colors[i] = i + 1; line_colors[i] = i + 1; line_styles[i] = 1; - line_widths[i] = 1; + line_widths[i] = 1.0; } opt = opt_base; @@ -756,7 +756,7 @@ text_colors[i] = 2; line_colors[i] = 2; line_styles[i] = i + 1; - line_widths[i] = 1; + line_widths[i] = 1.0; } opt = opt_base; @@ -780,7 +780,7 @@ text_colors[i] = 2; line_colors[i] = 2; line_styles[i] = 1; - line_widths[i] = i + 1; + line_widths[i] = i + 1.0; } opt = opt_base; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2013-05-10 20:16:34
|
Revision: 12337 http://sourceforge.net/p/plplot/code/12337 Author: andrewross Date: 2013-05-10 20:16:29 +0000 (Fri, 10 May 2013) Log Message: ----------- Update Ada bindings to change line width arguments from Integer to Long_Float in pllegend and plshade. Modified Paths: -------------- trunk/bindings/ada/plplot.adb trunk/bindings/ada/plplot.ads trunk/bindings/ada/plplot_thin.ads trunk/bindings/ada/plplot_traditional.adb trunk/bindings/ada/plplot_traditional.ads trunk/examples/ada/x04a.adb trunk/examples/ada/x15a.adb trunk/examples/ada/x16a.adb trunk/examples/ada/x21a.adb trunk/examples/ada/x26a.adb trunk/examples/ada/x33a.adb trunk/examples/ada/xthick04a.adb trunk/examples/ada/xthick15a.adb trunk/examples/ada/xthick16a.adb trunk/examples/ada/xthick21a.adb trunk/examples/ada/xthick26a.adb trunk/examples/ada/xthick33a.adb Modified: trunk/bindings/ada/plplot.adb =================================================================== --- trunk/bindings/ada/plplot.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/bindings/ada/plplot.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -456,7 +456,7 @@ Title_Label : String := To_String(Default_Label_String); Axis_Style : Axis_Style_Type := Linear_Major_Grid; Color : Plot_Color_Type := Red; - Line_Width : Integer := 1; + Line_Width : Long_Float := 1.0; Line_Style : Line_Style_Type := 1; Justification : Justification_Type := Not_Justified; x_Min_Zoom : Long_Float := Long_Float'small; @@ -1918,8 +1918,9 @@ Label_Text : Legend_String_Array_Type; Box_Colors, Box_Patterns : Integer_Array_1D; Box_Scales : Real_Vector; - Box_Line_Widths : Integer_Array_1D; - Line_Colors, Line_Styles, Line_Widths : Integer_Array_1D; + Box_Line_Widths : Real_Vector; + Line_Colors, Line_Styles : Integer_Array_1D; + Line_Widths : Real_Vector; Symbol_Colors : Integer_Array_1D; Symbol_Scales : Real_Vector; Symbol_Numbers : Integer_Array_1D; @@ -2772,9 +2773,11 @@ Shade_Min, Shade_Max : Long_Float; Select_Color_Map : Natural; -- should be 0 or 1 Color : Long_Float; - Fill_Pattern_Pen_Width : Positive; - Shade_Min_Pen_Color, Shade_Min_Pen_Width : Natural; - Shade_Max_Pen_Color, Shade_Max_Pen_Width : Natural; + Fill_Pattern_Pen_Width : Long_Float; + Shade_Min_Pen_Color : Natural; + Shade_Min_Pen_Width : Long_Float; + Shade_Max_Pen_Color : Natural; + Shade_Max_Pen_Width : Long_Float; Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; @@ -2806,9 +2809,11 @@ Shade_Min, Shade_Max : Long_Float; Select_Color_Map : Natural; -- should be 0 or 1 Color : Long_Float; - Fill_Pattern_Pen_Width : Positive; - Shade_Min_Pen_Color, Shade_Min_Pen_Width : Natural; - Shade_Max_Pen_Color, Shade_Max_Pen_Width : Natural; + Fill_Pattern_Pen_Width : Long_Float; + Shade_Min_Pen_Color : Natural; + Shade_Min_Pen_Width : Long_Float; + Shade_Max_Pen_Color : Natural; + Shade_Max_Pen_Width : Long_Float; Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; @@ -2838,9 +2843,9 @@ Mask_Function_Pointer : Mask_Function_Pointer_Type; x_Min, x_Max, y_Min, y_Max : Long_Float; -- world mins and maxes Contour_Levels : Real_Vector; - Fill_Pattern_Pen_Width : Natural; -- 0 is allowed + Fill_Pattern_Pen_Width : Long_Float; -- 0.0 is allowed Contour_Pen_Color : Natural; -- 0 for no contours - Contour_Pen_Width : Natural; -- 0 for no contours + Contour_Pen_Width : Long_Float; -- 0.0 for no contours Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; Modified: trunk/bindings/ada/plplot.ads =================================================================== --- trunk/bindings/ada/plplot.ads 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/bindings/ada/plplot.ads 2013-05-10 20:16:29 UTC (rev 12337) @@ -139,8 +139,8 @@ type Color_Array_Type is array (1..Max_Lines_For_Multiplot) of Plot_Color_Type; Default_Color_Array : Color_Array_Type := (Red, Blue, Green, Salmon, BlueViolet); - type Line_Width_Array_Type is array (1..Max_Lines_For_Multiplot) of Integer; - Default_Line_Width_Array : Line_Width_Array_Type := (1, 1, 1, 1, 1); + type Line_Width_Array_Type is array (1..Max_Lines_For_Multiplot) of Long_Float; + Default_Line_Width_Array : Line_Width_Array_Type := (1.0, 1.0, 1.0, 1.0, 1.0); type Line_Style_Array_Type is array (1..Max_Lines_For_Multiplot) of Line_Style_Type; Default_Line_Style_Array : Line_Style_Array_Type := (1, 1, 1, 1, 1); @@ -614,7 +614,7 @@ Title_Label : String := To_String(Default_Label_String); Axis_Style : Axis_Style_Type := Linear_Major_Grid; Color : Plot_Color_Type := Red; - Line_Width : Integer := 1; + Line_Width : Long_Float := 1.0; Line_Style : Line_Style_Type := 1; Justification : Justification_Type := Not_Justified; x_Min_Zoom : Long_Float := Long_Float'small; @@ -1308,8 +1308,9 @@ Label_Text : Legend_String_Array_Type; Box_Colors, Box_Patterns : Integer_Array_1D; Box_Scales : Real_Vector; - Box_Line_Widths : Integer_Array_1D; - Line_Colors, Line_Styles, Line_Widths : Integer_Array_1D; + Box_Line_Widths : Real_Vector; + Line_Colors, Line_Styles : Integer_Array_1D; + Line_Widths : Real_Vector; Symbol_Colors : Integer_Array_1D; Symbol_Scales : Real_Vector; Symbol_Numbers : Integer_Array_1D; @@ -1767,9 +1768,11 @@ Shade_Min, Shade_Max : Long_Float; Select_Color_Map : Natural; -- should be 0 or 1 Color : Long_Float; - Fill_Pattern_Pen_Width : Positive; - Shade_Min_Pen_Color, Shade_Min_Pen_Width : Natural; - Shade_Max_Pen_Color, Shade_Max_Pen_Width : Natural; + Fill_Pattern_Pen_Width : Long_Float; + Shade_Min_Pen_Color : Natural; + Shade_Min_Pen_Width : Long_Float; + Shade_Max_Pen_Color : Natural; + Shade_Max_Pen_Width : Long_Float; Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; @@ -1784,9 +1787,11 @@ Shade_Min, Shade_Max : Long_Float; Select_Color_Map : Natural; -- should be 0 or 1 Color : Long_Float; - Fill_Pattern_Pen_Width : Positive; - Shade_Min_Pen_Color, Shade_Min_Pen_Width : Natural; - Shade_Max_Pen_Color, Shade_Max_Pen_Width : Natural; + Fill_Pattern_Pen_Width : Long_Float; + Shade_Min_Pen_Color : Natural; + Shade_Min_Pen_Width : Long_Float; + Shade_Max_Pen_Color : Natural; + Shade_Max_Pen_Width : Long_Float; Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; @@ -1799,9 +1804,9 @@ Mask_Function_Pointer : Mask_Function_Pointer_Type; x_Min, x_Max, y_Min, y_Max : Long_Float; -- world mins and maxes Contour_Levels : Real_Vector; - Fill_Pattern_Pen_Width : Natural; -- 0 is allowed + Fill_Pattern_Pen_Width : Long_Float; -- 0 is allowed Contour_Pen_Color : Natural; -- 0 for no contours - Contour_Pen_Width : Natural; -- 0 for no contours + Contour_Pen_Width : Long_Float; -- 0 for no contours Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; Modified: trunk/bindings/ada/plplot_thin.ads =================================================================== --- trunk/bindings/ada/plplot_thin.ads 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/bindings/ada/plplot_thin.ads 2013-05-10 20:16:29 UTC (rev 12337) @@ -1078,9 +1078,9 @@ text_colors : PL_Integer_Array; -- fixme these are actually colors; map to them in Ada text : PL_Legend_String_Array; box_colors : PL_Integer_Array; box_patterns : PL_Integer_Array; - box_scales : PL_Float_Array; box_line_widths : PL_Integer_Array; + box_scales : PL_Float_Array; box_line_widths : PL_Float_Array; line_colors : PL_Integer_Array; line_styles : PL_Integer_Array; - line_widths : PL_Integer_Array; + line_widths : PL_Float_Array; symbol_colors : PL_Integer_Array; symbol_scales : PL_Float_Array; symbol_numbers : PL_Integer_Array; symbols : PL_Legend_String_Array); @@ -1529,9 +1529,9 @@ plshade(a : Long_Float_Pointer_Array; nx : PLINT; ny : PLINT; defined : Mask_Function_Pointer_Type; left : PLFLT; right : PLFLT; bottom : PLFLT; top : PLFLT; shade_min : PLFLT; shade_max : PLFLT; - sh_cmap : PLINT; sh_color : PLFLT; sh_width : PLINT; - min_color : PLINT; min_width : PLINT; - max_color : PLINT; max_width : PLINT; + sh_cmap : PLINT; sh_color : PLFLT; sh_width : PLFLT; + min_color : PLINT; min_width : PLFLT; + max_color : PLINT; max_width : PLFLT; fill : Fill_Procedure_Pointer_Type; rectangular : PLINT; pltr : Transformation_Procedure_Pointer_Type; pltr_data : PLpointer); pragma Import(C, plshade, "c_plshade"); @@ -1541,9 +1541,9 @@ plshade1(a : PL_Float_Array_2D; nx : PLINT; ny : PLINT; defined : Mask_Function_Pointer_Type; left : PLFLT; right : PLFLT; bottom : PLFLT; top : PLFLT; shade_min : PLFLT; shade_max : PLFLT; - sh_cmap : PLINT; sh_color : PLFLT; sh_width : PLINT; - min_color : PLINT; min_width : PLINT; - max_color : PLINT; max_width : PLINT; + sh_cmap : PLINT; sh_color : PLFLT; sh_width : PLFLT; + min_color : PLINT; min_width : PLFLT; + max_color : PLINT; max_width : PLFLT; fill : Fill_Procedure_Pointer_Type; rectangular : PLINT; pltr : Transformation_Procedure_Pointer_Type; pltr_data : PLpointer); pragma Import(C, plshade1, "c_plshade1"); @@ -1552,8 +1552,8 @@ procedure plshades(z : Long_Float_Pointer_Array; nx : PLINT; ny : PLINT; defined : Mask_Function_Pointer_Type; xmin : PLFLT; xmax : PLFLT; ymin : PLFLT; ymax : PLFLT; - clevel : PL_Float_Array; nlevel : PLINT; fill_width : PLINT; - cont_color : PLINT; cont_width : PLINT; + clevel : PL_Float_Array; nlevel : PLINT; fill_width : PLFLT; + cont_color : PLINT; cont_width : PLFLT; fill : Fill_Procedure_Pointer_Type; rectangular : PLINT; pltr : Transformation_Procedure_Pointer_Type; pltr_data : PLpointer); pragma Import(C, plshades, "c_plshades"); Modified: trunk/bindings/ada/plplot_traditional.adb =================================================================== --- trunk/bindings/ada/plplot_traditional.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/bindings/ada/plplot_traditional.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -458,7 +458,7 @@ Title_Label : String := To_String(Default_Label_String); Axis_Style : Axis_Style_Type := Linear_Major_Grid; Color : Plot_Color_Type := Red; - Line_Width : Integer := 1; + Line_Width : Long_Float := 1.0; Line_Style : Line_Style_Type := 1; Justification : Justification_Type := Not_Justified; x_Min_Zoom : Long_Float := Long_Float'small; @@ -1849,8 +1849,9 @@ Label_Text : Legend_String_Array_Type; Box_Colors, Box_Patterns : Integer_Array_1D; Box_Scales : Real_Vector; - Box_Line_Widths : Integer_Array_1D; - Line_Colors, Line_Styles, Line_Widths : Integer_Array_1D; + Box_Line_Widths : Real_Vector; + Line_Colors, Line_Styles : Integer_Array_1D; + Line_Widths : Real_Vector; Symbol_Colors : Integer_Array_1D; Symbol_Scales : Real_Vector; Symbol_Numbers : Integer_Array_1D; @@ -2648,9 +2649,11 @@ Shade_Min, Shade_Max : Long_Float; Select_Color_Map : Natural; -- should be 0 or 1 Color : Long_Float; - Fill_Pattern_Pen_Width : Positive; - Shade_Min_Pen_Color, Shade_Min_Pen_Width : Natural; - Shade_Max_Pen_Color, Shade_Max_Pen_Width : Natural; + Fill_Pattern_Pen_Width : Long_Float; + Shade_Min_Pen_Color : Natural; + Shade_Min_Pen_Width : Long_Float; + Shade_Max_Pen_Color : Natural; + Shade_Max_Pen_Width : Long_Float; Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; @@ -2681,9 +2684,11 @@ Shade_Min, Shade_Max : Long_Float; Select_Color_Map : Natural; -- should be 0 or 1 Color : Long_Float; - Fill_Pattern_Pen_Width : Positive; - Shade_Min_Pen_Color, Shade_Min_Pen_Width : Natural; - Shade_Max_Pen_Color, Shade_Max_Pen_Width : Natural; + Fill_Pattern_Pen_Width : Long_Float; + Shade_Min_Pen_Color : Natural; + Shade_Min_Pen_Width : Long_Float; + Shade_Max_Pen_Color : Natural; + Shade_Max_Pen_Width : Long_Float; Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; @@ -2712,9 +2717,9 @@ Mask_Function_Pointer : Mask_Function_Pointer_Type; x_Min, x_Max, y_Min, y_Max : Long_Float; -- world mins and maxes Contour_Levels : Real_Vector; - Fill_Pattern_Pen_Width : Natural; -- 0 is allowed + Fill_Pattern_Pen_Width : Long_Float; -- 0.0 is allowed Contour_Pen_Color : Natural; -- 0 for no contours - Contour_Pen_Width : Natural; -- 0 for no contours + Contour_Pen_Width : Long_Float; -- 0.0 for no contours Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; Modified: trunk/bindings/ada/plplot_traditional.ads =================================================================== --- trunk/bindings/ada/plplot_traditional.ads 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/bindings/ada/plplot_traditional.ads 2013-05-10 20:16:29 UTC (rev 12337) @@ -137,8 +137,8 @@ type Color_Array_Type is array (1..Max_Lines_For_Multiplot) of Plot_Color_Type; Default_Color_Array : Color_Array_Type := (Red, Blue, Green, Salmon, BlueViolet); - type Line_Width_Array_Type is array (1..Max_Lines_For_Multiplot) of Integer; - Default_Line_Width_Array : Line_Width_Array_Type := (1, 1, 1, 1, 1); + type Line_Width_Array_Type is array (1..Max_Lines_For_Multiplot) of Long_Float; + Default_Line_Width_Array : Line_Width_Array_Type := (1.0, 1.0, 1.0, 1.0, 1.0); type Line_Style_Array_Type is array (1..Max_Lines_For_Multiplot) of Line_Style_Type; Default_Line_Style_Array : Line_Style_Array_Type := (1, 1, 1, 1, 1); @@ -612,7 +612,7 @@ Title_Label : String := To_String(Default_Label_String); Axis_Style : Axis_Style_Type := Linear_Major_Grid; Color : Plot_Color_Type := Red; - Line_Width : Integer := 1; + Line_Width : Long_Float := 1.0; Line_Style : Line_Style_Type := 1; Justification : Justification_Type := Not_Justified; x_Min_Zoom : Long_Float := Long_Float'small; @@ -1234,8 +1234,9 @@ Label_Text : Legend_String_Array_Type; Box_Colors, Box_Patterns : Integer_Array_1D; Box_Scales : Real_Vector; - Box_Line_Widths : Integer_Array_1D; - Line_Colors, Line_Styles, Line_Widths : Integer_Array_1D; + Box_Line_Widths : Real_Vector; + Line_Colors, Line_Styles : Integer_Array_1D; + Line_Widths : Real_Vector; Symbol_Colors : Integer_Array_1D; Symbol_Scales : Real_Vector; Symbol_Numbers : Integer_Array_1D; @@ -1636,9 +1637,11 @@ Shade_Min, Shade_Max : Long_Float; Select_Color_Map : Natural; -- should be 0 or 1 Color : Long_Float; - Fill_Pattern_Pen_Width : Positive; - Shade_Min_Pen_Color, Shade_Min_Pen_Width : Natural; - Shade_Max_Pen_Color, Shade_Max_Pen_Width : Natural; + Fill_Pattern_Pen_Width : Long_Float; + Shade_Min_Pen_Color : Natural; + Shade_Min_Pen_Width : Long_Float; + Shade_Max_Pen_Color : Natural; + Shade_Max_Pen_Width : Long_Float; Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; @@ -1652,9 +1655,11 @@ Shade_Min, Shade_Max : Long_Float; Select_Color_Map : Natural; -- should be 0 or 1 Color : Long_Float; - Fill_Pattern_Pen_Width : Positive; - Shade_Min_Pen_Color, Shade_Min_Pen_Width : Natural; - Shade_Max_Pen_Color, Shade_Max_Pen_Width : Natural; + Fill_Pattern_Pen_Width : Long_Float; + Shade_Min_Pen_Color : Natural; + Shade_Min_Pen_Width : Long_Float; + Shade_Max_Pen_Color : Natural; + Shade_Max_Pen_Width : Long_Float; Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; @@ -1666,9 +1671,9 @@ Mask_Function_Pointer : Mask_Function_Pointer_Type; x_Min, x_Max, y_Min, y_Max : Long_Float; -- world mins and maxes Contour_Levels : Real_Vector; - Fill_Pattern_Pen_Width : Natural; -- 0 is allowed + Fill_Pattern_Pen_Width : Long_Float; -- 0.0 is allowed Contour_Pen_Color : Natural; -- 0 for no contours - Contour_Pen_Width : Natural; -- 0 for no contours + Contour_Pen_Width : Long_Float; -- 0.0 for no contours Fill_Procedure_Pointer : Fill_Procedure_Pointer_Type; Preserve_Rectangles : Boolean; Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; Modified: trunk/examples/ada/x04a.adb =================================================================== --- trunk/examples/ada/x04a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/x04a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -94,14 +94,13 @@ declare text, symbols : Legend_String_Array_Type(0 .. 1); opt_array : Integer_Array_1D(0 .. 1); - text_colors, line_colors, line_styles, line_widths : Integer_Array_1D(0..1); + text_colors, line_colors, line_styles: Integer_Array_1D(0..1); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 1); - symbol_scales : Real_Vector(0 .. 1); + line_widths, symbol_scales : Real_Vector(0 .. 1); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. - Box_Colors, Box_Patterns, Box_Line_Widths : Integer_Array_1D(0 .. 1) - := (others => 0); - Box_Scales : Real_Vector(0 .. 1):= (others => 1.0); + Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 1):= (others => 0); + Box_Scales, Box_Line_Widths : Real_Vector(0 .. 1):= (others => 1.0); begin -- First legend entry. opt_array(0) := Legend_Line; @@ -109,7 +108,7 @@ text(0) := To_Unbounded_String("Amplitude"); line_colors(0) := 2; line_styles(0) := 1; - line_widths(0) := 1; + line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. @@ -121,7 +120,7 @@ text(1) := To_Unbounded_String("Phase shift"); line_colors(1) := 3; line_styles(1) := 1; - line_widths(1) := 1; + line_widths(1) := 1.0; symbol_colors(1) := 3; symbol_scales(1) := 1.0; symbol_numbers(1) := 4; @@ -144,13 +143,13 @@ declare text, symbols : Legend_String_Array_Type(0 .. 0); opt_array : Integer_Array_1D(0 .. 0); - text_colors, line_colors, line_styles, line_widths : Integer_Array_1D(0..0); + text_colors, line_colors, line_styles : Integer_Array_1D(0..0); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 0); - symbol_scales : Real_Vector(0 .. 0); + line_widths, symbol_scales : Real_Vector(0 .. 0); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. - Box_Colors, Box_Patterns, Box_Line_Widths : Integer_Array_1D(0 .. 0); - Box_Scales : Real_Vector(0 .. 0); + Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 0); + Box_Scales, Box_Line_Widths : Real_Vector(0 .. 0); begin -- First legend entry. opt_array(0) := Legend_Line; @@ -158,14 +157,14 @@ text(0) := To_Unbounded_String("Amplitude"); line_colors(0) := 2; -- fixme Use declared constants, not integers. line_styles(0) := 1; - line_widths(0) := 1; + line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. symbols(0) := To_Unbounded_String("*"); -- Don't care; not used. Box_Colors(0) := 0; Box_Patterns(0) := 0; - Box_Line_Widths(0) := 0; + Box_Line_Widths(0) := 0.0; Box_Scales(0) := 0.0; pllegend(legend_width, legend_height, Modified: trunk/examples/ada/x15a.adb =================================================================== --- trunk/examples/ada/x15a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/x15a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -85,8 +85,9 @@ procedure plot1 is shade_min, shade_max, sh_color : Long_Float; sh_cmap : Integer := 0; - sh_width : Integer; - min_color, min_width, max_color, max_width : Integer; + sh_width : Long_Float; + min_color, max_color : Integer; + min_width, max_width : Long_Float; begin pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); @@ -96,11 +97,11 @@ shade_min := zmin + (zmax-zmin) * 0.4; shade_max := zmin + (zmax-zmin) * 0.6; sh_color := 7.0; - sh_width := 2; + sh_width := 2.0; min_color := 9; max_color := 2; - min_width := 2; - max_width := 2; + min_width := 2.0; + max_width := 2.0; plpsty(8); @@ -124,8 +125,9 @@ procedure plot2 is shade_min, shade_max, sh_color : Long_Float; sh_cmap : Integer := 0; - sh_width : Integer; - min_color, min_width, max_color, max_width : Integer := 0; + sh_width : Long_Float; + min_color, max_color : Integer := 0; + min_width, max_width : Long_Float := 0.0; -- C run amok. The following arrays are made to accommodate the -- original example which is written in perverse C. @@ -150,7 +152,7 @@ del_0_To_4(3)(0) := 2000; del_0_To_4(4)(0) := 2000; - sh_width := 2; + sh_width := 2.0; pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); Modified: trunk/examples/ada/x16a.adb =================================================================== --- trunk/examples/ada/x16a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/x16a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -64,9 +64,9 @@ (x_Last => nx - 1, y_Last => ny - 1); - fill_width : Integer := 2; - cont_color : Integer := 0; - cont_width : Integer := 0; + fill_width : Long_Float := 2.0; + cont_color : Integer := 0; + cont_width : Long_Float := 0.0; -- Transformation function tr : Real_Vector(0 .. 5); @@ -254,7 +254,7 @@ plshades(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, - 2, 3, + 2, 3.0, plfill'access, False, pltr2'access, cgrid2'Address); plcol0(1); Modified: trunk/examples/ada/x21a.adb =================================================================== --- trunk/examples/ada/x21a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/x21a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -258,7 +258,7 @@ plcol0(15); pllab("X", "Y", title(alg - 1)); plshades(zg, null, xm, xMM, ym, yMM, - clev, 1, 0, 1, plfill'access, True, null, System.Null_Address); + clev, 1.0, 0, 1.0, plfill'access, True, null, System.Null_Address); plcol0(2); else for i in clev'range loop Modified: trunk/examples/ada/x26a.adb =================================================================== --- trunk/examples/ada/x26a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/x26a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -129,15 +129,14 @@ freql, ampl, phase : Real_Vector(0 .. 100); f0, freq : Long_Float; opt_array : Integer_Array_1D(0 .. 1); - text_colors, line_colors, line_styles, line_widths : Integer_Array_1D(0..1); + text_colors, line_colors, line_styles : Integer_Array_1D(0..1); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 1); - symbol_scales : Real_Vector(0 .. 1); + line_widths, symbol_scales : Real_Vector(0 .. 1); symbols : Legend_String_Array_Type(0 .. 1); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. - Box_Colors, Box_Patterns, Box_Line_Widths : Integer_Array_1D(0 .. 1) - := (others => 0); - Box_Scales : Real_Vector(0 .. 1):= (others => 1.0); + Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 1):= (others => 0); + Box_Scales, Box_Line_Widths : Real_Vector(0 .. 1):= (others => 1.0); begin pladv(0); f0 := 1.0; @@ -185,7 +184,7 @@ text_colors(0) := 2; line_colors(0) := 2; line_styles(0) := 1; - line_widths(0) := 1; + line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. @@ -196,7 +195,7 @@ text_colors(1) := 3; line_colors(1) := 3; line_styles(1) := 1; - line_widths(1) := 1; + line_widths(1) := 1.0; symbol_colors(1) := 3; symbol_scales(1) := 1.0; symbol_numbers(1) := 4; Modified: trunk/examples/ada/x33a.adb =================================================================== --- trunk/examples/ada/x33a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/x33a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -285,10 +285,10 @@ box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); - box_line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); - line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); @@ -308,7 +308,7 @@ opt_base := PL_LEGEND_BACKGROUND + PL_LEGEND_BOUNDING_BOX; opt_array(0) := PL_LEGEND_LINE + PL_LEGEND_SYMBOL; line_styles(0) := 1; - line_widths(0) := 1; + line_widths(0) := 1.0; symbol_scales(0) := 1.0; symbol_numbers(0) := 4; symbols(0) := TUB("*"); @@ -349,10 +349,10 @@ box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); - box_line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); - line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); @@ -373,7 +373,7 @@ for k in 0 .. nlegend - 1 loop opt_array(k) := PL_LEGEND_LINE + PL_LEGEND_SYMBOL; line_styles(k) := 1; - line_widths(k) := 1; + line_widths(k) := 1.0; symbol_scales(k) := 1.0; symbol_numbers(k) := 2; symbols(k) := TUB("*"); @@ -527,10 +527,10 @@ box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); - box_line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); - line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); @@ -542,7 +542,7 @@ for k in 0 .. nlegend - 1 loop opt_array(k) := PL_LEGEND_LINE + PL_LEGEND_SYMBOL; line_styles(k) := 1; - line_widths(k) := 1; + line_widths(k) := 1.0; symbol_scales(k) := 1.0; symbol_numbers(k) := 2; symbols(k) := TUB("*"); @@ -593,10 +593,10 @@ box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); - box_line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); - line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); @@ -631,14 +631,14 @@ box_colors(1) := 2; box_patterns(1) := 0; box_scales(1) := 0.8; - box_line_widths(1) := 1; + box_line_widths(1) := 1.0; opt_array(2) := PL_LEGEND_LINE; text(2) := TUB("Line"); text_colors(2) := 3; line_colors(2) := 3; line_styles(2) := 1; - line_widths(2) := 1; + line_widths(2) := 1.0; opt_array(3) := PL_LEGEND_SYMBOL; text(3) := TUB("Symbol"); @@ -653,7 +653,7 @@ text_colors(4) := 5; line_colors(4) := 5; line_styles(4) := 1; - line_widths(4) := 1; + line_widths(4) := 1.0; symbol_colors(4) := 5; symbol_scales(4) := text_scale; symbol_numbers(4) := 4; @@ -729,7 +729,7 @@ box_colors(i) := i + 1; box_patterns(i) := 0; box_scales(i) := 0.8; - box_line_widths(i) := 1; + box_line_widths(i) := 1.0; end loop; opt := opt_base; @@ -756,7 +756,7 @@ box_colors(i) := 2; box_patterns(i) := i; box_scales(i) := 0.8; - box_line_widths(i) := 1; + box_line_widths(i) := 1.0; end loop; opt := opt_base; @@ -780,7 +780,7 @@ box_colors(i) := 2; box_patterns(i) := 3; box_scales(i) := 0.8; - box_line_widths(i) := i + 1; + box_line_widths(i) := Long_Float(i) + 1.0; end loop; opt := opt_base; @@ -803,7 +803,7 @@ text_colors(i) := i + 1; line_colors(i) := i + 1; line_styles(i) := 1; - line_widths(i) := 1; + line_widths(i) := 1.0; end loop; opt := opt_base; @@ -829,7 +829,7 @@ text_colors(i) := 2; line_colors(i) := 2; line_styles(i) := i + 1; - line_widths(i) := 1; + line_widths(i) := 1.0; end loop; opt := opt_base; @@ -852,7 +852,7 @@ text_colors(i) := 2; line_colors(i) := 2; line_styles(i) := 1; - line_widths(i) := i + 1; + line_widths(i) := Long_Float(i) + 1.0; end loop; opt := opt_base; Modified: trunk/examples/ada/xthick04a.adb =================================================================== --- trunk/examples/ada/xthick04a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/xthick04a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -94,14 +94,13 @@ declare text, symbols : Legend_String_Array_Type(0 .. 1); opt_array : Integer_Array_1D(0 .. 1); - text_colors, line_colors, line_styles, line_widths : Integer_Array_1D(0..1); + text_colors, line_colors, line_styles : Integer_Array_1D(0..1); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 1); - symbol_scales : Real_Vector(0 .. 1); + line_widths, symbol_scales : Real_Vector(0 .. 1); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. - Box_Colors, Box_Patterns, Box_Line_Widths : Integer_Array_1D(0 .. 1) - := (others => 0); - Box_Scales : Real_Vector(0 .. 1):= (others => 1.0); + Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 1):= (others => 0); + Box_Scales, Box_Line_Widths : Real_Vector(0 .. 1):= (others => 1.0); begin -- First legend entry. opt_array(0) := Legend_Line; @@ -109,7 +108,7 @@ text(0) := To_Unbounded_String("Amplitude"); line_colors(0) := Yellow; -- fixme Use declared constants, not integers. line_styles(0) := 1; - line_widths(0) := 1; + line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. @@ -121,7 +120,7 @@ text(1) := To_Unbounded_String("Phase shift"); line_colors(1) := Green; line_styles(1) := 1; - line_widths(1) := 1; + line_widths(1) := 1.0; symbol_colors(1) := Green; symbol_scales(1) := 1.0; symbol_numbers(1) := 4; @@ -144,13 +143,13 @@ declare text, symbols : Legend_String_Array_Type(0 .. 0); opt_array : Integer_Array_1D(0 .. 0); - text_colors, line_colors, line_styles, line_widths : Integer_Array_1D(0..0); + text_colors, line_colors, line_styles : Integer_Array_1D(0..0); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 0); - symbol_scales : Real_Vector(0 .. 0); + line_widths, symbol_scales : Real_Vector(0 .. 0); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. - Box_Colors, Box_Patterns, Box_Line_Widths : Integer_Array_1D(0 .. 0); - Box_Scales : Real_Vector(0 .. 0); + Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 0); + Box_Scales, Box_Line_Widths : Real_Vector(0 .. 0); begin -- First legend entry. opt_array(0) := Legend_Line; @@ -158,14 +157,14 @@ text(0) := To_Unbounded_String("Amplitude"); line_colors(0) := Yellow; -- fixme Use declared constants, not integers. line_styles(0) := 1; - line_widths(0) := 1; + line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. symbols(0) := To_Unbounded_String("*"); -- Don't care; not used. Box_Colors(0) := 0; Box_Patterns(0) := 0; - Box_Line_Widths(0) := 0; + Box_Line_Widths(0) := 0.0; Box_Scales(0) := 0.0; Create_Legend(legend_width, legend_height, Modified: trunk/examples/ada/xthick15a.adb =================================================================== --- trunk/examples/ada/xthick15a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/xthick15a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -85,8 +85,9 @@ procedure plot1 is shade_min, shade_max, sh_color : Long_Float; sh_cmap : Integer := 0; - sh_width : Integer; - min_color, min_width, max_color, max_width : Integer; + sh_width : Long_Float; + min_color, max_color : Integer; + min_width, max_width : Long_Float; begin Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); @@ -96,11 +97,11 @@ shade_min := zmin + (zmax-zmin) * 0.4; shade_max := zmin + (zmax-zmin) * 0.6; sh_color := 7.0; - sh_width := 2; + sh_width := 2.0; min_color := 9; max_color := 2; - min_width := 2; - max_width := 2; + min_width := 2.0; + max_width := 2.0; Select_Fill_Pattern(8); @@ -124,8 +125,9 @@ procedure plot2 is shade_min, shade_max, sh_color : Long_Float; sh_cmap : Integer := 0; - sh_width : Integer; - min_color, min_width, max_color, max_width : Integer := 0; + sh_width : Long_Float; + min_color, max_color : Integer := 0; + min_width, max_width : Long_Float := 0.0; -- C run amok. The following arrays are made to accommodate the -- original example which is written in perverse C. @@ -150,7 +152,7 @@ del_0_To_4(3)(0) := 2000; del_0_To_4(4)(0) := 2000; - sh_width := 2; + sh_width := 2.0; Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Modified: trunk/examples/ada/xthick16a.adb =================================================================== --- trunk/examples/ada/xthick16a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/xthick16a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -64,9 +64,9 @@ (x_Last => nx - 1, y_Last => ny - 1); - fill_width : Integer := 2; - cont_color : Integer := 0; - cont_width : Integer := 0; + fill_width : Long_Float := 2.0; + cont_color : Integer := 0; + cont_width : Long_Float := 0.0; -- Transformation function tr : Real_Vector(0 .. 5); @@ -254,7 +254,7 @@ Shade_Regions(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, - 2, 3, + 2, 3.0, Fill_Polygon'access, False, Plot_Transformation_2'access, cgrid2'Address); Set_Pen_Color(Red); Modified: trunk/examples/ada/xthick21a.adb =================================================================== --- trunk/examples/ada/xthick21a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/xthick21a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -258,7 +258,7 @@ Set_Pen_Color(White); Write_Labels("X", "Y", title(alg - 1)); Shade_Regions(zg, null, xm, xMM, ym, yMM, - clev, 1, 0, 1, Fill_Polygon'access, True, null, System.Null_Address); + clev, 1.0, 0, 1.0, Fill_Polygon'access, True, null, System.Null_Address); Set_Pen_Color(Yellow); else for i in clev'range loop Modified: trunk/examples/ada/xthick26a.adb =================================================================== --- trunk/examples/ada/xthick26a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/xthick26a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -129,15 +129,14 @@ freql, ampl, phase : Real_Vector(0 .. 100); f0, freq : Long_Float; opt_array : Integer_Array_1D(0 .. 1); - text_colors, line_colors, line_styles, line_widths : Integer_Array_1D(0..1); + text_colors, line_colors, line_styles : Integer_Array_1D(0..1); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 1); - symbol_scales : Real_Vector(0 .. 1); + line_widths, symbol_scales : Real_Vector(0 .. 1); symbols : Legend_String_Array_Type(0 .. 1); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. - Box_Colors, Box_Patterns, Box_Line_Widths : Integer_Array_1D(0 .. 1) - := (others => 0); - Box_Scales : Real_Vector(0 .. 1):= (others => 1.0); + Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 1):= (others => 0); + Box_Scales, Box_Line_Widths : Real_Vector(0 .. 1):= (others => 1.0); begin Advance_To_Subpage(Next_Subpage); f0 := 1.0; @@ -185,7 +184,7 @@ text_colors(0) := 2; line_colors(0) := 2; line_styles(0) := 1; - line_widths(0) := 1; + line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. @@ -196,7 +195,7 @@ text_colors(1) := 3; line_colors(1) := 3; line_styles(1) := 1; - line_widths(1) := 1; + line_widths(1) := 1.0; symbol_colors(1) := 3; symbol_scales(1) := 1.0; symbol_numbers(1) := 4; Modified: trunk/examples/ada/xthick33a.adb =================================================================== --- trunk/examples/ada/xthick33a.adb 2013-05-10 19:01:13 UTC (rev 12336) +++ trunk/examples/ada/xthick33a.adb 2013-05-10 20:16:29 UTC (rev 12337) @@ -287,10 +287,10 @@ box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); - box_line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); - line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); @@ -310,7 +310,7 @@ opt_base := Legend_Background + Legend_Bounding_Box; opt_array(0) := Legend_Line + Legend_Symbol; line_styles(0) := 1; - line_widths(0) := 1; + line_widths(0) := 1.0; symbol_scales(0) := 1.0; symbol_numbers(0) := 4; symbols(0) := TUB("*"); @@ -351,10 +351,10 @@ box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); - box_line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); - line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); @@ -375,7 +375,7 @@ for k in 0 .. nlegend - 1 loop opt_array(k) := Legend_Line + Legend_Symbol; line_styles(k) := 1; - line_widths(k) := 1; + line_widths(k) := 1.0; symbol_scales(k) := 1.0; symbol_numbers(k) := 2; symbols(k) := TUB("*"); @@ -529,10 +529,10 @@ box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); - box_line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); - line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); @@ -544,7 +544,7 @@ for k in 0 .. nlegend - 1 loop opt_array(k) := Legend_Line + Legend_Symbol; line_styles(k) := 1; - line_widths(k) := 1; + line_widths(k) := 1.0; symbol_scales(k) := 1.0; symbol_numbers(k) := 2; symbols(k) := TUB("*"); @@ -595,10 +595,10 @@ box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); - box_line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); - line_widths : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); + line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); @@ -633,14 +633,14 @@ box_colors(1) := 2; box_patterns(1) := 0; box_scales(1) := 0.8; - box_line_widths(1) := 1; + box_line_widths(1) := 1.0; opt_array(2) := Legend_Line; text(2) := TUB("Line"); text_colors(2) := 3; line_colors(2) := 3; line_styles(2) := 1; - line_widths(2) := 1; + line_widths(2) := 1.0; opt_array(3) := Legend_Symbol; text(3) := TUB("Symbol"); @@ -655,7 +655,7 @@ text_colors(4) := 5; line_colors(4) := 5; line_styles(4) := 1; - line_widths(4) := 1; + line_widths(4) := 1.0; symbol_colors(4) := 5; symbol_scales(4) := text_scale; symbol_numbers(4) := 4; @@ -731,7 +731,7 @@ box_colors(i) := i + 1; box_patterns(i) := 0; box_scales(i) := 0.8; - box_line_widths(i) := 1; + box_line_widths(i) := 1.0; end loop; opt := opt_base; @@ -758,7 +758,7 @@ box_colors(i) := 2; box_patterns(i) := i; box_scales(i) := 0.8; - box_line_widths(i) := 1; + box_line_widths(i) := 1.0; end loop; opt := opt_base; @@ -782,7 +782,7 @@ box_colors(i) := 2; box_patterns(i) := 3; box_scales(i) := 0.8; - box_line_widths(i) := i + 1; + box_line_widths(i) := Long_Float(i) + 1.0; end loop; opt := opt_base; @@ -805,7 +805,7 @@ text_colors(i) := i + 1; line_colors(i) := i + 1; line_styles(i) := 1; - line_widths(i) := 1; + line_widths(i) := 1.0; end loop; opt := opt_base; @@ -831,7 +831,7 @@ text_colors(i) := 2; line_colors(i) := 2; line_styles(i) := i + 1; - line_widths(i) := 1; + line_widths(i) := 1.0; end loop; opt := opt_base; @@ -854,7 +854,7 @@ text_colors(i) := 2; line_colors(i) := 2; line_styles(i) := 1; - line_widths(i) := i + 1; + line_widths(i) := Long_Float(i) + 1.0; end loop; opt := opt_base; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2013-05-10 20:29:49
|
Revision: 12338 http://sourceforge.net/p/plplot/code/12338 Author: andrewross Date: 2013-05-10 20:29:46 +0000 (Fri, 10 May 2013) Log Message: ----------- Fix up C++ bindings so the line width arguments in the various plshade* functions are PLFLT not PLINT. Modified Paths: -------------- trunk/bindings/c++/plstream.cc trunk/bindings/c++/plstream.h trunk/examples/c++/x15.cc trunk/examples/c++/x16.cc trunk/examples/c++/x21.cc Modified: trunk/bindings/c++/plstream.cc =================================================================== --- trunk/bindings/c++/plstream.cc 2013-05-10 20:16:29 UTC (rev 12337) +++ trunk/bindings/c++/plstream.cc 2013-05-10 20:29:46 UTC (rev 12338) @@ -1695,9 +1695,9 @@ PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -1717,9 +1717,9 @@ PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -1737,8 +1737,8 @@ plstream::shades( const PLFLT * const *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - const PLFLT *clevel, PLINT nlevel, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + const PLFLT *clevel, PLINT nlevel, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -1755,8 +1755,8 @@ plstream::shades( const PLFLT * const *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - const PLFLT *clevel, PLINT nlevel, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + const PLFLT *clevel, PLINT nlevel, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -1771,9 +1771,9 @@ void plstream::shade( Contourable_Data & d, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, bool rectangular, Coord_Xformer *pcxf ) { @@ -1806,9 +1806,9 @@ void plstream::shade( Contourable_Data & d, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, PLINT rectangular, Coord_Xformer *pcxf ) { @@ -1832,9 +1832,9 @@ PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -1855,9 +1855,9 @@ PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -1880,9 +1880,9 @@ PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) @@ -1907,9 +1907,9 @@ PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) Modified: trunk/bindings/c++/plstream.h =================================================================== --- trunk/bindings/c++/plstream.h 2013-05-10 20:16:29 UTC (rev 12337) +++ trunk/bindings/c++/plstream.h 2013-05-10 20:29:46 UTC (rev 12338) @@ -728,9 +728,9 @@ PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -738,8 +738,8 @@ void shades( const PLFLT * const *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - const PLFLT * clevel, PLINT nlevel, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + const PLFLT * clevel, PLINT nlevel, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -750,9 +750,9 @@ void shade( Contourable_Data& d, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, bool rectangular, Coord_Xformer *pcxf ); @@ -760,9 +760,9 @@ PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -774,9 +774,9 @@ PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -1167,9 +1167,9 @@ PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -1177,17 +1177,17 @@ void shades( const PLFLT * const *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, - const PLFLT * clevel, PLINT nlevel, PLINT fill_width, - PLINT cont_color, PLINT cont_width, + const PLFLT * clevel, PLINT nlevel, PLFLT fill_width, + PLINT cont_color, PLFLT cont_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); void shade( Contourable_Data& d, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, PLINT rectangular, Coord_Xformer *pcxf ); @@ -1195,9 +1195,9 @@ PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); @@ -1209,9 +1209,9 @@ PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, - PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, - PLINT min_color, PLINT min_width, - PLINT max_color, PLINT max_width, + PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, + PLINT min_color, PLFLT min_width, + PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); Modified: trunk/examples/c++/x15.cc =================================================================== --- trunk/examples/c++/x15.cc 2013-05-10 20:16:29 UTC (rev 12337) +++ trunk/examples/c++/x15.cc 2013-05-10 20:29:46 UTC (rev 12338) @@ -105,8 +105,10 @@ void x15::plot1( PLFLT **z, PLFLT zmin, PLFLT zmax ) { PLFLT shade_min, shade_max, sh_color; - int sh_cmap = 0, sh_width; - int min_color = 0, min_width = 0, max_color = 0, max_width = 0; + int sh_cmap = 0; + PLFLT sh_width; + int min_color = 0, max_color = 0; + PLFLT min_width = 0.0, max_width = 0.0; pls->adv( 0 ); pls->vpor( 0.1, 0.9, 0.1, 0.9 ); @@ -117,11 +119,11 @@ shade_min = zmin + ( zmax - zmin ) * 0.4; shade_max = zmin + ( zmax - zmin ) * 0.6; sh_color = 7; - sh_width = 2; + sh_width = 2.0; min_color = 9; max_color = 2; - min_width = 2; - max_width = 2; + min_width = 2.0; + max_width = 2.0; pls->psty( 8 ); @@ -143,8 +145,10 @@ void x15::plot2( PLFLT **z, PLFLT zmin, PLFLT zmax ) { PLFLT shade_min, shade_max, sh_color; - int sh_cmap = 0, sh_width; - int min_color = 0, min_width = 0, max_color = 0, max_width = 0; + int sh_cmap = 0; + PLFLT sh_width; + int min_color = 0, max_color = 0; + PLFLT min_width = 0.0, max_width = 0.0; int i; static PLINT nlin[10] = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 }; static PLINT inc[10][2] = { { 450, 0 }, { -450, 0 }, { 0, 0 }, { 900, 0 }, @@ -154,7 +158,7 @@ { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 4000, 4000 }, { 4000, 2000 } }; - sh_width = 2; + sh_width = 2.0; pls->adv( 0 ); pls->vpor( 0.1, 0.9, 0.1, 0.9 ); Modified: trunk/examples/c++/x16.cc =================================================================== --- trunk/examples/c++/x16.cc 2013-05-10 20:16:29 UTC (rev 12337) +++ trunk/examples/c++/x16.cc 2013-05-10 20:29:46 UTC (rev 12338) @@ -139,20 +139,21 @@ x16::x16( int argc, const char ** argv ) { - int i, j; - PLFLT x, y, argx, argy, distort, r, t, zmin, zmax; - PLFLT *px = new PLFLT[PERIMETERPTS]; - PLFLT *py = new PLFLT[PERIMETERPTS]; - PLFLT *xg1 = new PLFLT[nx]; - PLFLT *yg1 = new PLFLT[ny]; - PLFLT **z; - PLFLT **w; - PLcGrid cgrid1; - PLcGrid2 cgrid2; - PLFLT *clevel = new PLFLT[ns]; - PLFLT *shedge = new PLFLT[ns + 1]; - const int fill_width = 2, cont_color = 0, cont_width = 0; - PLFLT colorbar_width, colorbar_height; + int i, j; + PLFLT x, y, argx, argy, distort, r, t, zmin, zmax; + PLFLT *px = new PLFLT[PERIMETERPTS]; + PLFLT *py = new PLFLT[PERIMETERPTS]; + PLFLT *xg1 = new PLFLT[nx]; + PLFLT *yg1 = new PLFLT[ny]; + PLFLT **z; + PLFLT **w; + PLcGrid cgrid1; + PLcGrid2 cgrid2; + PLFLT *clevel = new PLFLT[ns]; + PLFLT *shedge = new PLFLT[ns + 1]; + const int cont_color = 0; + const PLFLT fill_width = 2.0, cont_width = 0.0; + PLFLT colorbar_width, colorbar_height; #define NUM_AXES 1 PLINT n_axis_opts = NUM_AXES; @@ -406,7 +407,7 @@ pls->shades( z, nx, ny, NULL, -1., 1., -1., 1., shedge, ns + 1, fill_width, - 2, 3, + 2, 3.0, plstream::fill, false, plstream::tr2, (void *) &cgrid2 ); if ( colorbar ) Modified: trunk/examples/c++/x21.cc =================================================================== --- trunk/examples/c++/x21.cc 2013-05-10 20:16:29 UTC (rev 12337) +++ trunk/examples/c++/x21.cc 2013-05-10 20:29:46 UTC (rev 12338) @@ -316,7 +316,7 @@ pls->col0( 15 ); pls->lab( "X", "Y", title[alg - 1] ); pls->shades( zg, xp, yp, NULL, xm, xM, ym, yM, - clev, nl, 1, 0, 1, pls->fill, true, NULL, NULL ); + clev, nl, 1.0, 0, 1.0, pls->fill, true, NULL, NULL ); pls->col0( 2 ); } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2013-05-10 22:12:07
|
Revision: 12340 http://sourceforge.net/p/plplot/code/12340 Author: andrewross Date: 2013-05-10 22:12:04 +0000 (Fri, 10 May 2013) Log Message: ----------- Remove the long deprecated support for the python Numeric package. The python bindings now require numpy. Update bindings to remove deprecated numpy syntax and hence remove compile warnings. Modified Paths: -------------- trunk/bindings/python/CMakeLists.txt trunk/bindings/python/plplot_widgetmodule.c trunk/bindings/python/plplotcmodule.i trunk/cmake/modules/gcw.cmake trunk/cmake/modules/python.cmake trunk/examples/python/CMakeLists.txt trunk/examples/python/xw01.py trunk/examples/python/xw09.py trunk/examples/python/xw14.py trunk/examples/python/xw20.py Added Paths: ----------- trunk/bindings/python/plplot.py trunk/examples/python/plplot_py_demos.py Removed Paths: ------------- trunk/bindings/python/plplot.py.Numeric trunk/bindings/python/plplot.py.numpy trunk/examples/python/plplot_py_demos.py.numeric trunk/examples/python/plplot_py_demos.py.numpy Modified: trunk/bindings/python/CMakeLists.txt =================================================================== --- trunk/bindings/python/CMakeLists.txt 2013-05-10 20:32:28 UTC (rev 12339) +++ trunk/bindings/python/CMakeLists.txt 2013-05-10 22:12:04 UTC (rev 12340) @@ -20,14 +20,6 @@ if(ENABLE_python) - # Configure the python scripts to use the correct version of the Numeric library - if (HAVE_NUMPY) - configure_file(plplot.py.numpy ${CMAKE_CURRENT_BINARY_DIR}/plplot.py COPYONLY) - else (HAVE_NUMPY) - configure_file(plplot.py.Numeric ${CMAKE_CURRENT_BINARY_DIR}/plplot.py COPYONLY) - endif (HAVE_NUMPY) - - # This is currently the include list for swig, the C wrapper and the # the Python headers. Not particular pretty... if(ENABLE_tk) @@ -156,7 +148,7 @@ WORLD_EXECUTE ) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/plplot.py ${CMAKE_CURRENT_BINARY_DIR}/plplotc.py + FILES plplot.py ${CMAKE_CURRENT_BINARY_DIR}/plplotc.py DESTINATION ${PYTHON_INSTDIR} ) if(ENABLE_tk) Copied: trunk/bindings/python/plplot.py (from rev 12335, trunk/bindings/python/plplot.py.numpy) =================================================================== --- trunk/bindings/python/plplot.py (rev 0) +++ trunk/bindings/python/plplot.py 2013-05-10 22:12:04 UTC (rev 12340) @@ -0,0 +1,649 @@ +# Copyright 2002 Gary Bishop and Alan W. Irwin +# Copyright 2008 Andrew Ross +# This file is part of PLplot. + +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published by +# the Free Software Foundation; version 2 of the License. + +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. + +# You should have received a copy of the GNU Library General Public License +# along with the file PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# Wrap raw python interface to C API, plplotc, with this user-friendly version +# which implements some useful variations of the argument lists. + +from plplotc import * +import types +import numpy + +# Redefine plcont to have the user-friendly interface +# Allowable syntaxes: + +# plcont( z, [kx, lx, ky, ly], clev, [pltr, [pltr_data] or [xg, yg, [wrap]]]) +# N.B. Brackets represent options here and not python lists! + +# All unbracketed arguments within brackets must all be present or all be +# missing. Furthermore, z must be a 2D array, kx, lx, ky, ly must all be +# integers, clev must be a 1D array, pltr can be a function reference or +# string, pltr_data is an optional arbitrary data object, xg and yg are +# optional 1D or 2D arrays and wrap (which only works if xg and yg +# are specified) is 0, 1, or 2. + +# If pltr is a string it must be either "pltr0", "pltr1", or "pltr2" to +# refer to those built-in transformation functions. Alternatively, the +# function names pltr0, pltr1, or pltr2 may be specified to refer to +# the built-in transformation functions or an arbitrary name for a +# user-defined transformation function may be specified. Such functions +# must have x, y, and optional pltr_data arguments and return arbitrarily +# transformed x' and y' in a tuple. The built-in pltr's such as pltr1 and +# pltr2 use pltr_data = tuple(xg, yg), and for this oft-used case (and any +# other user-defined pltr which uses a tuple of two arrays for pltr_data), +# we also provide optional xg and yg arguments separately as an alternative +# to the tuple method of providing these data. Note, that pltr_data cannot +# be in the argument list if xg and yg are there, and vice versa. Also note +# that the built-in pltr0 and some user-defined transformation functions +# ignore the auxiliary pltr_data (or the alternative xg and yg) in which +# case neither pltr_data nor xg and yg need to be specified. + +_plcont = plcont +def plcont(z, *args): + z = numpy.asarray(z) + if len(z.shape) != 2: + raise ValueError, "Expected 2D z array" + + if len(args) > 4 and type(args[0]) == types.IntType: + for i in range(1,4): + if type(args[i]) != types.IntType: + raise ValueError, "Expected 4 ints for kx,lx,ky,ly" + + else: + # these 4 args are the kx, lx, ky, ly ints + ifdefault_range = 0 + kx,lx,ky,ly = args[0:4] + args = args[4:] + else: + ifdefault_range = 1 + + if len(args) > 0: + clev = numpy.asarray(args[0]) + if len(clev.shape) !=1: + raise ValueError, "Expected 1D clev array" + args = args[1:] + else: + raise ValueError, "Missing clev argument" + + if len(args) > 0 and ( \ + type(args[0]) == types.StringType or \ + type(args[0]) == types.FunctionType or \ + type(args[0]) == types.BuiltinFunctionType): + pltr = args[0] + # Handle the string names for the callbacks though specifying the + # built-in function name directly (without the surrounding quotes) + # or specifying any user-defined transformation function + # (following above rules) works fine too. + if type(pltr) == types.StringType: + if pltr == "pltr0": + pltr = pltr0 + elif pltr == "pltr1": + pltr = pltr1 + elif pltr == "pltr2": + pltr = pltr2 + else: + raise ValueError, "pltr string is unrecognized" + + args = args[1:] + # Handle pltr_data or separate xg, yg, [wrap] + if len(args) == 0: + # Default pltr_data + pltr_data = None + elif len(args) == 1: + #Must be pltr_data + pltr_data = args[0] + args = args[1:] + elif len(args) >= 2: + xg = numpy.asarray(args[0]) + if len(xg.shape) < 1 or len(xg.shape) > 2: + raise ValueError, "xg must be 1D or 2D array" + yg = numpy.asarray(args[1]) + if len(yg.shape) != len(xg.shape): + raise ValueError, "yg must have same number of dimensions as xg" + args = args[2:] + # wrap only relevant if xg and yg specified. + if len(args) > 0: + if type(args[0]) == types.IntType: + wrap = args[0] + args = args[1:] + if len(xg.shape) == 2 and len(yg.shape) == 2 and \ + z.shape == xg.shape and z.shape == yg.shape: + # handle wrap + if wrap == 1: + z = numpy.resize(z, (z.shape[0]+1, z.shape[1])) + xg = numpy.resize(xg, (xg.shape[0]+1, xg.shape[1])) + yg = numpy.resize(yg, (yg.shape[0]+1, yg.shape[1])) + elif wrap == 2: + z = numpy.transpose(numpy.resize( \ + numpy.transpose(z), (z.shape[1]+1, z.shape[0]))) + xg = numpy.transpose(numpy.resize( \ + numpy.transpose(xg), (xg.shape[1]+1, xg.shape[0]))) + yg = numpy.transpose(numpy.resize( \ + numpy.transpose(yg), (yg.shape[1]+1, yg.shape[0]))) + elif wrap != 0: + raise ValueError, "Invalid wrap specifier, must be 0, 1 or 2." + elif wrap != 0: + raise ValueError, "Non-zero wrap specified and xg and yg are not 2D arrays" + else: + raise ValueError, "Specified wrap is not an integer" + pltr_data = (xg, yg) + else: + # default is identity transformation + pltr = pltr0 + pltr_data = None + if len(args) > 0: + raise ValueError, "Too many arguments for plcont" + if ifdefault_range: + # Default is to take full range (still using fortran convention + # for indices which is embedded in the PLplot library API) + kx = 1 + lx = z.shape[0] + ky = 1 + ly = z.shape[1] + _plcont(z, kx, lx, ky, ly, clev, pltr, pltr_data) +plcont.__doc__ = _plcont.__doc__ + +# Redefine plvect to have the user-friendly interface +# Allowable syntaxes: + +# plvect( u, v, scaling, [pltr, [pltr_data] or [xg, yg, [wrap]]]) +_plvect = plvect +def plvect(u, v, *args): + u = numpy.asarray(u) + v = numpy.asarray(v) + + if len(u.shape) != 2: + raise ValueError, "Expected 2D u array" + if len(v.shape) != 2: + raise ValueError, "Expected 2D v array" + if (u.shape[0] != v.shape[0]) or (u.shape[1] != v.shape[1]) : + raise ValueError, "Expected u and v arrays to be the same dimensions" + + if len(args) > 0 and (type(args[0]) == types.FloatType or type(args[0]) == numpy.float64) : + scaling = args[0] + args = args[1:] + else: + raise ValueError, "Missing scaling argument" + + if len(args) > 0 and ( \ + type(args[0]) == types.StringType or \ + type(args[0]) == types.FunctionType or \ + type(args[0]) == types.BuiltinFunctionType): + pltr = args[0] + # Handle the string names for the callbacks though specifying the + # built-in function name directly (without the surrounding quotes) + # or specifying any user-defined transformation function + # (following above rules) works fine too. + if type(pltr) == types.StringType: + if pltr == "pltr0": + pltr = pltr0 + elif pltr == "pltr1": + pltr = pltr1 + elif pltr == "pltr2": + pltr = pltr2 + else: + raise ValueError, "pltr string is unrecognized" + + args = args[1:] + # Handle pltr_data or separate xg, yg, [wrap] + if len(args) == 0: + # Default pltr_data + pltr_data = None + elif len(args) == 1: + #Must be pltr_data + pltr_data = args[0] + args = args[1:] + elif len(args) >= 2: + xg = numpy.asarray(args[0]) + if len(xg.shape) < 1 or len(xg.shape) > 2: + raise ValueError, "xg must be 1D or 2D array" + yg = numpy.asarray(args[1]) + if len(yg.shape) != len(xg.shape): + raise ValueError, "yg must have same number of dimensions as xg" + args = args[2:] + # wrap only relevant if xg and yg specified. + if len(args) > 0: + if type(args[0]) == types.IntType: + wrap = args[0] + args = args[1:] + if len(xg.shape) == 2 and len(yg.shape) == 2 and \ + u.shape == xg.shape and u.shape == yg.shape: + # handle wrap + if wrap == 1: + u = numpy.resize(u, (u.shape[0]+1, u.shape[1])) + v = numpy.resize(v, (v.shape[0]+1, v.shape[1])) + xg = numpy.resize(xg, (xg.shape[0]+1, xg.shape[1])) + yg = numpy.resize(yg, (yg.shape[0]+1, yg.shape[1])) + elif wrap == 2: + u = numpy.transpose(numpy.resize( \ + numpy.transpose(u), (u.shape[1]+1, u.shape[0]))) + v = numpy.transpose(numpy.resize( \ + numpy.transpose(v), (v.shape[1]+1, v.shape[0]))) + xg = numpy.transpose(numpy.resize( \ + numpy.transpose(xg), (xg.shape[1]+1, xg.shape[0]))) + yg = numpy.transpose(numpy.resize( \ + numpy.transpose(yg), (yg.shape[1]+1, yg.shape[0]))) + elif wrap != 0: + raise ValueError, "Invalid wrap specifier, must be 0, 1 or 2." + elif wrap != 0: + raise ValueError, "Non-zero wrap specified and xg and yg are not 2D arrays" + else: + raise ValueError, "Specified wrap is not an integer" + pltr_data = (xg, yg) + else: + # default is identity transformation + pltr = pltr0 + pltr_data = None + if len(args) > 0: + raise ValueError, "Too many arguments for plvect" + _plvect(u, v, scaling, pltr, pltr_data) +plvect.__doc__ = _plvect.__doc__ + +# Redefine plimagefr to have the user-friendly interface +# Allowable syntaxes: + +# plimagefr( img, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, [pltr, [pltr_data] or [xg, yg, [wrap]]]) +_plimagefr = plimagefr +def plimagefr(img, *args): + img = numpy.asarray(img) + + if len(img.shape) != 2: + raise ValueError, "Expected 2D img array" + + if len(args) >= 8 : + for i in range(8) : + if (type(args[i]) != types.FloatType and \ + type(args[i]) != numpy.float64 and \ + type(args[i]) != types.IntType) : + raise ValueError, "Expected 8 numbers for xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax" + else: + # These 8 args are xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax + xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax = args[0:8] + args = args[8:] + else: + raise ValueError, "Expected 8 numbers for xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax" + + if len(args) > 0 and ( \ + type(args[0]) == types.StringType or \ + type(args[0]) == types.FunctionType or \ + type(args[0]) == types.BuiltinFunctionType): + pltr = args[0] + # Handle the string names for the callbacks though specifying the + # built-in function name directly (without the surrounding quotes) + # or specifying any user-defined transformation function + # (following above rules) works fine too. + if type(pltr) == types.StringType: + if pltr == "pltr0": + pltr = pltr0 + elif pltr == "pltr1": + pltr = pltr1 + elif pltr == "pltr2": + pltr = pltr2 + else: + raise ValueError, "pltr string is unrecognized" + + args = args[1:] + # Handle pltr_data or separate xg, yg, [wrap] + if len(args) == 0: + # Default pltr_data + pltr_data = None + elif len(args) == 1: + #Must be pltr_data + pltr_data = args[0] + args = args[1:] + elif len(args) >= 2: + xg = numpy.asarray(args[0]) + if len(xg.shape) < 1 or len(xg.shape) > 2: + raise ValueError, "xg must be 1D or 2D array" + yg = numpy.asarray(args[1]) + if len(yg.shape) != len(xg.shape): + raise ValueError, "yg must have same number of dimensions as xg" + args = args[2:] + # wrap only relevant if xg and yg specified. + if len(args) > 0: + if type(args[0]) == types.IntType: + wrap = args[0] + args = args[1:] + if len(xg.shape) == 2 and len(yg.shape) == 2 and \ + img.shape[0] == xg.shape[0]-1 and img.shape[1] == xg.shape[1]-1: + # handle wrap + if wrap == 1: + img = numpy.resize(img, (img.shape[0]+1, u.shape[1])) + xg = numpy.resize(xg, (xg.shape[0]+1, xg.shape[1])) + yg = numpy.resize(yg, (yg.shape[0]+1, yg.shape[1])) + elif wrap == 2: + img = numpy.transpose(numpy.resize( \ + numpy.transpose(img), (img.shape[1]+1, img.shape[0]))) + xg = numpy.transpose(numpy.resize( \ + numpy.transpose(xg), (xg.shape[1]+1, xg.shape[0]))) + yg = numpy.transpose(numpy.resize( \ + numpy.transpose(yg), (yg.shape[1]+1, yg.shape[0]))) + elif wrap != 0: + raise ValueError, "Invalid wrap specifier, must be 0, 1 or 2." + elif wrap != 0: + raise ValueError, "Non-zero wrap specified and xg and yg are not 2D arrays" + else: + raise ValueError, "Specified wrap is not an integer" + pltr_data = (xg, yg) + else: + # default is identity transformation + pltr = pltr0 + pltr_data = None + if len(args) > 0: + raise ValueError, "Too many arguments for plimagefr" + _plimagefr(img, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, pltr, pltr_data) +plimagefr.__doc__ = _plimagefr.__doc__ + +# Redefine plshades to have the user-friendly interface +# Allowable syntaxes: + +# plshades(z, [xmin, xmax, ymin, ymax,] clev, \ +# fill_width, [cont_color, cont_width,], rect, \ +# [pltr, [pltr_data] or [xg, yg, [wrap]]]) + +_plshades = plshades +def plshades(z, *args): + z = numpy.asarray(z) + if len(z.shape) != 2: + raise ValueError, "Expected 2D z array" + + if len(args) > 4 and \ + (type(args[0]) == types.FloatType or type(args[0]) == numpy.float64 or type(args[0]) == types.IntType) and \ + (type(args[1]) == types.FloatType or type(args[1]) == numpy.float64 or type(args[1]) == types.IntType) and \ + (type(args[2]) == types.FloatType or type(args[2]) == numpy.float64 or type(args[2]) == types.IntType) and \ + (type(args[3]) == types.FloatType or type(args[3]) == numpy.float64 or type(args[3]) == types.IntType): + # These 4 args are xmin, xmax, ymin, ymax + xmin, xmax, ymin, ymax = args[0:4] + args = args[4:] + else: + # These values are ignored if pltr and pltr_data are defined in any case. + # So pick some convenient defaults that work for the pltr0, None case + xmin = -1. + xmax = 1. + ymin = -1. + ymax = 1. + + # clev must be present. + if len(args) > 0: + clev = numpy.asarray(args[0]) + if len(clev.shape) !=1: + raise ValueError, "Expected 1D clev array" + args = args[1:] + else: + raise ValueError, "Missing clev argument" + + # fill_width must be present + if len(args) > 0 and (type(args[0]) == types.FloatType or type(args[0]) == numpy.float64): + fill_width = args[0] + args = args[1:] + else: + raise ValueError, "fill_width argument must be present and of types.FloatType or numpy.float64 type" + + # cont_color and cont_width are optional. + if len(args) > 2 and \ + type(args[0]) == types.IntType and \ + (type(args[1]) == types.FloatType or type(args[1]) == numpy.float64): + # These 2 args are + cont_color, cont_width = args[0:2] + args = args[2:] + else: + # Turn off contouring. + cont_color, cont_width = (0,0.) + + # rect must be present. + if len(args) > 0 and type(args[0]) == types.IntType: + rect = args[0] + args = args[1:] + else: + raise ValueError, "Missing rect argument" + + if len(args) > 0 and ( \ + type(args[0]) == types.NoneType or \ + type(args[0]) == types.StringType or \ + type(args[0]) == types.FunctionType or \ + type(args[0]) == types.BuiltinFunctionType): + pltr = args[0] + # Handle the string names for the callbacks though specifying the + # built-in function name directly (without the surrounding quotes) + # or specifying any user-defined transformation function + # (following above rules) works fine too. + if type(pltr) == types.StringType: + if pltr == "pltr0": + pltr = pltr0 + elif pltr == "pltr1": + pltr = pltr1 + elif pltr == "pltr2": + pltr = pltr2 + else: + raise ValueError, "pltr string is unrecognized" + + args = args[1:] + # Handle pltr_data or separate xg, yg, [wrap] + if len(args) == 0: + # Default pltr_data + pltr_data = None + elif len(args) == 1: + #Must be pltr_data + pltr_data = args[0] + args = args[1:] + elif len(args) >= 2: + xg = numpy.asarray(args[0]) + if len(xg.shape) < 1 or len(xg.shape) > 2: + raise ValueError, "xg must be 1D or 2D array" + yg = numpy.asarray(args[1]) + if len(yg.shape) != len(xg.shape): + raise ValueError, "yg must have same number of dimensions as xg" + args = args[2:] + # wrap only relevant if xg and yg specified. + if len(args) > 0: + if type(args[0]) == types.IntType: + wrap = args[0] + args = args[1:] + if len(xg.shape) == 2 and len(yg.shape) == 2 and \ + z.shape == xg.shape and z.shape == yg.shape: + # handle wrap + if wrap == 1: + z = numpy.resize(z, (z.shape[0]+1, z.shape[1])) + xg = numpy.resize(xg, (xg.shape[0]+1, xg.shape[1])) + yg = numpy.resize(yg, (yg.shape[0]+1, yg.shape[1])) + elif wrap == 2: + z = numpy.transpose(numpy.resize( \ + numpy.transpose(z), (z.shape[1]+1, z.shape[0]))) + xg = numpy.transpose(numpy.resize( \ + numpy.transpose(xg), (xg.shape[1]+1, xg.shape[0]))) + yg = numpy.transpose(numpy.resize( \ + numpy.transpose(yg), (yg.shape[1]+1, yg.shape[0]))) + elif wrap != 0: + raise ValueError, "Invalid wrap specifier, must be 0, 1 or 2." + elif wrap != 0: + raise ValueError, "Non-zero wrap specified and xg and yg are not 2D arrays" + else: + raise ValueError, "Specified wrap is not an integer" + pltr_data = (xg, yg) + else: + # default is identity transformation + pltr = pltr0 + pltr_data = None + if len(args) > 0: + raise ValueError, "Too many arguments for plshades" + + _plshades(z, xmin, xmax, ymin, ymax, clev, \ + fill_width, cont_color, cont_width, rect, pltr, pltr_data) +plshades.__doc__ = _plshades.__doc__ + +# Redefine plshade to have the user-friendly interface +# Allowable syntaxes: + +# _plshade(z, [xmin, xmax, ymin, ymax,] \ +# shade_min, shade_max, sh_cmap, sh_color, sh_width, \ +# [min_color, min_width, max_color, max_width,] rect, \ +# [pltr, [pltr_data] or [xg, yg, [wrap]]]) + +_plshade = plshade +def plshade(z, *args): + z = numpy.asarray(z) + if len(z.shape) != 2: + raise ValueError, "Expected 2D z array" + + # Extra check on shade_min = float on end is absolutely necessary + # to unambiguously figure out where we are in the argument list. + if len(args) > 9 and \ + (type(args[0]) == types.FloatType or type(args[0]) == numpy.float64 or type(args[0]) == types.IntType) and \ + (type(args[1]) == types.FloatType or type(args[1]) == numpy.float64 or type(args[1]) == types.IntType) and \ + (type(args[2]) == types.FloatType or type(args[2]) == numpy.float64 or type(args[2]) == types.IntType) and \ + (type(args[3]) == types.FloatType or type(args[3]) == numpy.float64 or type(args[3]) == types.IntType) and \ + (type(args[4]) == types.FloatType or type(args[4]) == numpy.float64) : + # These 4 args are xmin, xmax, ymin, ymax + xmin, xmax, ymin, ymax = args[0:4] + args = args[4:] + else: + # These values are ignored if pltr and pltr_data are defined in any case. + # So pick some convenient defaults that work for the pltr0, None case + xmin = -1. + xmax = 1. + ymin = -1. + ymax = 1. + + # shade_min, shade_max, sh_cmap, sh_color, sh_width, must be present. + # sh_color can be either integer or float. + if len(args) > 5 and \ + (type(args[0]) == types.FloatType or type(args[0]) == numpy.float64) and \ + (type(args[1]) == types.FloatType or type(args[1]) == numpy.float64) and \ + type(args[2]) == types.IntType and \ + (type(args[3]) == types.FloatType or type(args[3]) == numpy.float64 or type(args[3]) == types.IntType) and \ + (type(args[4]) == types.FloatType or type(args[4]) == numpy.float64): + shade_min, shade_max, sh_cmap, sh_color, sh_width = args[0:5] + args = args[5:] + else: + raise ValueError, \ + "shade_min, shade_max, sh_cmap, sh_color, sh_width, must be present with sh_cmap of types.IntType type and the rest of types.FloatType or numpy.float64 type" + + # min_color, min_width, max_color, max_width are optional. + if len(args) > 4 and \ + type(args[0]) == types.IntType and \ + (type(args[1]) == types.FloatType or type(args[1]) == numpy.float64) and \ + type(args[2]) == types.IntType and \ + (type(args[3]) == types.FloatType or type(args[3]) == numpy.float64): + # These 4 args are + min_color, min_width, max_color, max_width = args[0:4] + args = args[4:] + else: + # Turn off boundary colouring + min_color, min_width, max_color, max_width = (0,0.,0,0.) + + # rect must be present. + if len(args) > 0 and type(args[0]) == types.IntType: + rect = args[0] + args = args[1:] + else: + raise ValueError, "Missing rect argument" + + if len(args) > 0 and ( \ + type(args[0]) == types.NoneType or \ + type(args[0]) == types.StringType or \ + type(args[0]) == types.FunctionType or \ + type(args[0]) == types.BuiltinFunctionType): + pltr = args[0] + # Handle the string names for the callbacks though specifying the + # built-in function name directly (without the surrounding quotes) + # or specifying any user-defined transformation function + # (following above rules) works fine too. + if type(pltr) == types.StringType: + if pltr == "pltr0": + pltr = pltr0 + elif pltr == "pltr1": + pltr = pltr1 + elif pltr == "pltr2": + pltr = pltr2 + else: + raise ValueError, "pltr string is unrecognized" + + args = args[1:] + # Handle pltr_data or separate xg, yg, [wrap] + if len(args) == 0: + # Default pltr_data + pltr_data = None + elif len(args) == 1: + #Must be pltr_data + pltr_data = args[0] + args = args[1:] + elif len(args) >= 2: + xg = numpy.asarray(args[0]) + if len(xg.shape) < 1 or len(xg.shape) > 2: + raise ValueError, "xg must be 1D or 2D array" + yg = numpy.asarray(args[1]) + if len(yg.shape) != len(xg.shape): + raise ValueError, "yg must have same number of dimensions as xg" + args = args[2:] + # wrap only relevant if xg and yg specified. + if len(args) > 0: + if type(args[0]) == types.IntType: + wrap = args[0] + args = args[1:] + if len(xg.shape) == 2 and len(yg.shape) == 2 and \ + z.shape == xg.shape and z.shape == yg.shape: + # handle wrap + if wrap == 1: + z = numpy.resize(z, (z.shape[0]+1, z.shape[1])) + xg = numpy.resize(xg, (xg.shape[0]+1, xg.shape[1])) + yg = numpy.resize(yg, (yg.shape[0]+1, yg.shape[1])) + elif wrap == 2: + z = numpy.transpose(numpy.resize( \ + numpy.transpose(z), (z.shape[1]+1, z.shape[0]))) + xg = numpy.transpose(numpy.resize( \ + numpy.transpose(xg), (xg.shape[1]+1, xg.shape[0]))) + yg = numpy.transpose(numpy.resize( \ + numpy.transpose(yg), (yg.shape[1]+1, yg.shape[0]))) + elif wrap != 0: + raise ValueError, "Invalid wrap specifier, must be 0, 1 or 2." + elif wrap != 0: + raise ValueError, "Non-zero wrap specified and xg and yg are not 2D arrays" + else: + raise ValueError, "Specified wrap is not an integer" + pltr_data = (xg, yg) + else: + # default is identity transformation + pltr = pltr0 + pltr_data = None + if len(args) > 0: + raise ValueError, "Too many arguments for plshade" + + _plshade(z, xmin, xmax, ymin, ymax, \ + shade_min, shade_max, sh_cmap, sh_color, sh_width, \ + min_color, min_width, max_color, max_width, rect, pltr, pltr_data) +plshade.__doc__ = _plshade.__doc__ + +# Redefine plscmap1l to have the user-friendly interface +# Allowable syntaxes: + +# plscmap1l(itype, pos, coord1, coord2, coord3[, alt_hue_path]) + +_plscmap1l = plscmap1l +def plscmap1l(itype, pos, coord1, coord2, coord3, *args): + + pos = numpy.asarray(pos) + if len(pos.shape) != 1: + raise ValueError, "Expected 1D pos array" + + if len(args) == 0: + # Default alt_hue_path + alt_hue_path = numpy.zeros(pos.shape[0]-1,dtype="int") + elif len(args) == 1: + alt_hue_path = numpy.asarray(args[0]) + else: + raise ValueError, "Too many arguments to plscmap1l" + _plscmap1l(itype, pos, coord1, coord2, coord3, alt_hue_path) +plscmap1l.__doc__ = _plscmap1l.__doc__ Deleted: trunk/bindings/python/plplot.py.Numeric =================================================================== --- trunk/bindings/python/plplot.py.Numeric 2013-05-10 20:32:28 UTC (rev 12339) +++ trunk/bindings/python/plplot.py.Numeric 2013-05-10 22:12:04 UTC (rev 12340) @@ -1,651 +0,0 @@ -# Copyright 2002 Gary Bishop and Alan W. Irwin -# Copyright 2008 Andrew Ross -# This file is part of PLplot. - -# PLplot is free software; you can redistribute it and/or modify -# it under the terms of the GNU Library General Public License as published by -# the Free Software Foundation; version 2 of the License. - -# PLplot is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library General Public License for more details. - -# You should have received a copy of the GNU Library General Public License -# along with the file PLplot; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -# Wrap raw python interface to C API, plplotc, with this user-friendly version -# which implements some useful variations of the argument lists. - -from plplotc import * -import types -import Numeric - -# Redefine plcont to have the user-friendly interface -# Allowable syntaxes: - -# plcont( z, [kx, lx, ky, ly], clev, [pltr, [pltr_data] or [xg, yg, [wrap]]]) -# N.B. Brackets represent options here and not python lists! - -# All unbracketed arguments within brackets must all be present or all be -# missing. Furthermore, z must be a 2D array, kx, lx, ky, ly must all be -# integers, clev must be a 1D array, pltr can be a function reference or -# string, pltr_data is an optional arbitrary data object, xg and yg are -# optional 1D or 2D arrays and wrap (which only works if xg and yg -# are specified) is 0, 1, or 2. - -# If pltr is a string it must be either "pltr0", "pltr1", or "pltr2" to -# refer to those built-in transformation functions. Alternatively, the -# function names pltr0, pltr1, or pltr2 may be specified to refer to -# the built-in transformation functions or an arbitrary name for a -# user-defined transformation function may be specified. Such functions -# must have x, y, and optional pltr_data arguments and return arbitrarily -# transformed x' and y' in a tuple. The built-in pltr's such as pltr1 and -# pltr2 use pltr_data = tuple(xg, yg), and for this oft-used case (and any -# other user-defined pltr which uses a tuple of two arrays for pltr_data), -# we also provide optional xg and yg arguments separately as an alternative -# to the tuple method of providing these data. Note, that pltr_data cannot -# be in the argument list if xg and yg are there, and vice versa. Also note -# that the built-in pltr0 and some user-defined transformation functions -# ignore the auxiliary pltr_data (or the alternative xg and yg) in which -# case neither pltr_data nor xg and yg need to be specified. - -_plcont = plcont -def plcont(z, *args): - z = Numeric.asarray(z) - if len(z.shape) != 2: - raise ValueError, "Expected 2D z array" - - if len(args) > 4 and type(args[0]) == types.IntType: - for i in range(1,4): - if type(args[i]) != types.IntType: - raise ValueError, "Expected 4 ints for kx,lx,ky,ly" - - else: - # these 4 args are the kx, lx, ky, ly ints - ifdefault_range = 0 - kx,lx,ky,ly = args[0:4] - args = args[4:] - else: - ifdefault_range = 1 - - if len(args) > 0: - clev = Numeric.asarray(args[0]) - if len(clev.shape) !=1: - raise ValueError, "Expected 1D clev array" - args = args[1:] - else: - raise ValueError, "Missing clev argument" - - if len(args) > 0 and ( \ - type(args[0]) == types.StringType or \ - type(args[0]) == types.FunctionType or \ - type(args[0]) == types.BuiltinFunctionType): - pltr = args[0] - # Handle the string names for the callbacks though specifying the - # built-in function name directly (without the surrounding quotes) - # or specifying any user-defined transformation function - # (following above rules) works fine too. - if type(pltr) == types.StringType: - if pltr == "pltr0": - pltr = pltr0 - elif pltr == "pltr1": - pltr = pltr1 - elif pltr == "pltr2": - pltr = pltr2 - else: - raise ValueError, "pltr string is unrecognized" - - args = args[1:] - # Handle pltr_data or separate xg, yg, [wrap] - if len(args) == 0: - # Default pltr_data - pltr_data = None - elif len(args) == 1: - #Must be pltr_data - pltr_data = args[0] - args = args[1:] - elif len(args) >= 2: - xg = Numeric.asarray(args[0]) - if len(xg.shape) < 1 or len(xg.shape) > 2: - raise ValueError, "xg must be 1D or 2D array" - yg = Numeric.asarray(args[1]) - if len(yg.shape) != len(xg.shape): - raise ValueError, "yg must have same number of dimensions as xg" - args = args[2:] - # wrap only relevant if xg and yg specified. - if len(args) > 0: - if type(args[0]) == types.IntType: - wrap = args[0] - args = args[1:] - if len(xg.shape) == 2 and len(yg.shape) == 2 and \ - z.shape == xg.shape and z.shape == yg.shape: - # handle wrap - if wrap == 1: - z = Numeric.resize(z, (z.shape[0]+1, z.shape[1])) - xg = Numeric.resize(xg, (xg.shape[0]+1, xg.shape[1])) - yg = Numeric.resize(yg, (yg.shape[0]+1, yg.shape[1])) - elif wrap == 2: - z = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(z), (z.shape[1]+1, z.shape[0]))) - xg = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(xg), (xg.shape[1]+1, xg.shape[0]))) - yg = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(yg), (yg.shape[1]+1, yg.shape[0]))) - elif wrap != 0: - raise ValueError, "Invalid wrap specifier, must be 0, 1 or 2." - elif wrap != 0: - raise ValueError, "Non-zero wrap specified and xg and yg are not 2D arrays" - else: - raise ValueError, "Specified wrap is not an integer" - pltr_data = (xg, yg) - else: - # default is identity transformation - pltr = pltr0 - pltr_data = None - if len(args) > 0: - raise ValueError, "Too many arguments for plcont" - if ifdefault_range: - # Default is to take full range (still using fortran convention - # for indices which is embedded in the PLplot library API) - kx = 1 - lx = z.shape[0] - ky = 1 - ly = z.shape[1] - _plcont(z, kx, lx, ky, ly, clev, pltr, pltr_data) -plcont.__doc__ = _plcont.__doc__ - -# Redefine plvect to have the user-friendly interface -# Allowable syntaxes: - -# plvect( u, v, scaling, [pltr, [pltr_data] or [xg, yg, [wrap]]]) -_plvect = plvect -def plvect(u, v, *args): - u = Numeric.asarray(u) - v = Numeric.asarray(v) - - if len(u.shape) != 2: - raise ValueError, "Expected 2D u array" - if len(v.shape) != 2: - raise ValueError, "Expected 2D v array" - if (u.shape[0] != v.shape[0]) or (u.shape[1] != v.shape[1]) : - raise ValueError, "Expected u and v arrays to be the same dimensions" - - if len(args) > 0 and type(args[0]) == types.FloatType : - scaling = args[0] - args = args[1:] - else: - raise ValueError, "Missing scaling argument" - - if len(args) > 0 and ( \ - type(args[0]) == types.StringType or \ - type(args[0]) == types.FunctionType or \ - type(args[0]) == types.BuiltinFunctionType): - pltr = args[0] - # Handle the string names for the callbacks though specifying the - # built-in function name directly (without the surrounding quotes) - # or specifying any user-defined transformation function - # (following above rules) works fine too. - if type(pltr) == types.StringType: - if pltr == "pltr0": - pltr = pltr0 - elif pltr == "pltr1": - pltr = pltr1 - elif pltr == "pltr2": - pltr = pltr2 - else: - raise ValueError, "pltr string is unrecognized" - - args = args[1:] - # Handle pltr_data or separate xg, yg, [wrap] - if len(args) == 0: - # Default pltr_data - pltr_data = None - elif len(args) == 1: - #Must be pltr_data - pltr_data = args[0] - args = args[1:] - elif len(args) >= 2: - xg = Numeric.asarray(args[0]) - if len(xg.shape) < 1 or len(xg.shape) > 2: - raise ValueError, "xg must be 1D or 2D array" - yg = Numeric.asarray(args[1]) - if len(yg.shape) != len(xg.shape): - raise ValueError, "yg must have same number of dimensions as xg" - args = args[2:] - # wrap only relevant if xg and yg specified. - if len(args) > 0: - if type(args[0]) == types.IntType: - wrap = args[0] - args = args[1:] - if len(xg.shape) == 2 and len(yg.shape) == 2 and \ - u.shape == xg.shape and u.shape == yg.shape: - # handle wrap - if wrap == 1: - u = Numeric.resize(u, (u.shape[0]+1, u.shape[1])) - v = Numeric.resize(v, (v.shape[0]+1, v.shape[1])) - xg = Numeric.resize(xg, (xg.shape[0]+1, xg.shape[1])) - yg = Numeric.resize(yg, (yg.shape[0]+1, yg.shape[1])) - elif wrap == 2: - u = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(u), (u.shape[1]+1, u.shape[0]))) - v = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(v), (v.shape[1]+1, v.shape[0]))) - xg = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(xg), (xg.shape[1]+1, xg.shape[0]))) - yg = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(yg), (yg.shape[1]+1, yg.shape[0]))) - elif wrap != 0: - raise ValueError, "Invalid wrap specifier, must be 0, 1 or 2." - elif wrap != 0: - raise ValueError, "Non-zero wrap specified and xg and yg are not 2D arrays" - else: - raise ValueError, "Specified wrap is not an integer" - pltr_data = (xg, yg) - else: - # default is identity transformation - pltr = pltr0 - pltr_data = None - if len(args) > 0: - raise ValueError, "Too many arguments for plvect" - _plvect(u, v, scaling, pltr, pltr_data) -plvect.__doc__ = _plvect.__doc__ - -# Redefine plimagefr to have the user-friendly interface -# Allowable syntaxes: - -# plimagefr( img, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, [pltr, [pltr_data] or [xg, yg, [wrap]]]) -_plimagefr = plimagefr -def plimagefr(img, *args): - img = Numeric.asarray(img) - - if len(img.shape) != 2: - raise ValueError, "Expected 2D img array" - - if len(args) >= 8 : - for i in range(8) : - if (type(args[i]) != types.FloatType and type(args[i]) != types.IntType) : - raise ValueError, "Expected 8 numbers for xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax" - else: - # These 8 args are xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax - xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax = args[0:8] - args = args[8:] - else: - raise ValueError, "Expected 8 numbers for xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax" - - if len(args) > 0 and ( \ - type(args[0]) == types.StringType or \ - type(args[0]) == types.FunctionType or \ - type(args[0]) == types.BuiltinFunctionType): - pltr = args[0] - # Handle the string names for the callbacks though specifying the - # built-in function name directly (without the surrounding quotes) - # or specifying any user-defined transformation function - # (following above rules) works fine too. - if type(pltr) == types.StringType: - if pltr == "pltr0": - pltr = pltr0 - elif pltr == "pltr1": - pltr = pltr1 - elif pltr == "pltr2": - pltr = pltr2 - else: - raise ValueError, "pltr string is unrecognized" - - args = args[1:] - # Handle pltr_data or separate xg, yg, [wrap] - if len(args) == 0: - # Default pltr_data - pltr_data = None - elif len(args) == 1: - #Must be pltr_data - pltr_data = args[0] - args = args[1:] - elif len(args) >= 2: - xg = Numeric.asarray(args[0]) - if len(xg.shape) < 1 or len(xg.shape) > 2: - raise ValueError, "xg must be 1D or 2D array" - yg = Numeric.asarray(args[1]) - if len(yg.shape) != len(xg.shape): - raise ValueError, "yg must have same number of dimensions as xg" - args = args[2:] - # wrap only relevant if xg and yg specified. - if len(args) > 0: - if type(args[0]) == types.IntType: - wrap = args[0] - args = args[1:] - if len(xg.shape) == 2 and len(yg.shape) == 2 and \ - img.shape[0] == xg.shape[0]-1 and img.shape[1] == xg.shape[1]-1: - # handle wrap - if wrap == 1: - img = Numeric.resize(img, (img.shape[0]+1, u.shape[1])) - xg = Numeric.resize(xg, (xg.shape[0]+1, xg.shape[1])) - yg = Numeric.resize(yg, (yg.shape[0]+1, yg.shape[1])) - elif wrap == 2: - img = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(img), (img.shape[1]+1, img.shape[0]))) - xg = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(xg), (xg.shape[1]+1, xg.shape[0]))) - yg = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(yg), (yg.shape[1]+1, yg.shape[0]))) - elif wrap != 0: - raise ValueError, "Invalid wrap specifier, must be 0, 1 or 2." - elif wrap != 0: - raise ValueError, "Non-zero wrap specified and xg and yg are not 2D arrays" - else: - raise ValueError, "Specified wrap is not an integer" - pltr_data = (xg, yg) - else: - # default is identity transformation - pltr = pltr0 - pltr_data = None - if len(args) > 0: - raise ValueError, "Too many arguments for plimagefr" - _plimagefr(img, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, pltr, pltr_data) -plimagefr.__doc__ = _plimagefr.__doc__ - -# Redefine plshades to have the user-friendly interface -# Allowable syntaxes: - -# plshades(z, [xmin, xmax, ymin, ymax,] clev, \ -# fill_width, [cont_color, cont_width,], rect, \ -# [pltr, [pltr_data] or [xg, yg, [wrap]]]) - -_plshades = plshades -def plshades(z, *args): - z = Numeric.asarray(z) - if len(z.shape) != 2: - raise ValueError, "Expected 2D z array" - - if len(args) > 4 and \ - (type(args[0]) == types.FloatType or type(args[0]) == types.IntType) and \ - (type(args[1]) == types.FloatType or type(args[1]) == types.IntType) and \ - (type(args[2]) == types.FloatType or type(args[2]) == types.IntType) and \ - (type(args[3]) == types.FloatType or type(args[3]) == types.IntType): - # These 4 args are xmin, xmax, ymin, ymax - xmin, xmax, ymin, ymax = args[0:4] - args = args[4:] - else: - # These values are ignored if pltr and pltr_data are defined in any case. - # So pick some convenient defaults that work for the pltr0, None case - xmin = -1. - xmax = 1. - ymin = -1. - ymax = 1. - - # clev must be present. - if len(args) > 0: - clev = Numeric.asarray(args[0]) - if len(clev.shape) !=1: - raise ValueError, "Expected 1D clev array" - args = args[1:] - else: - raise ValueError, "Missing clev argument" - - # fill_width must be present - if len(args) > 0 and type(args[0]) == types.IntType: - fill_width = args[0] - args = args[1:] - else: - raise ValueError, "Missing fill_width argument" - - # cont_color and cont_width are optional. - if len(args) > 2 and \ - type(args[0]) == types.IntType and \ - type(args[1]) == types.IntType: - # These 2 args are - cont_color, cont_width = args[0:2] - args = args[2:] - else: - # Turn off contouring. - cont_color, cont_width = (0,0) - - # rect must be present. - if len(args) > 0 and type(args[0]) == types.IntType: - rect = args[0] - args = args[1:] - else: - raise ValueError, "Missing rect argument" - - if len(args) > 0 and ( \ - type(args[0]) == types.NoneType or \ - type(args[0]) == types.StringType or \ - type(args[0]) == types.FunctionType or \ - type(args[0]) == types.BuiltinFunctionType): - pltr = args[0] - # Handle the string names for the callbacks though specifying the - # built-in function name directly (without the surrounding quotes) - # or specifying any user-defined transformation function - # (following above rules) works fine too. - if type(pltr) == types.StringType: - if pltr == "pltr0": - pltr = pltr0 - elif pltr == "pltr1": - pltr = pltr1 - elif pltr == "pltr2": - pltr = pltr2 - else: - raise ValueError, "pltr string is unrecognized" - - args = args[1:] - # Handle pltr_data or separate xg, yg, [wrap] - if len(args) == 0: - # Default pltr_data - pltr_data = None - elif len(args) == 1: - #Must be pltr_data - pltr_data = args[0] - args = args[1:] - elif len(args) >= 2: - xg = Numeric.asarray(args[0]) - if len(xg.shape) < 1 or len(xg.shape) > 2: - raise ValueError, "xg must be 1D or 2D array" - yg = Numeric.asarray(args[1]) - if len(yg.shape) != len(xg.shape): - raise ValueError, "yg must have same number of dimensions as xg" - args = args[2:] - # wrap only relevant if xg and yg specified. - if len(args) > 0: - if type(args[0]) == types.IntType: - wrap = args[0] - args = args[1:] - if len(xg.shape) == 2 and len(yg.shape) == 2 and \ - z.shape == xg.shape and z.shape == yg.shape: - # handle wrap - if wrap == 1: - z = Numeric.resize(z, (z.shape[0]+1, z.shape[1])) - xg = Numeric.resize(xg, (xg.shape[0]+1, xg.shape[1])) - yg = Numeric.resize(yg, (yg.shape[0]+1, yg.shape[1])) - elif wrap == 2: - z = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(z), (z.shape[1]+1, z.shape[0]))) - xg = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(xg), (xg.shape[1]+1, xg.shape[0]))) - yg = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(yg), (yg.shape[1]+1, yg.shape[0]))) - elif wrap != 0: - raise ValueError, "Invalid wrap specifier, must be 0, 1 or 2." - elif wrap != 0: - raise ValueError, "Non-zero wrap specified and xg and yg are not 2D arrays" - else: - raise ValueError, "Specified wrap is not an integer" - pltr_data = (xg, yg) - else: - # default is identity transformation - pltr = pltr0 - pltr_data = None - if len(args) > 0: - raise ValueError, "Too many arguments for plshades" - - _plshades(z, xmin, xmax, ymin, ymax, clev, \ - fill_width, cont_color, cont_width, rect, pltr, pltr_data) -plshades.__doc__ = _plshades.__doc__ - -# Redefine plshade to have the user-friendly interface -# Allowable syntaxes: - -# _plshade(z, [xmin, xmax, ymin, ymax,] \ -# shade_min, shade_max, sh_cmap, sh_color, sh_width, \ -# [min_color, min_width, max_color, max_width,] rect, \ -# [pltr, [pltr_data] or [xg, yg, [wrap]]]) - -# plshade(z, [xmin, xmax, ymin, ymax,] clev, \ -# fill_width, [cont_color, cont_width,], rect, \ -# [pltr, [pltr_data] or [xg, yg, [wrap]]]) - -_plshade = plshade -def plshade(z, *args): - z = Numeric.asarray(z) - if len(z.shape) != 2: - raise ValueError, "Expected 2D z array" - - # Extra check on shade_min = float on end is absolutely necessary - # to unambiguously figure out where we are in the argument list. - if len(args) > 9 and \ - (type(args[0]) == types.FloatType or type(args[0]) == types.IntType) and \ - (type(args[1]) == types.FloatType or type(args[1]) == types.IntType) and \ - (type(args[2]) == types.FloatType or type(args[2]) == types.IntType) and \ - (type(args[3]) == types.FloatType or type(args[3]) == types.IntType) and \ - type(args[4]) == types.FloatType: - # These 4 args are xmin, xmax, ymin, ymax - xmin, xmax, ymin, ymax = args[0:4] - args = args[4:] - else: - # These values are ignored if pltr and pltr_data are defined in any case. - # So pick some convenient defaults that work for the pltr0, None case - xmin = -1. - xmax = 1. - ymin = -1. - ymax = 1. - - # shade_min, shade_max, sh_cmap, sh_color, sh_width, must be present. - # sh_color can be either integer or float. - if len(args) > 5 and \ - type(args[0]) == types.FloatType and \ - type(args[1]) == types.FloatType and \ - type(args[2]) == types.IntType and \ - (type(args[3]) == types.FloatType or type(args[3]) == types.IntType) and \ - type(args[4]) == types.IntType: - shade_min, shade_max, sh_cmap, sh_color, sh_width = args[0:5] - args = args[5:] - else: - raise ValueError, \ - "shade_min, shade_max, sh_cmap, sh_color, sh_width, must be present" - - # min_color, min_width, max_color, max_width are optional. - if len(args) > 4 and \ - type(args[0]) == types.IntType and \ - type(args[1]) == types.IntType and \ - type(args[2]) == types.IntType and \ - type(args[3]) == types.IntType: - # These 4 args are - min_color, min_width, max_color, max_width = args[0:4] - args = args[4:] - else: - # Turn off boundary colouring - min_color, min_width, max_color, max_width = (0,0,0,0) - - # rect must be present. - if len(args) > 0 and type(args[0]) == types.IntType: - rect = args[0] - args = args[1:] - else: - raise ValueError, "Missing rect argument" - - if len(args) > 0 and ( \ - type(args[0]) == types.NoneType or \ - type(args[0]) == types.StringType or \ - type(args[0]) == types.FunctionType or \ - type(args[0]) == types.BuiltinFunctionType): - pltr = args[0] - # Handle the string names for the callbacks though specifying the - # built-in function name directly (without the surrounding quotes) - # or specifying any user-defined transformation function - # (following above rules) works fine too. - if type(pltr) == types.StringType: - if pltr == "pltr0": - pltr = pltr0 - elif pltr == "pltr1": - pltr = pltr1 - elif pltr == "pltr2": - pltr = pltr2 - else: - raise ValueError, "pltr string is unrecognized" - - args = args[1:] - # Handle pltr_data or separate xg, yg, [wrap] - if len(args) == 0: - # Default pltr_data - pltr_data = None - elif len(args) == 1: - #Must be pltr_data - pltr_data = args[0] - args = args[1:] - elif len(args) >= 2: - xg = Numeric.asarray(args[0]) - if len(xg.shape) < 1 or len(xg.shape) > 2: - raise ValueError, "xg must be 1D or 2D array" - yg = Numeric.asarray(args[1]) - if len(yg.shape) != len(xg.shape): - raise ValueError, "yg must have same number of dimensions as xg" - args = args[2:] - # wrap only relevant if xg and yg specified. - if len(args) > 0: - if type(args[0]) == types.IntType: - wrap = args[0] - args = args[1:] - if len(xg.shape) == 2 and len(yg.shape) == 2 and \ - z.shape == xg.shape and z.shape == yg.shape: - # handle wrap - if wrap == 1: - z = Numeric.resize(z, (z.shape[0]+1, z.shape[1])) - xg = Numeric.resize(xg, (xg.shape[0]+1, xg.shape[1])) - yg = Numeric.resize(yg, (yg.shape[0]+1, yg.shape[1])) - elif wrap == 2: - z = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(z), (z.shape[1]+1, z.shape[0]))) - xg = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(xg), (xg.shape[1]+1, xg.shape[0]))) - yg = Numeric.transpose(Numeric.resize( \ - Numeric.transpose(yg), (yg.shape[1]+1, yg.shape[0]))) - elif wrap != 0: - raise ValueError, "Invalid wrap specifier, must be 0, 1 or 2." - elif wrap != 0: - raise ValueError, "Non-zero wrap specified and xg and yg are not 2D arrays" - else: - raise ValueError, "Specified wrap is not an integer" - pltr_data = (xg, yg) - else: - # default is identity transformation - pltr = pltr0 - pltr_data = None - if len(args) > 0: - raise ValueError, "Too many arguments for plshade" - - _plshade(z, xmin, xmax, ymin, ymax, \ - shade_min, shade_max, sh_cmap, sh_color, sh_width, \ - min_color, min_width, max_color, max_width, rect, pltr, pltr_data) -plshade.__doc__ = _plshade.__doc__ - -# Redefine plscmap1l to have the user-friendly interface -# Allowable syntaxes: - -# plscmap1l(itype, pos, coord1, coord2, coord3[, alt_hue_path]) - -_plscmap1l = plscmap1l -def plscmap1l(itype, pos, coord1, coord2, coord3, *args): - - pos = Numeric.asarray(pos) - if len(pos.shape) != 1: - raise ValueError, "Expected 1D pos array" - - if len(args) == 0: - # Default alt_hue_path - alt_hue_path = Numeric.zeros(pos.shape[0]-1) - elif len(args) == 1: - alt_hue_path = Numeric.asarray(args[0]) - else: - raise ValueError, "Too many arguments to plscmap1l" - _plscmap1l(itype, pos, coord1, coord2, coord3, alt_hue_path) -plscmap1l.__doc__ = _plscmap1l.__doc__ Deleted: trunk/bindings/python/plplot.py.numpy =================================================================== --- trunk/bindings/python/plplot.py.numpy 2013-05-10 20:32:28 UTC (rev 12339) +++ trunk/bindings/python/plplot.py.numpy 2013-05-10 22:12:04 UTC (rev 12340) @@ -1,649 +0,0 @@ -# Copyright 2002 Gary Bishop and Alan W. Irwin -# Copyright 2008 Andrew Ross -# This file is part of PLplot. - -# PLplot is free software; you can redistribute it and/or modify -# it under the terms of the GNU Library General Public License as published by -# the Free Software Foundation; version 2 of the License. - -# PLplot is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library General Public License for more details. - -# You should have received a copy of the GNU Library General Public License -# along with the file PLplot; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -# Wrap raw python interface to C API, plplotc, with this user-friendly version -# which implements some useful variations of the argument lists. - -from plplotc import * -import types -import numpy - -# Redefine plcont to have the user-friendly interface -# Allowable syntaxes: - -# plcont( z, [kx, lx, ky, ly], clev, [pltr, [pltr_data] or [xg, yg, [wrap]]]) -# N.B. Brackets represent options here and not python lists! - -# All unbracketed arguments within brackets must all be present or all be -# missing. Furthermore, z must be a 2D array, kx, lx, ky, ly must all be -# integers, clev must be a 1D array, pltr can be a function reference or -# string, pltr_data is an optional arbitrary data object, xg and yg are -# optional 1D or 2D arrays and wrap (which only works if xg and yg -# are specified) is 0, 1, or 2. - -# If pltr is a string it must be either "pltr0", "pltr1", or "pltr2" to -# refer to those built-in transformation functions. Alternatively, the -# function names pltr0, pltr1, or pltr2 may be specified to refer to -# the built-in transformation functions or an arbitrary name for a -# user-defined transformation function may be specified. Such functions -# must have x, y, and optional pltr_data arguments and return arbitrarily -# transformed x' and y' in a tuple. The built-in pltr's such as pltr1 and -# pltr2 use pltr_data = tuple(xg, yg), and for this oft-used case (and any -# other user-defined pltr which uses a tuple of two arrays for pltr_data), -# we also provide optional xg and yg arguments separately as an alternative -# to the tuple method of providing these data. Note, that pltr_data cannot -# be in the argument list if xg and yg are there, and vice versa. Also note -# that the built-in pltr0 and some user-defined transformation functions -# ignore the auxiliary pltr_data (or the alternative xg and yg) in which -# case neither pltr_data nor xg and yg need to be specified. - -_plcont = plcont -def plcont(z, *args): - z = numpy.asarray(z) - if len(z.shape) != 2: - raise ValueError, "Expected 2D z array" - - if len(args) > 4 and type(args[0]) == types.IntType: - for i in range(1,4): - if type(args[i]) != types.IntType: - raise ValueError, "Expected 4 ints for kx,lx,ky,ly" - - else: - # these 4 args are the kx, lx, ky, ly ints - ifdefault_range = 0 - kx,lx,ky,ly = args[0:4] - args = args[4:] - else: - ifdefault_range = 1 - - if len(args) > 0: - clev = numpy.asarray(args[0]) - if len(clev.shape) !=1: - raise ValueError, "Expected 1D clev array" - args = args[1:] - else: - raise ValueError, "Missing clev argument" - - if len(args) > 0 and ( \ - type(args[0]) == types.StringType or \ - type(args[0]) == types.FunctionType or \ - type(args[0]) == types.BuiltinFunctionType): - pltr = args[0] - # Handle the string names for the callbacks though specifying the - # built-in function name directly (without the surrounding quotes) - # or specifying any user-defined transformation function - # (following above rules) works fine too. - if type(pltr) == types.StringType: - if pltr == "pltr0": - pltr = pltr0 - elif pltr == "pltr1": - pltr = pltr1 - elif pltr == "pltr2": - pltr = pltr2 - else: - raise ValueError, "pltr string is unrecognized" - - args = args[1:] - # Handle pltr_data or separate xg, yg, [wrap] - if len(args) == 0: - # Default pltr_data - pltr_data = None - elif len(args) == 1: - #Must be pltr_data - pltr_data = args[0] - args = args[1:] - elif len(args) >= 2: - xg = numpy.asarray(args[0]) - if len(xg.shape) < 1 or len(xg.shape) > 2: - raise ValueError, "xg must be 1D or 2D array" - yg = numpy.asarray(args[1]) - if len(yg.shape) != len(xg.shape): - raise ValueError, "yg must have same number of dimensions as xg" - args = args[2:] - # wrap only relevant if xg and yg specified. - if len(args) > 0: - if type(args[0]) == types.IntType: - wrap = args[0] - args = args[1:] - if len(xg.shape) == 2 and len(yg.shape) == 2 and \ - z.shape == xg.shape and z.shape == yg.shape: - # handle wrap - if wrap == 1: - z = numpy.resize(z, (z.shape[0]+1, z.shape[1])) - xg = numpy.resize(xg, (xg.shape[0]+1, xg.shape[1])) - yg = numpy.resize(yg, (yg.shape[0]+1, yg.shape[1])) - elif wrap == 2: - z = numpy.transpose(numpy.resize( \ - numpy.transpose(z), (z.shape[1]+1, z.shape[0]))) - xg = numpy.transpose(numpy.resize( \ - numpy.transpose(xg), (xg.shape[1]+1, xg.shape[0]))) - yg = numpy.transpose(numpy.resize( \ - numpy.transpose(yg), (yg.shape[1]+1, yg.shape[0]))) - elif wrap != 0: - raise ValueError, "Invalid wrap specifier, must be 0, 1 or 2." - elif wrap != 0: - raise ValueError, "Non-zero wrap specified and xg and yg are not 2D arrays" - else: - raise ValueError, "Specified wrap is not an integer" - pltr_data = (xg, yg) - else: - # default is identity transformation - pltr = pltr0 - pltr_data = None - if len(args) > 0: - raise ValueError, "Too many arguments for plcont" - if ifdefault_range: - # Default is to take full range (still using fortran convention - # for indices which is embedded in the PLplot library API) - kx = 1 - lx = z.shape[0] - ky = 1 - ly = z.shape[1] - _plcont(z, kx, lx, ky, ly, clev, pltr, pltr_data) -plcont.__doc__ = _plcont.__doc__ - -# Redefine plvect to have the user-friendly interface -# Allowable syntaxes: - -# plvect( u, v, scaling, [pltr, [pltr_data] or [xg, yg, [wrap]]]) -_plvect = plvect -def plvect(u, v, *args): - u = numpy.asarray(u) - v = numpy.asarray(v) - - if len(u.shape) != 2: - raise ValueError, "Expected 2D u array" - if len(v.shape) != 2: - raise ValueError, "Expected 2D v array" - if (u.shape[0] != v.shape[0]) or (u.shape[1] != v.shape[1]) : - raise... [truncated message content] |
From: <and...@us...> - 2013-05-22 22:35:04
|
Revision: 12343 http://sourceforge.net/p/plplot/code/12343 Author: andrewross Date: 2013-05-22 22:35:01 +0000 (Wed, 22 May 2013) Log Message: ----------- Update plcolorbar arrays to use the const modifier consistent with other API functions. Modified Paths: -------------- trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2013-05-22 19:04:49 UTC (rev 12342) +++ trunk/include/plplot.h 2013-05-22 22:35:01 UTC (rev 12343) @@ -1256,10 +1256,10 @@ 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_labels, const PLINT *label_opts, const char * const *label, + PLINT n_axes, const char * const * axis_opts, + const PLFLT *ticks, const PLINT *sub_ticks, + const PLINT *n_values, const PLFLT * const *values ); // Sets position of the light source PLDLLIMPEXP void Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2013-05-22 19:04:49 UTC (rev 12342) +++ trunk/src/pllegend.c 2013-05-22 22:35:01 UTC (rev 12343) @@ -1466,10 +1466,10 @@ 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 *labels[], - PLINT n_axes, const char *axis_opts[], - PLFLT *ticks, PLINT *sub_ticks, - PLINT *n_values, const PLFLT * const *values ) + PLINT n_labels, const PLINT *label_opts, const char * const *labels, + PLINT n_axes, const char * const *axis_opts, + const PLFLT *ticks, const PLINT *sub_ticks, + const PLINT *n_values, const PLFLT * const *values ) { // Min and max values // Assumes that the values array is sorted from smallest to largest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2013-05-22 22:39:29
|
Revision: 12344 http://sourceforge.net/p/plplot/code/12344 Author: andrewross Date: 2013-05-22 22:39:26 +0000 (Wed, 22 May 2013) Log Message: ----------- Update arguments to plcolorbar in C++ bindings. Add in plscmap1_range / plgcmap1_range support for C++. Update C++ version of example 33 to mirror the C version. Modified Paths: -------------- trunk/bindings/c++/plstream.cc trunk/bindings/c++/plstream.h trunk/examples/c++/x33.cc Modified: trunk/bindings/c++/plstream.cc =================================================================== --- trunk/bindings/c++/plstream.cc 2013-05-22 22:35:01 UTC (rev 12343) +++ trunk/bindings/c++/plstream.cc 2013-05-22 22:39:26 UTC (rev 12344) @@ -1001,7 +1001,7 @@ const PLINT *line_colors, const PLINT *line_styles, const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, - const PLINT *symbol_numbers, const char **symbols ) + const PLINT *symbol_numbers, const char * const *symbols ) { set_stream(); @@ -1019,8 +1019,8 @@ PLINT bg_color, PLINT bb_color, PLINT bb_style, PLFLT low_cap_color, PLFLT high_cap_color, PLINT cont_color, PLINT cont_width, - PLINT n_labels, PLINT *label_opts, const char *label[], - PLINT n_axes, const char *axis_opts[], + PLINT n_labels, PLINT *label_opts, const char * const *label, + PLINT n_axes, const char * const *axis_opts, PLFLT *ticks, PLINT *sub_ticks, PLINT *n_values, const PLFLT * const *values ) { @@ -1383,6 +1383,24 @@ plscmap1n( ncol1 ); } +// Set number of colors in cmap 1 + +void plstream::scmap1_range( PLFLT min_color, PLFLT max_color ) +{ + set_stream(); + + plscmap1_range( min_color, max_color ); +} + +// Set number of colors in cmap 1 + +void plstream::gcmap1_range( PLFLT & min_color, PLFLT & max_color ) +{ + set_stream(); + + plgcmap1_range( &min_color, &max_color); +} + // Set color map 0 colors by 8 bit RGB values void plstream::scmap0( const PLINT *r, const PLINT *g, const PLINT *b, PLINT ncol0 ) Modified: trunk/bindings/c++/plstream.h =================================================================== --- trunk/bindings/c++/plstream.h 2013-05-22 22:35:01 UTC (rev 12343) +++ trunk/bindings/c++/plstream.h 2013-05-22 22:39:26 UTC (rev 12344) @@ -440,7 +440,7 @@ const PLINT *line_colors, const PLINT *line_styles, const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, - const PLINT *symbol_numbers, const char **symbols ); + const PLINT *symbol_numbers, const char * const *symbols ); void colorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, PLINT opt, PLINT position, PLFLT x, PLFLT y, @@ -448,8 +448,8 @@ PLINT bg_color, PLINT bb_color, PLINT bb_style, PLFLT low_cap_color, PLFLT high_cap_color, PLINT cont_color, PLINT cont_width, - PLINT n_labels, PLINT *label_opts, const char *label[], - PLINT n_axes, const char *axis_opts[], + PLINT n_labels, PLINT *label_opts, const char * const *label, + PLINT n_axes, const char * const *axis_opts, PLFLT *ticks, PLINT *sub_ticks, PLINT *n_values, const PLFLT * const *values ); @@ -605,6 +605,14 @@ void scmap1n( PLINT ncol1 ); +// Set the color map 1 range used in continuous plots + + void scmap1_range( PLFLT min_color, PLFLT max_color ); + +// Get the color map 1 range used in continuous plots + + void gcmap1_range( PLFLT &min_color, PLFLT &max_color ); + // Set color map 0 colors by 8 bit RGB values void scmap0( const PLINT *r, const PLINT *g, const PLINT *b, PLINT ncol0 ); Modified: trunk/examples/c++/x33.cc =================================================================== --- trunk/examples/c++/x33.cc 2013-05-22 22:35:01 UTC (rev 12343) +++ trunk/examples/c++/x33.cc 2013-05-22 22:39:26 UTC (rev 12344) @@ -37,6 +37,11 @@ using namespace std; #endif +#define COLORBAR_KINDS 4 +#define COLORBAR_POSITIONS 4 +#define COLORBAR_LABELS 4 +#define COLORBAR_CAPS 4 + class x33 { public: x33( int, const char ** ); @@ -47,9 +52,17 @@ static const PLINT position_options[16]; static const char *special_symbols[5]; + static const PLINT colorbar_option_kinds[COLORBAR_KINDS]; + static const char *colorbar_option_kind_labels[COLORBAR_KINDS]; + static const PLINT colorbar_position_options[COLORBAR_POSITIONS]; + static const char *colorbar_position_option_labels[COLORBAR_POSITIONS]; + static const PLINT colorbar_label_options[COLORBAR_LABELS]; + static const char *colorbar_label_option_labels[COLORBAR_LABELS]; + static const PLINT colorbar_cap_options[COLORBAR_CAPS]; + static const char *colorbar_cap_option_labels[COLORBAR_CAPS]; - void plcolorbar_example_1( PLINT, PLINT, PLINT, PLFLT, PLINT, PLINT, PLFLT *, const char * ); - void plcolorbar_example_2( PLINT, PLINT, PLINT, PLFLT, PLFLT, PLINT, PLFLT *, const char * ); + void plcolorbar_example_page( int, int, int, PLINT, PLFLT, PLINT, PLFLT * ); + void plcolorbar_example( const char *, int, PLINT, PLFLT, PLINT, PLFLT * ); PLFLT MIN( PLFLT x, PLFLT y ) { return ( x < y ? x : y ); }; PLFLT MAX( PLFLT x, PLFLT y ) { return ( x > y ? x : y ); }; @@ -83,164 +96,210 @@ "✦" }; -# if 0 +// plcolorbar options + +// Colorbar type options +const PLINT x33::colorbar_option_kinds[COLORBAR_KINDS] = { + PL_COLORBAR_SHADE, + PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, + PL_COLORBAR_IMAGE, + PL_COLORBAR_GRADIENT +}; +const char *x33::colorbar_option_kind_labels[COLORBAR_KINDS] = { + "Shade colorbars", + "Shade colorbars with custom labels", + "Image colorbars", + "Gradient colorbars" +}; + +// Which side of the page are we positioned relative to? +const PLINT x33::colorbar_position_options[COLORBAR_POSITIONS] = { + PL_POSITION_LEFT, + PL_POSITION_RIGHT, + PL_POSITION_TOP, + PL_POSITION_BOTTOM +}; +const char *x33::colorbar_position_option_labels[COLORBAR_POSITIONS] = { + "Left", + "Right", + "Top", + "Bottom" +}; + +// Colorbar label positioning options +const PLINT x33::colorbar_label_options[COLORBAR_LABELS] = { + PL_COLORBAR_LABEL_LEFT, + PL_COLORBAR_LABEL_RIGHT, + PL_COLORBAR_LABEL_TOP, + PL_COLORBAR_LABEL_BOTTOM +}; +const char *x33::colorbar_label_option_labels[COLORBAR_LABELS] = { + "Label left", + "Label right", + "Label top", + "Label bottom" +}; + +// Colorbar cap options +const PLINT x33::colorbar_cap_options[COLORBAR_CAPS] = { + PL_COLORBAR_CAP_NONE, + PL_COLORBAR_CAP_LOW, + PL_COLORBAR_CAP_HIGH, + PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH +}; +const char *x33::colorbar_cap_option_labels[COLORBAR_CAPS] = { + "No caps", + "Low cap", + "High cap", + "Low and high caps" +}; + void -x33::plcolorbar_example_1( PLINT bar_type, PLINT cont_color, PLINT cont_width, PLFLT ticks, PLINT sub_ticks, PLINT n, PLFLT *values, const char *title ) +x33::plcolorbar_example_page( int kind_i, int label_i, int cap_i, PLINT cont_color, PLFLT cont_width, PLINT n_values, PLFLT *values ) { + // Parameters for the colorbars on this page + PLINT position_i, position, opt; + PLFLT x, y, x_length, y_length; + PLFLT ticks[1] = { 0.0 }; + PLINT sub_ticks[1] = { 0 }; + PLFLT low_cap_color, high_cap_color; + PLINT vertical, ifn; + PLINT n_axes = 1; + const char *axis_opts[1]; + PLINT n_labels = 1; + PLINT label_opts[1] = { 0 }; + char *label; + char title[200]; + PLFLT colorbar_width, colorbar_height; + PLINT n_values_array[1]; + PLFLT *values_array[1]; + + label = new char[200]; + + n_values_array[0] = n_values; + values_array[0] = values; + + low_cap_color = 0.0; + high_cap_color = 1.0; + + // Start a new page pls->adv( 0 ); - // Setup color palette 1 - pls->spal1( "cmap1_blue_red.pal", 1 ); - PLFLT colors[n]; - int i; - PLFLT color_step; - color_step = 1.0 / (PLFLT) ( n - 1 ); - for ( i = 0; i < n; i++ ) + // Draw one colorbar relative to each side of the page + for ( position_i = 0; position_i < COLORBAR_POSITIONS; position_i++ ) { - colors[i] = 0.0 + color_step * (PLFLT) ( i ); - } + position = colorbar_position_options[position_i]; + opt = + colorbar_option_kinds[kind_i] | + colorbar_label_options[label_i] | + colorbar_cap_options[cap_i]; - PLINT opt, position; - position = PL_POSITION_LEFT; - opt = bar_type | PL_COLORBAR_LABEL_LEFT | - PL_COLORBAR_CAP_HIGH; + vertical = position & PL_POSITION_LEFT || position & PL_POSITION_RIGHT; + ifn = position & PL_POSITION_LEFT || position & PL_POSITION_BOTTOM; - const char *axis_opts_1, *axis_opts_2; - if ( bar_type & PL_COLORBAR_SHADE_LABEL ) - { - axis_opts_1 = "iv"; - axis_opts_2 = "i"; - } - else - { - if ( sub_ticks != 0 ) + // Set the offset position on the page + if ( vertical ) { - axis_opts_1 = "stv"; - axis_opts_2 = "st"; + x = 0.0; + y = 0.0; + x_length = 0.05; + y_length = 0.5; } else { - axis_opts_1 = "tv"; - axis_opts_2 = "t"; + x = 0.0; + y = 0.0; + x_length = 0.5; + y_length = 0.05; } - } - pls->colorbar( opt, position, 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 ); + // Set appropriate labelling options. + if ( ifn ) + { + if ( cont_color == 0 || cont_width == 0. ) + { + axis_opts[0] = "uwtivn"; + //axis_opts[0] = "uwtin"; + } + else + { + axis_opts[0] = "uwxvn"; + //axis_opts[0] = "uwxn"; + } + } + else + { + if ( cont_color == 0 || cont_width == 0. ) + { + axis_opts[0] = "uwtivm"; + //axis_opts[0] = "uwtim"; + } + else + { + axis_opts[0] = "uwxvm"; + //axis_opts[0] = "uwxm"; + } + } - position = PL_POSITION_RIGHT; - opt = bar_type | PL_COLORBAR_LABEL_RIGHT | - PL_COLORBAR_CAP_LOW; + sprintf( label, "%s, %s", + colorbar_position_option_labels[position_i], + colorbar_label_option_labels[label_i] ); - pls->colorbar( opt, position, 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 ); + // Smaller text + pls->schr( 0.0, 0.75 ); + // Small ticks on the vertical axis + pls->smaj( 0.0, 0.5 ); + pls->smin( 0.0, 0.5 ); - position = PL_POSITION_TOP; - opt = bar_type | PL_COLORBAR_LABEL_TOP | - PL_COLORBAR_CAP_HIGH; + pls->vpor( 0.20, 0.80, 0.20, 0.80 ); + pls->wind( 0.0, 1.0, 0.0, 1.0 ); + // Set interesting background colour. + pls->scol0a( 15, 0, 0, 0, 0.20 ); + pls->colorbar( &colorbar_width, &colorbar_height, + 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, + n_labels, label_opts, (const char **) &label, + n_axes, axis_opts, + ticks, sub_ticks, + n_values_array, (const PLFLT * const *) values_array ); - pls->colorbar( opt, position, 0.1, 0.1, 0.5, 0.1, - cont_color, cont_width, ticks, sub_ticks, - axis_opts_2, "Test label - Top, High Cap", - n, colors, values ); + // Reset text and tick sizes + pls->schr( 0.0, 1.0 ); + pls->smaj( 0.0, 1.0 ); + pls->smin( 0.0, 1.0 ); + } - position = PL_POSITION_BOTTOM; - opt = bar_type | PL_COLORBAR_LABEL_BOTTOM | - PL_COLORBAR_CAP_LOW; - - pls->colorbar( opt, position, 0.4, 0.1, 0.5, 0.1, - cont_color, cont_width, ticks, sub_ticks, - axis_opts_2, "Test label - Bottom, Low Cap", - n, colors, values ); - + // Draw a page title + sprintf( title, "%s - %s", + colorbar_option_kind_labels[kind_i], + colorbar_cap_option_labels[cap_i] ); pls->vpor( 0.0, 1.0, 0.0, 1.0 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->ptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); } void -x33::plcolorbar_example_2( PLINT bar_type, PLINT cont_color, PLINT cont_width, PLFLT ticks, PLFLT sub_ticks, PLINT n, PLFLT *values, const char *title ) +x33::plcolorbar_example( const char *palette, int kind_i, PLINT cont_color, PLFLT cont_width, PLINT n_values, PLFLT *values ) { - pls->adv( 0 ); - // Setup color palette 1 - pls->spal1( "cmap1_blue_yellow.pal", 1 ); + int label_i, cap_i; - PLFLT colors[n]; - int i; - PLFLT color_step; - color_step = 1.0 / (PLFLT) ( n - 1 ); - for ( i = 0; i < n; i++ ) - { - colors[i] = 0.0 + color_step * (PLFLT) ( i ); - } + // Load the color palette + pls->spal1( palette, 1 ); - PLINT opt, position; - position = PL_POSITION_LEFT; - opt = bar_type | PL_COLORBAR_LABEL_LEFT | - PL_COLORBAR_CAP_LOW; - - const char *axis_opts_1, *axis_opts_2; - if ( bar_type == PL_COLORBAR_SHADE_LABEL ) + for ( label_i = 0; label_i < COLORBAR_LABELS; label_i++ ) { - axis_opts_1 = ""; - axis_opts_2 = ""; - } - else - { - if ( sub_ticks != 0 ) + for ( cap_i = 0; cap_i < COLORBAR_CAPS; cap_i++ ) { - axis_opts_1 = "stv"; - axis_opts_2 = "st"; + plcolorbar_example_page( kind_i, label_i, cap_i, + cont_color, cont_width, + n_values, values ); } - else - { - axis_opts_1 = "tv"; - axis_opts_2 = "t"; - } } - - pls->colorbar( opt, position, 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 ); - - position = PL_POSITION_RIGHT; - opt = bar_type | PL_COLORBAR_LABEL_RIGHT | - PL_COLORBAR_CAP_HIGH; - - pls->colorbar( opt, position, 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 ); - - position = PL_POSITION_TOP; - opt = bar_type | PL_COLORBAR_LABEL_TOP | - PL_COLORBAR_CAP_LOW; - - pls->colorbar( opt, position, 0.1, 0.1, 0.5, 0.1, - cont_color, cont_width, ticks, sub_ticks, - axis_opts_2, "Test label - Top, Low Cap", - n, colors, values ); - - position = PL_POSITION_BOTTOM; - opt = bar_type | PL_COLORBAR_LABEL_BOTTOM | - PL_COLORBAR_CAP_HIGH; - - pls->colorbar( opt, position, 0.4, 0.1, 0.5, 0.1, - cont_color, cont_width, ticks, sub_ticks, - axis_opts_2, "Test label - Bottom, High Cap", - n, colors, values ); - - pls->vpor( 0.0, 1.0, 0.0, 1.0 ); - pls->wind( 0.0, 1.0, 0.0, 1.0 ); - pls->ptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); } -#endif //-------------------------------------------------------------------------- // x33 // @@ -796,31 +855,37 @@ NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); -#if 0 - // Color bar examples - 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.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, 0, 0, 3.0, 3, 9, values_even, - "Shade Color Bars - Even Steps" ); - 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, 0, 0.5, 5, 2, values_small, - "Gradient Color Bars" ); -#endif - // Free space that contained legend text. for ( k = 0; k < MAX_NLEGEND; k++ ) delete [] text[k]; + + // Color bar examples + PLFLT values_small[2] = { -1.0e-200, 1.0e-200 }; + PLFLT values_uneven[9] = { -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 }; + PLFLT values_even[9] = { -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. + pls->scolbg( 70, 185, 70 ); + // Cut out the greatest and smallest bits of the color spectrum to + // leave colors for the end caps. + pls->scmap1_range( 0.01, 0.99 ); + + // We can only test image and gradient colorbars with two element arrays + for ( i = 2; i < COLORBAR_KINDS; i++ ) + { + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 2, values_small ); + } + // Test shade colorbars with larger arrays + for ( i = 0; i < 2; i++ ) + { + plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, 9, values_even ); + } + for ( i = 0; i < 2; i++ ) + { + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 9, values_uneven ); + } + //plend(); delete pls; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <and...@us...> - 2013-05-22 22:46:37
|
Revision: 12348 http://sourceforge.net/p/plplot/code/12348 Author: andrewross Date: 2013-05-22 22:46:35 +0000 (Wed, 22 May 2013) Log Message: ----------- Update java bindings to support plcolorbar. Update example 16 and 33 consistent with the C versions. Modified Paths: -------------- trunk/bindings/java/PLStream.java trunk/bindings/java/plplotjavac.i trunk/examples/java/x16.java trunk/examples/java/x33.java Modified: trunk/bindings/java/PLStream.java =================================================================== --- trunk/bindings/java/PLStream.java 2013-05-22 22:44:41 UTC (rev 12347) +++ trunk/bindings/java/PLStream.java 2013-05-22 22:46:35 UTC (rev 12348) @@ -554,18 +554,31 @@ symbol_numbers, symbols ); } - // -// public void colorbar( int opt, double x, double y, double length, -// double width, double ticks, double subticks, -// String axis_opts, String label, -// double[] colors, double[] values ) -// { -// if ( set_stream() == -1 ) return; -// plplotjavac.plcolorbar( opt, x, y, length, width, ticks, subticks, -// axis_opts, label, colors, values ); -// } -// + public void colorbar( double[] p_colorbar_width, + double[] p_colorbar_height, + int opt, int position, double x, double y, + double x_length, double y_length, + int bg_color, int bb_color, int bb_style, + double low_cap_color, double high_cap_color, + int cont_color, double cont_width, + int[] label_opts, String[] labels, + String[] axis_opts, + double[] ticks, int[] sub_ticks, + int[] n_values, double[][] values ) + { + if ( set_stream() == -1 ) return; + plplotjavac.plcolorbar( p_colorbar_width, p_colorbar_height, + opt, position, x, y, x_length, y_length, + bg_color, bb_color, bb_style, + low_cap_color, high_cap_color, + cont_color, cont_width, + label_opts, labels, axis_opts, + ticks, sub_ticks, + n_values, values ); + } + + public void lightsource( double x, double y, double z ) { if ( set_stream() == -1 ) return; @@ -806,6 +819,18 @@ plplotjavac.plscmap1n( ncol1 ); } + public void scmap1_range( double min_color, double max_color ) + { + if ( set_stream() == -1 ) return; + plplotjavac.plscmap1_range( min_color, max_color ); + } + + public void gcmap1_range( double[] min_color, double[] max_color ) + { + if ( set_stream() == -1 ) return; + plplotjavac.plgcmap1_range( min_color, max_color ); + } + public void scol0( int icol0, int r, int g, int b ) { if ( set_stream() == -1 ) return; Modified: trunk/bindings/java/plplotjavac.i =================================================================== --- trunk/bindings/java/plplotjavac.i 2013-05-22 22:44:41 UTC (rev 12347) +++ trunk/bindings/java/plplotjavac.i 2013-05-22 22:46:35 UTC (rev 12348) @@ -580,6 +580,33 @@ return $jnicall; } +// Set X and Y length for later consistency checking +%typemap( in ) const PLINT * ArrayN { + int i; + jint *jydata = ( *jenv )->GetIntArrayElements( jenv, $input, 0 ); + if ( ( *jenv )->GetArrayLength( jenv, $input ) != Alen ) + { + printf( "Vectors must be same length.\n" ); + return; + } + Xlen = ( *jenv )->GetArrayLength( jenv, $input ); + Ylen = -1; + for ( i = 0; i < Xlen ; i++ ) + if (jydata[i] > Ylen) Ylen = jydata[i]; + setup_array_1d_i( &$1, jydata, Alen ); + ( *jenv )->ReleaseIntArrayElements( jenv, $input, jydata, 0 ); +} +%typemap( freearg ) const PLINT * ArrayN { + free( $1 ); +} +%typemap( jni ) const PLINT * ArrayN "jintArray" +%typemap( jtype ) const PLINT * ArrayN "int[]" +%typemap( jstype ) const PLINT * ArrayN "int[]" +%typemap( javain ) const PLINT * ArrayN "$javainput" +%typemap( javaout ) const PLINT * ArrayN { + return $jnicall; +} + //-------------------------------------------------------------------------- // PLFLT Arrays //-------------------------------------------------------------------------- @@ -1937,6 +1964,53 @@ return $jnicall; } +%typemap( in ) ( PLINT n, const char **Array ) +{ + int i = 0; + if ( $input != NULL ) + { + int size = ( *jenv )->GetArrayLength( jenv, $input ); + Alen = size; + $1 = size; + $2 = (char **) malloc( Alen * sizeof ( char * ) ); + // make a copy of each string + for ( i = 0; i < Alen; i++ ) + { + jstring j_string = (jstring) ( *jenv )->GetObjectArrayElement( jenv, $input, i ); + const char * c_string = (char *) ( *jenv )->GetStringUTFChars( jenv, j_string, 0 ); + $2[i] = malloc( ( strlen( c_string ) + 1 ) * sizeof ( const char * ) ); + strcpy( $2[i], c_string ); + ( *jenv )->ReleaseStringUTFChars( jenv, j_string, c_string ); + ( *jenv )->DeleteLocalRef( jenv, j_string ); + } + } + else + { + $1 = 0; + $2 = NULL; + } +} + +// This cleans up the memory we malloc'd before the function call +%typemap( freearg ) ( PLINT n, const char **Array ) +{ + int i; + if ( $2 != NULL ) + { + for ( i = 0; i < Alen; i++ ) + free( $2[i] ); + free( $2 ); + } +} +%typemap( jni ) ( PLINT n, const char **Array ) "jobjectArray" +%typemap( jtype ) ( PLINT n, const char **Array ) "String[]" +%typemap( jstype ) ( PLINT n, const char **Array ) "String[]" +%typemap( javain ) ( PLINT n, const char **Array ) "$javainput" +%typemap( javaout ) ( PLINT n, const char **Array ) +{ + return $jnicall; +} + #if 0 %typemap( in ) PLGraphicsIn * gin( PLGraphicsIn tmp ) { Modified: trunk/examples/java/x16.java =================================================================== --- trunk/examples/java/x16.java 2013-05-22 22:44:41 UTC (rev 12347) +++ trunk/examples/java/x16.java 2013-05-22 22:46:35 UTC (rev 12348) @@ -40,6 +40,8 @@ static final int XPTS = 35; static final int YPTS = 46; static final int PERIMETERPTS = 100; + static final int NUM_AXES = 1; + static final int NUM_LABELS = 1; // calculated constants and array that depends on them static final double XSPA = 2. / ( XPTS - 1 ); @@ -90,7 +92,21 @@ double[] shedge = new double[NSHADES + 1]; final int cont_color = 0; final double fill_width = 2., cont_width = 0.; + double[] colorbar_width = new double[1]; + double[] colorbar_height = new double[1]; + int n_axis_opts = NUM_AXES; + int[] num_values = new int[NUM_AXES]; + double[][] values = new double[NUM_AXES][NSHADES+1]; + String axis_opts[] = { "bcvtm" }; + double axis_ticks[] = { 0.0 }; + int axis_subticks[] = { 0 }; + double filler_values[] = { 0.0, 1.0 }; + + int n_labels = NUM_LABELS; + int label_opts[] = { PL_COLORBAR_LABEL_BOTTOM }; + String labels[] = { "Magnitude" }; + // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); @@ -168,6 +184,30 @@ cont_color, cont_width, true, xg0, yg0 ); + // Smaller text + pls.schr( 0.0, 0.75 ); + // Small ticks on the vertical axis + pls.smaj( 0.0, 0.5 ); + pls.smin( 0.0, 0.5 ); + + num_values[0] = NSHADES + 1; + for ( i = 0; i < NSHADES + 1; i++ ) { + values[0][i] = shedge[i]; + } + pls.colorbar( colorbar_width, colorbar_height, + 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 + pls.schr( 0.0, 1.0 ); + pls.smaj( 0.0, 1.0 ); + pls.smin( 0.0, 1.0 ); + pls.col0( 1 ); pls.box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls.col0( 2 ); @@ -193,6 +233,30 @@ cont_color, cont_width, true, xg1, yg1 ); + // Smaller text + pls.schr( 0.0, 0.75 ); + // Small ticks on the vertical axis + pls.smaj( 0.0, 0.5 ); + pls.smin( 0.0, 0.5 ); + + num_values[0] = NSHADES + 1; + for ( i = 0; i < NSHADES + 1; i++ ) { + values[0][i] = shedge[i]; + } + pls.colorbar( colorbar_width, colorbar_height, + 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 + pls.schr( 0.0, 1.0 ); + pls.smaj( 0.0, 1.0 ); + pls.smin( 0.0, 1.0 ); + pls.col0( 1 ); pls.box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls.col0( 2 ); @@ -219,6 +283,30 @@ cont_color, cont_width, false, xg2, yg2 ); + // Smaller text + pls.schr( 0.0, 0.75 ); + // Small ticks on the vertical axis + pls.smaj( 0.0, 0.5 ); + pls.smin( 0.0, 0.5 ); + + num_values[0] = NSHADES + 1; + for ( i = 0; i < NSHADES + 1; i++ ) { + values[0][i] = shedge[i]; + } + pls.colorbar( colorbar_width, colorbar_height, + 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 + pls.schr( 0.0, 1.0 ); + pls.smaj( 0.0, 1.0 ); + pls.smin( 0.0, 1.0 ); + pls.col0( 1 ); pls.box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls.col0( 2 ); @@ -246,6 +334,30 @@ 2, 3., false, xg2, yg2 ); + // Smaller text + pls.schr( 0.0, 0.75 ); + // Small ticks on the vertical axis + pls.smaj( 0.0, 0.5 ); + pls.smin( 0.0, 0.5 ); + + num_values[0] = NSHADES + 1; + for ( i = 0; i < NSHADES + 1; i++ ) { + values[0][i] = shedge[i]; + } + pls.colorbar( colorbar_width, colorbar_height, + 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 + pls.schr( 0.0, 1.0 ); + pls.smaj( 0.0, 1.0 ); + pls.smin( 0.0, 1.0 ); + pls.col0( 1 ); pls.box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls.col0( 2 ); @@ -299,6 +411,30 @@ cont_color, cont_width, false, xg2, yg2 ); + // Smaller text + pls.schr( 0.0, 0.75 ); + // Small ticks on the vertical axis + pls.smaj( 0.0, 0.5 ); + pls.smin( 0.0, 0.5 ); + + num_values[0] = NSHADES + 1; + for ( i = 0; i < NSHADES + 1; i++ ) { + values[0][i] = shedge[i]; + } + pls.colorbar( colorbar_width, colorbar_height, + 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 + pls.schr( 0.0, 1.0 ); + pls.smaj( 0.0, 1.0 ); + pls.smin( 0.0, 1.0 ); + // Now we can draw the perimeter. (If do before, shade stuff may overlap.) for ( i = 0; i < PERIMETERPTS; i++ ) { Modified: trunk/examples/java/x33.java =================================================================== --- trunk/examples/java/x33.java 2013-05-22 22:44:41 UTC (rev 12347) +++ trunk/examples/java/x33.java 2013-05-22 22:46:35 UTC (rev 12348) @@ -56,153 +56,210 @@ "✦" }; - // -// void plcolorbar_example_1( int bar_type, double ticks, int sub_ticks, int n, double[] values, String title ) -// { -// pls.adv( 0 ); -// // Setup color palette 1 -// pls.spal1( "cmap1_blue_red.pal", true ); -// -// double[] colors = new double[n]; -// int i; -// double color_step; -// color_step = 1.0 / (double) ( n - 1 ); -// for ( i = 0; i < n; i++ ) -// { -// colors[i] = 0.0 + color_step * (double) ( i ); -// } -// -// int opt; -// opt = PL_POSITION_LEFT | bar_type | PL_COLORBAR_LABEL_LEFT | -// PL_COLORBAR_CAP_HIGH; -// -// String axis_opts_1, axis_opts_2; -// if ( ( bar_type & PL_COLORBAR_SHADE_LABEL ) > 0 ) -// { -// 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"; -// } -// } -// -// pls.colorbar( opt, 0.1, 0.1, 0.5, 0.1, -// ticks, sub_ticks, -// axis_opts_1, "Test label - Left, High Cap", -// colors, values ); -// -// opt = PL_POSITION_RIGHT | bar_type | PL_COLORBAR_LABEL_RIGHT | -// PL_COLORBAR_CAP_LOW; -// -// pls.colorbar( opt, 0.1, 0.4, 0.5, 0.1, -// ticks, sub_ticks, -// axis_opts_1, "Test label - Right, Low Cap", -// colors, values ); -// -// opt = PL_POSITION_TOP | bar_type | PL_COLORBAR_LABEL_TOP | -// PL_COLORBAR_CAP_HIGH; -// -// pls.colorbar( opt, 0.1, 0.1, 0.5, 0.1, -// ticks, sub_ticks, -// axis_opts_2, "Test label - Upper, High Cap", -// colors, values ); -// -// opt = PL_POSITION_BOTTOM | bar_type | PL_COLORBAR_LABEL_BOTTOM | -// PL_COLORBAR_CAP_LOW; -// -// pls.colorbar( opt, 0.4, 0.1, 0.5, 0.1, -// ticks, sub_ticks, -// axis_opts_2, "Test label - Lower, Low Cap", -// colors, values ); -// -// pls.vpor( 0.0, 1.0, 0.0, 1.0 ); -// pls.wind( 0.0, 1.0, 0.0, 1.0 ); -// pls.ptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); -// } -// -// void plcolorbar_example_2( int bar_type, double ticks, double sub_ticks, int n, double[] values, String title ) -// { -// pls.adv( 0 ); -// // Setup color palette 1 -// pls.spal1( "cmap1_blue_yellow.pal", true ); -// -// double[] colors = new double[n]; -// int i; -// double color_step; -// color_step = 1.0 / (double) ( n - 1 ); -// for ( i = 0; i < n; i++ ) -// { -// colors[i] = 0.0 + color_step * (double) ( i ); -// } -// -// int opt; -// opt = PL_POSITION_LEFT | bar_type | PL_COLORBAR_LABEL_LEFT | -// PL_COLORBAR_CAP_LOW; -// -// String axis_opts_1, axis_opts_2; -// 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"; -// } -// else -// { -// axis_opts_1 = "tv"; -// axis_opts_2 = "t"; -// } -// } -// -// pls.colorbar( opt, 0.1, 0.1, 0.5, 0.1, -// ticks, sub_ticks, -// axis_opts_1, "Test label - Left, Low Cap", -// colors, values ); -// -// opt = PL_POSITION_RIGHT | bar_type | PL_COLORBAR_LABEL_RIGHT | -// PL_COLORBAR_CAP_HIGH; -// -// pls.colorbar( opt, 0.1, 0.4, 0.5, 0.1, -// ticks, sub_ticks, -// axis_opts_1, "Test label - Right, High Cap", -// colors, values ); -// -// opt = PL_POSITION_TOP | bar_type | PL_COLORBAR_LABEL_TOP | -// PL_COLORBAR_CAP_LOW; -// -// pls.colorbar( 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; -// -// pls.colorbar( opt, 0.4, 0.1, 0.5, 0.1, -// ticks, sub_ticks, -// axis_opts_2, "Test label - Lower, High Cap", -// colors, values ); -// -// pls.vpor( 0.0, 1.0, 0.0, 1.0 ); -// pls.wind( 0.0, 1.0, 0.0, 1.0 ); -// pls.ptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); -// } -// + // plcolorbar options + + static String[] colorbar_option_kind_labels = { + "Shade colorbars", + "Shade colorbars with custom labels", + "Image colorbars", + "Gradient colorbars" + }; + + static String[] colorbar_position_option_labels = { + "Left", + "Right", + "Top", + "Bottom" + }; + + static String[] colorbar_label_option_labels = { + "Label left", + "Label right", + "Label top", + "Label bottom" + }; + + static String[] colorbar_cap_option_labels = { + "No caps", + "Low cap", + "High cap", + "Low and high caps" + }; + + final static int COLORBAR_KINDS = 4; + final static int COLORBAR_POSITIONS = 4; + final static int COLORBAR_LABELS = 4; + final static int COLORBAR_CAPS = 4; + + + void plcolorbar_example_page( int kind_i, int label_i, int cap_i, int cont_color, double cont_width, double[] values ) + { + int i; + // Parameters for the colorbars on this page + int position_i, position, opt; + double x, y, x_length, y_length; + double[] ticks = { 0.0 }; + int[] sub_ticks = { 0 }; + double low_cap_color, high_cap_color; + boolean vertical, ifn; + int n_axes = 1; + String[] axis_opts = new String[1]; + int n_labels = 1; + int[] label_opts = { 0 }; + String[] label = new String[1]; + String title; + double[] colorbar_width = new double[1]; + double[] colorbar_height = new double[1]; + int[] n_values_array = new int[1]; + double[][] values_array = new double[1][values.length]; + + // Colorbar type options + int[] colorbar_option_kinds = { + PL_COLORBAR_SHADE, + PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, + PL_COLORBAR_IMAGE, + PL_COLORBAR_GRADIENT + }; + // Which side of the page are we positioned relative to? + int[] colorbar_position_options = { + PL_POSITION_LEFT, + PL_POSITION_RIGHT, + PL_POSITION_TOP, + PL_POSITION_BOTTOM + }; + // Colorbar label positioning options + int[] colorbar_label_options = { + PL_COLORBAR_LABEL_LEFT, + PL_COLORBAR_LABEL_RIGHT, + PL_COLORBAR_LABEL_TOP, + PL_COLORBAR_LABEL_BOTTOM + }; + // Colorbar cap options + int[] colorbar_cap_options = { + PL_COLORBAR_CAP_NONE, + PL_COLORBAR_CAP_LOW, + PL_COLORBAR_CAP_HIGH, + PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH + }; + + n_values_array[0] = values.length; + for ( i = 0; i < n_values_array[0]; i++ ) + values_array[0][i] = values[i]; + + low_cap_color = 0.0; + high_cap_color = 1.0; + + // Start a new page + pls.adv( 0 ); + + // Draw one colorbar relative to each side of the page + for ( position_i = 0; position_i < COLORBAR_POSITIONS; position_i++ ) + { + position = colorbar_position_options[position_i]; + opt = + colorbar_option_kinds[kind_i] | + colorbar_label_options[label_i] | + colorbar_cap_options[cap_i]; + + vertical = ((position & PL_POSITION_LEFT) != 0) || ((position & PL_POSITION_RIGHT) != 0); + ifn = ((position & PL_POSITION_LEFT) != 0) || ((position & PL_POSITION_BOTTOM) != 0); + + // 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; + } + + // Set appropriate labelling options. + if ( ifn ) + { + if ( cont_color == 0 || cont_width == 0. ) + { + axis_opts[0] = "uwtivn"; + } + else + { + axis_opts[0] = "uwxvn"; + } + } + else + { + if ( cont_color == 0 || cont_width == 0. ) + { + axis_opts[0] = "uwtivm"; + } + else + { + axis_opts[0] = "uwxvm"; + } + } + + label[0] = colorbar_position_option_labels[position_i] + ", " + + colorbar_label_option_labels[label_i]; + + // Smaller text + pls.schr( 0.0, 0.75 ); + // Small ticks on the vertical axis + pls.smaj( 0.0, 0.5 ); + pls.smin( 0.0, 0.5 ); + + pls.vpor( 0.20, 0.80, 0.20, 0.80 ); + pls.wind( 0.0, 1.0, 0.0, 1.0 ); + // Set interesting background colour. + pls.scol0a( 15, 0, 0, 0, 0.20 ); + pls.colorbar( colorbar_width, colorbar_height, + 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 ); + + // Reset text and tick sizes + pls.schr( 0.0, 1.0 ); + pls.smaj( 0.0, 1.0 ); + pls.smin( 0.0, 1.0 ); + } + + // Draw a page title + title = colorbar_option_kind_labels[kind_i] + " - " + + colorbar_cap_option_labels[cap_i]; + pls.vpor( 0.0, 1.0, 0.0, 1.0 ); + pls.wind( 0.0, 1.0, 0.0, 1.0 ); + pls.ptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); + } + + void plcolorbar_example( String palette, int kind_i, int cont_color, double cont_width, double[] values ) + { + int label_i, cap_i; + + // Load the color palette + pls.spal1( palette, true ); + + for ( label_i = 0; label_i < COLORBAR_LABELS; label_i++ ) + { + for ( cap_i = 0; cap_i < COLORBAR_CAPS; cap_i++ ) + { + plcolorbar_example_page( kind_i, label_i, cap_i, + cont_color, cont_width, + values ); + } + } + } + + //-------------------------------------------------------------------------- // x33 // @@ -831,23 +888,32 @@ null, null, null, null ); max_height = Math.max( max_height, legend_height[0] ); - // -// // Color bar examples -// double[] values_small = { 0.0, 1.0 }; -// double[] values_uneven = { 0.0, 2.0, 2.6, 3.4, 6.0, 7.0, 8.0, 9.0, 10.0 }; -// double[] 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, 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, -// "Shade Color Bars - Uneven Steps" ); -// plcolorbar_example_2( PL_COLORBAR_SHADE, 3.0, 3, 9, values_even, -// "Shade Color Bars - Even Steps" ); -// plcolorbar_example_1( PL_COLORBAR_GRADIENT, 0.5, 5, 2, values_small, -// "Gradient Color Bars" ); -// plcolorbar_example_2( PL_COLORBAR_GRADIENT, 0.5, 5, 2, values_small, -// "Gradient Color Bars" ); - // + // Color bar examples + double[] values_small = { -1.0e-200, 1.0e-200 }; + double[] 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 }; + double[] 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. + pls.scolbg( 70, 185, 70 ); + // Cut out the greatest and smallest bits of the color spectrum to + // leave colors for the end caps. + pls.scmap1_range( 0.01, 0.99 ); + + // We can only test image and gradient colorbars with two element arrays + for ( i = 2; i < COLORBAR_KINDS; i++ ) + { + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_small ); + } + // Test shade colorbars with larger arrays + for ( i = 0; i < 2; i++ ) + { + plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, values_even ); + } + for ( i = 0; i < 2; i++ ) + { + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_uneven ); + } + pls.end(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2013-06-02 20:07:10
|
Revision: 12353 http://sourceforge.net/p/plplot/code/12353 Author: andrewross Date: 2013-06-02 20:07:07 +0000 (Sun, 02 Jun 2013) Log Message: ----------- Update octave bindings and examples 16 and 33 to use the latest plcolorbar API. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.h.in trunk/bindings/octave/plplot_octave.i trunk/bindings/swig-support/plplotcapi.i trunk/examples/octave/x16c.m trunk/examples/octave/x33c.m Modified: trunk/bindings/octave/plplot_octave.h.in =================================================================== --- trunk/bindings/octave/plplot_octave.h.in 2013-06-02 19:56:22 UTC (rev 12352) +++ trunk/bindings/octave/plplot_octave.h.in 2013-06-02 20:07:07 UTC (rev 12353) @@ -1809,6 +1809,45 @@ c_plimagefr( aa, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, pltr2, &grid2 ); } //%name plimagefr2 //%input a(nx,ny), xg(nx+1,ny+1), yg(nx+1,ny+1) +void plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, + 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, const PLINT *label_opts, const char * const *label, + PLINT n_axes, const char * const * axis_opts, + const PLFLT *ticks, const PLINT *sub_ticks, + const PLINT *n_values, const PLFLT * const *values ) // %nowrap + +void my_plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, + 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, const PLINT *label_opts, const char * const *label, + PLINT nx, const char * const * axis_opts, + const PLFLT *ticks, const PLINT *sub_ticks, + const PLINT *n_values, const PLFLT *a ) +{ + PLINT ny, i; + ny = -1; + for ( i = 0; i < nx ; i++ ) + if ( n_values[i] < ny ) ny = n_values[i]; + f2c( a, aa, nx, ny ); + c_plcolorbar(p_colorbar_width, p_colorbar_height, + opt, position, x, y, + x_length, y_length, + bg_color, bb_color, bb_style, + low_cap_color, high_cap_color, + cont_color, cont_width, + n_labels, label_opts, label, + nx, axis_opts, + ticks, sub_ticks, + n_values, aa); +} //%name plcolorbar //%input a(nx,ny) + #ifdef __cplusplus } #endif Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2013-06-02 19:56:22 UTC (rev 12352) +++ trunk/bindings/octave/plplot_octave.i 2013-06-02 20:07:07 UTC (rev 12353) @@ -337,6 +337,30 @@ } %typemap( freearg ) const PLINT * ArrayCkMinus1Null { delete [] $1;} +// Set X and Y lengths for later consistency checking +%typemap( in ) const PLINT * ArrayN( Matrix temp ) +{ + int i; + if ( _n_dims( $input ) > 1 ) + { + error( "argument must be a scalar or vector" ); SWIG_fail; + } + if ( _dim( $input, 0 ) != Alen ) + { + error( "argument vectors must be same length" ); SWIG_fail; + } + Xlen = Alen; + temp = $input.matrix_value(); + $1 = new PLINT[Alen]; + _cvt_double_to( $1, &temp( 0, 0 ), Alen ); + Ylen = -1; + for ( i = 0; i < Xlen; i++ ) + if ( $1[i] > Ylen ) Ylen = $1[i]; +} +%typemap( freearg ) ( const PLINT * ArrayN ) +{ + delete [] $1; +} //-------------------------------------------------------------------------- // PLFLT Arrays @@ -876,6 +900,239 @@ } } +// This test function should be removed when we are confident of our +// dealings with all types of octave string arrays. +%{ + void testppchar( PLINT nlegend, const PLINT *opt_array, const char ** text ) + { + PLINT i; + printf( "nlegend =%d\n", nlegend ); + for ( i = 0; i < nlegend; i++ ) + { + printf( "opt_array[%d] =%d\n", i, opt_array[i] ); + printf( "strlen(text[%d]) =%d\n", i, (int) strlen( text[i] ) ); + printf( "text[%d] =%s\n", i, text[i] ); + } + } +%} + +// No count but check consistency with previous +%typemap( in ) const char **ArrayCk { + charMatrix temp_matrix; + Cell temp_cell; + char *tmp_cstring; + std::string str; + size_t max_length, non_blank_length; + int i, ifcell; + if ( _n_dims( $input ) > 2 ) + { + error( "argument must be a scalar or vector or matrix" ); SWIG_fail; + } + if ( !$input.is_empty() ) + { + if ( _dim( $input, 0 ) != Alen ) + { + error( "first dimension must be same length as previous vector" ); SWIG_fail; + } + $1 = new char*[Alen]; + ifcell = $input.is_cell(); + if ( ifcell ) + { + temp_cell = $input.cell_value(); + } + else + { + temp_matrix = $input.char_matrix_value(); + // Allow one extra space for null termination. + max_length = _dim( $input, 1 ) + 1; + } + + for ( i = 0; i < Alen; i++ ) + { + // Must copy string to "permanent" location because the string + // location corresponding to tmp_cstring gets + // overwritten for each iteration of loop. + if ( ifcell ) + { + if ( temp_cell.elem( i ).is_string() ) + { + str = temp_cell.elem( i ).string_value(); + // leave room for null termination. + max_length = str.size() + 1; + tmp_cstring = (char *) str.c_str(); + } + else + { + // Use null string if user attempts to pass a cell array + // with a non-string element (likely an empty element + // since that should be allowed by the PLplot interface + // if that element is going to be unused). + // leave room for null termination. + max_length = 1; + tmp_cstring = (char *) ""; + } + } + else + { + tmp_cstring = (char *) temp_matrix.row_as_string( i ).c_str(); + } + $1[i] = new char[max_length]; + strncpy( $1[i], tmp_cstring, max_length - 1 ); + $1[i][max_length - 1] = '\0'; + // All the trailing blank crapola should not be needed for + // string cell arrays. + if ( !ifcell ) + { + // remove trailing-blank padding that is used by the + // charMatrix class to insure all strings in a given + // charMatrix instance have the same length. + // This transformation also removes legitimate trailing + // blanks but there is nothing we can do about that + // for the charMatrix class. + + // Look for trailing nulls first (just in case, although that + // shouldn't happen if charMatrix implemented as documented) + // before looking for trailing blanks. + non_blank_length = max_length - 2; + while ( non_blank_length >= 0 && $1[i][non_blank_length] == '\0' ) + { + non_blank_length--; + } + while ( non_blank_length >= 0 && $1[i][non_blank_length] == ' ' ) + { + non_blank_length--; + } + $1[i][non_blank_length + 1] = '\0'; + } + } + } + else + { + $1 = NULL; + } +} +%typemap( freearg ) const char **ArrayCk { + int i; + if ( $1 != NULL ) + { + for ( i = 0; i < Alen; i++ ) + { + delete[] $1[i]; + } + delete[] $1; + } +} + +// No count but check consistency with previous +%typemap( in ) (PLINT n, const char **Array) { + charMatrix temp_matrix; + Cell temp_cell; + char *tmp_cstring; + std::string str; + size_t max_length, non_blank_length; + int i, ifcell; + if ( _n_dims( $input ) > 2 ) + { + error( "argument must be a scalar or vector or matrix" ); SWIG_fail; + } + if ( !$input.is_empty() ) + { + Alen = _dim( $input, 0 ); + $1 = Alen; + $2 = new char*[Alen]; + ifcell = $input.is_cell(); + if ( ifcell ) + { + temp_cell = $input.cell_value(); + } + else + { + temp_matrix = $input.char_matrix_value(); + // Allow one extra space for null termination. + max_length = _dim( $input, 1 ) + 1; + } + + for ( i = 0; i < Alen; i++ ) + { + // Must copy string to "permanent" location because the string + // location corresponding to tmp_cstring gets + // overwritten for each iteration of loop. + if ( ifcell ) + { + if ( temp_cell.elem( i ).is_string() ) + { + str = temp_cell.elem( i ).string_value(); + // leave room for null termination. + max_length = str.size() + 1; + tmp_cstring = (char *) str.c_str(); + } + else + { + // Use null string if user attempts to pass a cell array + // with a non-string element (likely an empty element + // since that should be allowed by the PLplot interface + // if that element is going to be unused). + // leave room for null termination. + max_length = 1; + tmp_cstring = (char *) ""; + } + } + else + { + tmp_cstring = (char *) temp_matrix.row_as_string( i ).c_str(); + } + $2[i] = new char[max_length]; + strncpy( $2[i], tmp_cstring, max_length - 1 ); + $2[i][max_length - 1] = '\0'; + // All the trailing blank crapola should not be needed for + // string cell arrays. + if ( !ifcell ) + { + // remove trailing-blank padding that is used by the + // charMatrix class to insure all strings in a given + // charMatrix instance have the same length. + // This transformation also removes legitimate trailing + // blanks but there is nothing we can do about that + // for the charMatrix class. + + // Look for trailing nulls first (just in case, although that + // shouldn't happen if charMatrix implemented as documented) + // before looking for trailing blanks. + non_blank_length = max_length - 2; + while ( non_blank_length >= 0 && $2[i][non_blank_length] == '\0' ) + { + non_blank_length--; + } + while ( non_blank_length >= 0 && $2[i][non_blank_length] == ' ' ) + { + non_blank_length--; + } + $2[i][non_blank_length + 1] = '\0'; + } + } + } + else + { + $1 = 0; + $2 = NULL; + } +} +%typemap( freearg ) (PLINT n, const char **Array) { + int i; + if ( $2 != NULL ) + { + for ( i = 0; i < Alen; i++ ) + { + delete[] $2[i]; + } + delete[] $2; + } +} + +// This test function should be removed when we are confident of our +// dealings with all types of octave string arrays. +void testppchar( PLINT n, const PLINT *Array, const char **ArrayCk ); + // The octave bindings started out as an independent project with a // historical API that does not match up that well with the PLplot API // function names and numbers and types of arguments. So there are a @@ -1521,133 +1778,53 @@ PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, const PLFLT *Matrix, const PLFLT *Matrix ); -// This test function should be removed when we are confident of our -// dealings with all types of octave string arrays. +// plcolorbar-related wrappers. +%ignore plcolorbar; +%rename( plcolorbar ) my_plcolorbar; + %{ - void testppchar( PLINT nlegend, const PLINT *opt_array, const char ** text ) + void my_plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, + 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, const PLINT *label_opts, const char **label, + PLINT n_axes, const char ** axis_opts, + const PLFLT *ticks, const PLINT *sub_ticks, + const PLINT *n_values, const PLFLT *a ) { - PLINT i; - printf( "nlegend =%d\n", nlegend ); - for ( i = 0; i < nlegend; i++ ) - { - printf( "opt_array[%d] =%d\n", i, opt_array[i] ); - printf( "strlen(text[%d]) =%d\n", i, (int) strlen( text[i] ) ); - printf( "text[%d] =%s\n", i, text[i] ); - } + PLINT nx, ny, i; + nx = n_axes; + ny = -1; + for ( i = 0; i < nx ; i++ ) + if ( n_values[i] > ny ) ny = n_values[i]; + f2c( a, aa, nx, ny ); + c_plcolorbar(p_colorbar_width, p_colorbar_height, + opt, position, x, y, + x_length, y_length, + bg_color, bb_color, bb_style, + low_cap_color, high_cap_color, + cont_color, cont_width, + n_labels, label_opts, label, + n_axes, axis_opts, + ticks, sub_ticks, + n_values, aa); } + %} -// No count but check consistency with previous -%typemap( in ) const char **ArrayCk { - charMatrix temp_matrix; - Cell temp_cell; - char *tmp_cstring; - std::string str; - size_t max_length, non_blank_length; - int i, ifcell; - if ( _n_dims( $input ) > 2 ) - { - error( "argument must be a scalar or vector or matrix" ); SWIG_fail; - } - if ( !$input.is_empty() ) - { - if ( _dim( $input, 0 ) != Alen ) - { - error( "first dimension must be same length as previous vector" ); SWIG_fail; - } - $1 = new char*[Alen]; - ifcell = $input.is_cell(); - if ( ifcell ) - { - temp_cell = $input.cell_value(); - } - else - { - temp_matrix = $input.char_matrix_value(); - // Allow one extra space for null termination. - max_length = _dim( $input, 1 ) + 1; - } +void my_plcolorbar( PLFLT *OUTPUT, PLFLT *OUTPUT, + 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, const PLINT *Array, const char **ArrayCk, + PLINT n, const char **Array, + const PLFLT *ArrayCk, const PLINT *ArrayCk, + const PLINT *ArrayN , const PLFLT *MatrixCk ); - for ( i = 0; i < Alen; i++ ) - { - // Must copy string to "permanent" location because the string - // location corresponding to tmp_cstring gets - // overwritten for each iteration of loop. - if ( ifcell ) - { - if ( temp_cell.elem( i ).is_string() ) - { - str = temp_cell.elem( i ).string_value(); - // leave room for null termination. - max_length = str.size() + 1; - tmp_cstring = (char *) str.c_str(); - } - else - { - // Use null string if user attempts to pass a cell array - // with a non-string element (likely an empty element - // since that should be allowed by the PLplot interface - // if that element is going to be unused). - // leave room for null termination. - max_length = 1; - tmp_cstring = (char *) ""; - } - } - else - { - tmp_cstring = (char *) temp_matrix.row_as_string( i ).c_str(); - } - $1[i] = new char[max_length]; - strncpy( $1[i], tmp_cstring, max_length - 1 ); - $1[i][max_length - 1] = '\0'; - // All the trailing blank crapola should not be needed for - // string cell arrays. - if ( !ifcell ) - { - // remove trailing-blank padding that is used by the - // charMatrix class to insure all strings in a given - // charMatrix instance have the same length. - // This transformation also removes legitimate trailing - // blanks but there is nothing we can do about that - // for the charMatrix class. - - // Look for trailing nulls first (just in case, although that - // shouldn't happen if charMatrix implemented as documented) - // before looking for trailing blanks. - non_blank_length = max_length - 2; - while ( non_blank_length >= 0 && $1[i][non_blank_length] == '\0' ) - { - non_blank_length--; - } - while ( non_blank_length >= 0 && $1[i][non_blank_length] == ' ' ) - { - non_blank_length--; - } - $1[i][non_blank_length + 1] = '\0'; - } - } - } - else - { - $1 = NULL; - } -} -%typemap( freearg ) const char **ArrayCk { - int i; - if ( $1 != NULL ) - { - for ( i = 0; i < Alen; i++ ) - { - delete[] $1[i]; - } - delete[] $1; - } -} - -// This test function should be removed when we are confident of our -// dealings with all types of octave string arrays. -void testppchar( PLINT n, const PLINT *Array, const char **ArrayCk ); - // Probably never deal with this one. %ignore plMinMax2dGrid; //%feature commands supporting swig-generated documentation for the bindings. Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2013-06-02 19:56:22 UTC (rev 12352) +++ trunk/bindings/swig-support/plplotcapi.i 2013-06-02 20:07:07 UTC (rev 12353) @@ -481,7 +481,7 @@ const PLINT *ArrayCkNull, const PLFLT *ArrayCkNull, const PLINT *ArrayCkNull, const char **ArrayCk ); -#if defined (SWIG_PYTHON) || defined(SWIG_JAVA) +#if defined (SWIG_PYTHON) || defined(SWIG_JAVA) || defined(SWIG_OCTAVE) void plcolorbar( PLFLT *OUTPUT, PLFLT *OUTPUT, PLINT opt, PLINT position, PLFLT x, PLFLT y, Modified: trunk/examples/octave/x16c.m =================================================================== --- trunk/examples/octave/x16c.m 2013-06-02 19:56:22 UTC (rev 12352) +++ trunk/examples/octave/x16c.m 2013-06-02 20:07:07 UTC (rev 12353) @@ -32,6 +32,9 @@ function ix16c global tr; global nx; global ny; + global PL_COLORBAR_LABEL_BOTTOM; + global PL_COLORBAR_SHADE; + global PL_COLORBAR_SHADE_LABEL; ## Fundamental settings. See notes[] for more info. ns = 20; ## Default number of shade levels @@ -43,7 +46,19 @@ sh_cmap = 1; fill_width = 2.; cont_color = 0; cont_width = 0.; + + num_axes = 1; + n_axis_opts = num_axes; + axis_opts = { "bcvtm" }; + values = zeros(num_axes,ns+1); + axis_ticks = zeros(1,1); + axis_subticks = zeros(1,1); + num_labels = 1; + label_opts = [ PL_COLORBAR_LABEL_BOTTOM ]; + labels = { "Magnitude" }; + + ## Parse and process command line arguments ## plMergeOpts(options, "x16c options", notes); @@ -110,6 +125,28 @@ cont_color, cont_width, 1); + # 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(1) = ns + 1; + values(1,:) = shedge; + + [colorbar_width, colorbar_height] = plcolorbar( + bitor(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); @@ -136,6 +173,28 @@ cont_color, cont_width, 1, 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(1) = ns + 1; + values(1,:) = shedge; + + [colorbar_width, colorbar_height] = plcolorbar( + bitor(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); @@ -162,6 +221,28 @@ cont_color, cont_width, 0, 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(1) = ns + 1; + values(1,:) = shedge; + + [colorbar_width, colorbar_height] = plcolorbar( + bitor(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); @@ -187,6 +268,28 @@ 2, 3., 0, 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(1) = ns + 1; + values(1,:) = shedge; + + [colorbar_width, colorbar_height] = plcolorbar( + bitor(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, + 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); @@ -259,6 +362,28 @@ cont_color, cont_width, 0, 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(1) = ns + 1; + values(1,:) = shedge; + + [colorbar_width, colorbar_height] = plcolorbar( + bitor(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, shade stuff may overlap.) i = 0:PERIMETERPTS-1; t = (2*pi/(PERIMETERPTS-1))*i; Modified: trunk/examples/octave/x33c.m =================================================================== --- trunk/examples/octave/x33c.m 2013-06-02 19:56:22 UTC (rev 12352) +++ trunk/examples/octave/x33c.m 2013-06-02 20:07:07 UTC (rev 12353) @@ -29,7 +29,9 @@ 1; -global position_options special_symbols +global position_options special_symbols colorbar_option_kinds colorbar_option_kind_labels colorbar_position_options colorbar_position_option_labels colorbar_label_options colorbar_label_option_labels colorbar_cap_options colorbar_cap_option_labels +global COLORBAR_KINDS COLORBAR_POSITIONS COLORBAR_LABELS COLORBAR_CAPS + position_options = [ bitor(PL_POSITION_LEFT, bitor(PL_POSITION_TOP, PL_POSITION_OUTSIDE)); bitor(PL_POSITION_TOP, PL_POSITION_OUTSIDE); @@ -58,117 +60,179 @@ "✦" ]; -function plcolorbar_example_1( bar_type, ticks, sub_ticks, values, title ) - global PL_POSITION_LEFT PL_COLORBAR_LABEL_LEFT PL_COLORBAR_CAP_HIGH PL_COLORBAR_SHADE_LABEL PL_POSITION_RIGHT PL_COLORBAR_LABEL_RIGHT PL_COLORBAR_CAP_LOW PL_POSITION_TOP PL_COLORBAR_LABEL_TOP PL_COLORBAR_CAP_HIGH PL_POSITION_BOTTOM PL_COLORBAR_LABEL_BOTTOM PL_COLORBAR_CAP_LOW - pladv( 0 ); - ## Setup color palette 1 - plspal1( "cmap1_blue_red.pal", 1 ); +# plcolorbar options - n = length(values); - color_step = 1.0 / (n - 1); - colors = (0:n-1)'*color_step; +# Colorbar type options +COLORBAR_KINDS = 4; +colorbar_option_kinds = [ + PL_COLORBAR_SHADE; + bitor(PL_COLORBAR_SHADE,PL_COLORBAR_SHADE_LABEL); + PL_COLORBAR_IMAGE; + PL_COLORBAR_GRADIENT +]; - opt = bitor(PL_POSITION_LEFT, bitor(bar_type, bitor(PL_COLORBAR_LABEL_LEFT, PL_COLORBAR_CAP_HIGH))); +colorbar_option_kind_labels = { + "Shade colorbars"; + "Shade colorbars with custom labels"; + "Image colorbars"; + "Gradient colorbars" +}; - if (bitand(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"; - endif - endif +# 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 +]; - plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Left, High Cap", - colors, values ); +colorbar_position_option_labels = { + "Left", + "Right", + "Top", + "Bottom" +}; - opt = bitor(PL_POSITION_RIGHT, bitor(bar_type, bitor(PL_COLORBAR_LABEL_RIGHT, PL_COLORBAR_CAP_LOW))); +# 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 +]; - plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Right, Low Cap", - colors, values ); +colorbar_label_option_labels = { + "Label left", + "Label right", + "Label top", + "Label bottom" +}; - opt = bitor(PL_POSITION_TOP, bitor(bar_type, bitor(PL_COLORBAR_LABEL_TOP, PL_COLORBAR_CAP_HIGH))); +# Colorbar cap options +COLORBAR_CAPS = 4; +colorbar_cap_options = [ + PL_COLORBAR_CAP_NONE; + PL_COLORBAR_CAP_LOW; + PL_COLORBAR_CAP_HIGH; + bitor(PL_COLORBAR_CAP_LOW, PL_COLORBAR_CAP_HIGH) +]; - plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Upper, High Cap", - colors, values ); +colorbar_cap_option_labels = { + "No caps"; + "Low cap"; + "High cap"; + "Low and high caps" +}; - opt = bitor(PL_POSITION_BOTTOM, bitor(bar_type, bitor(PL_COLORBAR_LABEL_BOTTOM, PL_COLORBAR_CAP_LOW))); +function plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, values ) + + global COLORBAR_POSITIONS colorbar_option_kinds colorbar_option_kind_labels colorbar_position_options colorbar_position_option_labels colorbar_label_options colorbar_label_option_labels colorbar_cap_options colorbar_cap_option_labels + global PL_POSITION_LEFT PL_POSITION_RIGHT PL_POSITION_BOTTOM PL_COLORBAR_BOUNDING_BOX PL_COLORBAR_BACKGROUND - plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Lower, Low Cap", - colors, values ); + label_opts = zeros(1,1); + ticks = zeros(1,1); + sub_ticks = zeros(1,1); + + n_values_array(1,:) = length(values); + values_array(1,:) = 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 ); -endfunction + low_cap_color = 0.0; + high_cap_color = 1.0; -function plcolorbar_example_2( bar_type, ticks, sub_ticks, values, title ) - global PL_POSITION_LEFT PL_COLORBAR_LABEL_LEFT PL_COLORBAR_CAP_HIGH PL_COLORBAR_SHADE_LABEL PL_POSITION_RIGHT PL_COLORBAR_LABEL_RIGHT PL_COLORBAR_CAP_LOW PL_POSITION_TOP PL_COLORBAR_LABEL_TOP PL_COLORBAR_CAP_HIGH PL_POSITION_BOTTOM PL_COLORBAR_LABEL_BOTTOM PL_COLORBAR_CAP_LOW - pladv( 0 ); - ## Setup color palette 1 - plspal1( "cmap1_blue_yellow.pal", 1 ); + # Start a new page + pladv( 0 ); - n = length(values); - color_step = 1.0 / (n - 1); - colors = (0:n-1)'*color_step; - opt = bitor(PL_POSITION_LEFT, bitor(bar_type, bitor(PL_COLORBAR_LABEL_LEFT, PL_COLORBAR_CAP_LOW))); + # Draw one colorbar relative to each side of the page + for position_i = 1:COLORBAR_POSITIONS + position = colorbar_position_options(position_i); + opt = bitor( + colorbar_option_kinds(kind_i), bitor( + colorbar_label_options(label_i), + colorbar_cap_options(cap_i) ) ); - 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"; - else - axis_opts_1 = "tv"; - axis_opts_2 = "t"; - endif - endif + vertical = bitand(position, PL_POSITION_LEFT) || bitand(position, PL_POSITION_RIGHT); + ifn = bitand(position, PL_POSITION_LEFT) || bitand(position, PL_POSITION_BOTTOM); - plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Left, Low Cap", - colors, values ); + # 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; + endif + + # Set appropriate labelling options. + if ( ifn ) + if ( cont_color == 0 || cont_width == 0. ) + axis_opts(1,:) = "uwtivn"; + else + axis_opts(1,:) = "uwxvn"; + endif + else + if ( cont_color == 0 || cont_width == 0. ) + axis_opts(1,:) = "uwtivm"; + else + axis_opts(1,:) = "uwxvm"; + endif + endif - opt = bitor(PL_POSITION_RIGHT, bitor(bar_type, bitor(PL_COLORBAR_LABEL_RIGHT, PL_COLORBAR_CAP_HIGH))); + label = cstrcat(char(colorbar_position_option_labels(position_i)), ", ", char(colorbar_label_option_labels(label_i)) ); - plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Right, High Cap", - colors, values ); + # Smaller text + plschr( 0.0, 0.75 ); + # Small ticks on the vertical axis + plsmaj( 0.0, 0.5 ); + plsmin( 0.0, 0.5 ); - opt = bitor(PL_POSITION_TOP, bitor(bar_type, bitor(PL_COLORBAR_LABEL_TOP, PL_COLORBAR_CAP_LOW))); + 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( \ + bitor(opt, bitor(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 ); - plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Upper, Low Cap", - colors, values ); + # Reset text and tick sizes + plschr( 0.0, 1.0 ); + plsmaj( 0.0, 1.0 ); + plsmin( 0.0, 1.0 ); + endfor - opt = bitor(PL_POSITION_BOTTOM, bitor(bar_type, bitor(PL_COLORBAR_LABEL_BOTTOM, PL_COLORBAR_CAP_HIGH))); + # Draw a page title + title = cstrcat(char(colorbar_option_kind_labels(kind_i)), " - ", char(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 ); +endfunction - plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Lower, High Cap", - colors, values ); +function plcolorbar_example( palette, kind_i, cont_color, cont_width, 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 ); + global COLORBAR_LABELS COLORBAR_CAPS + + # Load the color palette + plspal1( palette, 1 ); + + for label_i = 1:COLORBAR_LABELS + for cap_i = 1:COLORBAR_CAPS + plcolorbar_example_page( kind_i, label_i, cap_i, + cont_color, cont_width, values ); + endfor + endfor endfunction + + function ix33c() ## Parse and process command line arguments @@ -180,6 +244,7 @@ global PL_POSITION_LEFT PL_POSITION_RIGHT PL_POSITION_TOP PL_POSITION_BOTTOM PL_POSITION_INSIDE PL_POSITION_OUTSIDE PL_POSITION_SUBPAGE global PL_COLORBAR_IMAGE PL_COLORBAR_SHADE PL_COLORBAR_GRADIENT PL_COLORBAR_SHADE_LABEL global position_options special_symbols + global COLORBAR_KINDS plinit(); ## First page illustrating the 16 standard positions. @@ -877,18 +942,28 @@ [], [], [], [] ); max_height = max(max_height, legend_height); -if(0== 1) - ## 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( bitor(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" ); -endif + # 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 = 3:COLORBAR_KINDS + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_small ); + endfor + # Test shade colorbars with larger arrays + for i = 1:2 + plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, values_even ); + endfor + for i = 1:2 + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_uneven ); + endfor plend1(); endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2013-06-06 21:44:36
|
Revision: 12372 http://sourceforge.net/p/plplot/code/12372 Author: andrewross Date: 2013-06-06 21:44:33 +0000 (Thu, 06 Jun 2013) Log Message: ----------- Style recent changes. Modified Paths: -------------- trunk/bindings/c++/plstream.cc trunk/bindings/java/PLStream.java trunk/bindings/java/plplotjavac.i trunk/bindings/octave/plplot_octave.h.in trunk/bindings/octave/plplot_octave.i trunk/bindings/python/plplot_widgetmodule.c trunk/bindings/python/plplotcmodule.i trunk/bindings/swig-support/plplotcapi.i trunk/examples/c++/x15.cc trunk/examples/c++/x16.cc trunk/examples/c++/x33.cc trunk/examples/java/x16.java trunk/examples/java/x33.java Modified: trunk/bindings/c++/plstream.cc =================================================================== --- trunk/bindings/c++/plstream.cc 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/bindings/c++/plstream.cc 2013-06-06 21:44:33 UTC (rev 12372) @@ -1398,7 +1398,7 @@ { set_stream(); - plgcmap1_range( &min_color, &max_color); + plgcmap1_range( &min_color, &max_color ); } // Set color map 0 colors by 8 bit RGB values Modified: trunk/bindings/java/PLStream.java =================================================================== --- trunk/bindings/java/PLStream.java 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/bindings/java/PLStream.java 2013-06-06 21:44:33 UTC (rev 12372) @@ -555,28 +555,28 @@ } - public void colorbar( double[] p_colorbar_width, - double[] p_colorbar_height, - int opt, int position, double x, double y, - double x_length, double y_length, - int bg_color, int bb_color, int bb_style, - double low_cap_color, double high_cap_color, - int cont_color, double cont_width, - int[] label_opts, String[] labels, - String[] axis_opts, - double[] ticks, int[] sub_ticks, - int[] n_values, double[][] values ) - { - if ( set_stream() == -1 ) return; - plplotjavac.plcolorbar( p_colorbar_width, p_colorbar_height, - opt, position, x, y, x_length, y_length, - bg_color, bb_color, bb_style, - low_cap_color, high_cap_color, - cont_color, cont_width, - label_opts, labels, axis_opts, - ticks, sub_ticks, - n_values, values ); - } + public void colorbar( double[] p_colorbar_width, + double[] p_colorbar_height, + int opt, int position, double x, double y, + double x_length, double y_length, + int bg_color, int bb_color, int bb_style, + double low_cap_color, double high_cap_color, + int cont_color, double cont_width, + int[] label_opts, String[] labels, + String[] axis_opts, + double[] ticks, int[] sub_ticks, + int[] n_values, double[][] values ) + { + if ( set_stream() == -1 ) return; + plplotjavac.plcolorbar( p_colorbar_width, p_colorbar_height, + opt, position, x, y, x_length, y_length, + bg_color, bb_color, bb_style, + low_cap_color, high_cap_color, + cont_color, cont_width, + label_opts, labels, axis_opts, + ticks, sub_ticks, + n_values, values ); + } public void lightsource( double x, double y, double z ) Modified: trunk/bindings/java/plplotjavac.i =================================================================== --- trunk/bindings/java/plplotjavac.i 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/bindings/java/plplotjavac.i 2013-06-06 21:44:33 UTC (rev 12372) @@ -582,17 +582,18 @@ // Set X and Y length for later consistency checking %typemap( in ) const PLINT * ArrayN { - int i; + int i; jint *jydata = ( *jenv )->GetIntArrayElements( jenv, $input, 0 ); if ( ( *jenv )->GetArrayLength( jenv, $input ) != Alen ) { - printf( "Vectors must be same length.\n" ); - return; + printf( "Vectors must be same length.\n" ); + return; } Xlen = ( *jenv )->GetArrayLength( jenv, $input ); Ylen = -1; - for ( i = 0; i < Xlen ; i++ ) - if (jydata[i] > Ylen) Ylen = jydata[i]; + for ( i = 0; i < Xlen; i++ ) + if ( jydata[i] > Ylen ) + Ylen = jydata[i]; setup_array_1d_i( &$1, jydata, Alen ); ( *jenv )->ReleaseIntArrayElements( jenv, $input, jydata, 0 ); } @@ -1971,8 +1972,8 @@ { int size = ( *jenv )->GetArrayLength( jenv, $input ); Alen = size; - $1 = size; - $2 = (char **) malloc( Alen * sizeof ( char * ) ); + $1 = size; + $2 = (char **) malloc( Alen * sizeof ( char * ) ); // make a copy of each string for ( i = 0; i < Alen; i++ ) { Modified: trunk/bindings/octave/plplot_octave.h.in =================================================================== --- trunk/bindings/octave/plplot_octave.h.in 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/bindings/octave/plplot_octave.h.in 2013-06-06 21:44:33 UTC (rev 12372) @@ -1810,42 +1810,43 @@ } //%name plimagefr2 //%input a(nx,ny), xg(nx+1,ny+1), yg(nx+1,ny+1) void plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, - 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, const PLINT *label_opts, const char * const *label, - PLINT n_axes, const char * const * axis_opts, - const PLFLT *ticks, const PLINT *sub_ticks, - const PLINT *n_values, const PLFLT * const *values ) // %nowrap + 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, const PLINT *label_opts, const char * const *label, + PLINT n_axes, const char * const * axis_opts, + const PLFLT *ticks, const PLINT *sub_ticks, + const PLINT *n_values, const PLFLT * const *values ) // %nowrap void my_plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, - 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, const PLINT *label_opts, const char * const *label, - PLINT nx, const char * const * axis_opts, - const PLFLT *ticks, const PLINT *sub_ticks, - const PLINT *n_values, const PLFLT *a ) + 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, const PLINT *label_opts, const char * const *label, + PLINT nx, const char * const * axis_opts, + const PLFLT *ticks, const PLINT *sub_ticks, + const PLINT *n_values, const PLFLT *a ) { PLINT ny, i; ny = -1; - for ( i = 0; i < nx ; i++ ) - if ( n_values[i] < ny ) ny = n_values[i]; + for ( i = 0; i < nx; i++ ) + if ( n_values[i] < ny ) + ny = n_values[i]; f2c( a, aa, nx, ny ); - c_plcolorbar(p_colorbar_width, p_colorbar_height, - opt, position, x, y, - x_length, y_length, - bg_color, bb_color, bb_style, - low_cap_color, high_cap_color, - cont_color, cont_width, - n_labels, label_opts, label, - nx, axis_opts, - ticks, sub_ticks, - n_values, aa); + c_plcolorbar( p_colorbar_width, p_colorbar_height, + opt, position, x, y, + x_length, y_length, + bg_color, bb_color, bb_style, + low_cap_color, high_cap_color, + cont_color, cont_width, + n_labels, label_opts, label, + nx, axis_opts, + ticks, sub_ticks, + n_values, aa ); } //%name plcolorbar //%input a(nx,ny) #ifdef __cplusplus Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/bindings/octave/plplot_octave.i 2013-06-06 21:44:33 UTC (rev 12372) @@ -355,7 +355,8 @@ _cvt_double_to( $1, &temp( 0, 0 ), Alen ); Ylen = -1; for ( i = 0; i < Xlen; i++ ) - if ( $1[i] > Ylen ) Ylen = $1[i]; + if ( $1[i] > Ylen ) + Ylen = $1[i]; } %typemap( freearg ) ( const PLINT * ArrayN ) { @@ -1024,7 +1025,8 @@ } // No count but check consistency with previous -%typemap( in ) (PLINT n, const char **Array) { +%typemap( in ) ( PLINT n, const char **Array ) +{ charMatrix temp_matrix; Cell temp_cell; char *tmp_cstring; @@ -1038,7 +1040,7 @@ if ( !$input.is_empty() ) { Alen = _dim( $input, 0 ); - $1 = Alen; + $1 = Alen; $2 = new char*[Alen]; ifcell = $input.is_cell(); if ( ifcell ) @@ -1117,7 +1119,8 @@ $2 = NULL; } } -%typemap( freearg ) (PLINT n, const char **Array) { +%typemap( freearg ) ( PLINT n, const char **Array ) +{ int i; if ( $2 != NULL ) { @@ -1784,46 +1787,47 @@ %{ void my_plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, - 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, const PLINT *label_opts, const char **label, - PLINT n_axes, const char ** axis_opts, - const PLFLT *ticks, const PLINT *sub_ticks, - const PLINT *n_values, const PLFLT *a ) + 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, const PLINT *label_opts, const char **label, + PLINT n_axes, const char ** axis_opts, + const PLFLT *ticks, const PLINT *sub_ticks, + const PLINT *n_values, const PLFLT *a ) { PLINT nx, ny, i; - nx = n_axes; - ny = -1; - for ( i = 0; i < nx ; i++ ) - if ( n_values[i] > ny ) ny = n_values[i]; - f2c( a, aa, nx, ny ); - c_plcolorbar(p_colorbar_width, p_colorbar_height, - opt, position, x, y, - x_length, y_length, - bg_color, bb_color, bb_style, - low_cap_color, high_cap_color, - cont_color, cont_width, - n_labels, label_opts, label, - n_axes, axis_opts, - ticks, sub_ticks, - n_values, aa); + nx = n_axes; + ny = -1; + for ( i = 0; i < nx; i++ ) + if ( n_values[i] > ny ) + ny = n_values[i]; + f2c( a, aa, nx, ny ); + c_plcolorbar( p_colorbar_width, p_colorbar_height, + opt, position, x, y, + x_length, y_length, + bg_color, bb_color, bb_style, + low_cap_color, high_cap_color, + cont_color, cont_width, + n_labels, label_opts, label, + n_axes, axis_opts, + ticks, sub_ticks, + n_values, aa ); } %} void my_plcolorbar( PLFLT *OUTPUT, PLFLT *OUTPUT, - 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, const PLINT *Array, const char **ArrayCk, - PLINT n, const char **Array, - const PLFLT *ArrayCk, const PLINT *ArrayCk, - const PLINT *ArrayN , const PLFLT *MatrixCk ); + 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, const PLINT *Array, const char **ArrayCk, + PLINT n, const char **Array, + const PLFLT *ArrayCk, const PLINT *ArrayCk, + const PLINT *ArrayN, const PLFLT *MatrixCk ); // Probably never deal with this one. %ignore plMinMax2dGrid; Modified: trunk/bindings/python/plplot_widgetmodule.c =================================================================== --- trunk/bindings/python/plplot_widgetmodule.c 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/bindings/python/plplot_widgetmodule.c 2013-06-06 21:44:33 UTC (rev 12372) @@ -1,6 +1,6 @@ // C code to create dynamically loaded library to implement plplot_widget module -#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include <Python.h> #include <arrayobject.h> #include "plplot.h" Modified: trunk/bindings/python/plplotcmodule.i =================================================================== --- trunk/bindings/python/plplotcmodule.i 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/bindings/python/plplotcmodule.i 2013-06-06 21:44:33 UTC (rev 12372) @@ -45,7 +45,7 @@ %include typemaps.i %{ -#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include <arrayobject.h> #include "plplot.h" #include "plplotP.h" @@ -143,8 +143,8 @@ tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 ); if ( tmp == NULL ) return NULL; - $1 = Alen = PyArray_DIMS(tmp)[0]; - $2 = (PLINT *) PyArray_DATA(tmp); + $1 = Alen = PyArray_DIMS( tmp )[0]; + $2 = (PLINT *) PyArray_DATA( tmp ); } %typemap( freearg ) ( PLINT n, const PLINT * Array ) { @@ -157,13 +157,13 @@ tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Alen ) + if ( PyArray_DIMS( tmp )[0] != Alen ) { PyErr_SetString( PyExc_ValueError, "Vectors must be same length." ); return NULL; } - $2 = PyArray_DIMS(tmp)[0]; - $1 = (PLINT *) PyArray_DATA(tmp); + $2 = PyArray_DIMS( tmp )[0]; + $1 = (PLINT *) PyArray_DATA( tmp ); } %typemap( freearg ) ( const PLINT * ArrayCk, PLINT n ) { @@ -176,12 +176,12 @@ tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Alen ) + if ( PyArray_DIMS( tmp )[0] != Alen ) { PyErr_SetString( PyExc_ValueError, "Vectors must be same length." ); return NULL; } - $1 = (PLINT *) PyArray_DATA(tmp); + $1 = (PLINT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLINT * ArrayCk { Py_DECREF( tmp$argnum );} @@ -191,12 +191,12 @@ tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Alen ) + if ( PyArray_DIMS( tmp )[0] != Alen ) { PyErr_SetString( PyExc_ValueError, "Vectors must be same length." ); return NULL; } - $1 = (PLINT *) PyArray_DATA(tmp); + $1 = (PLINT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLINT * ArrayCkNull { Py_DECREF( tmp$argnum );} @@ -206,12 +206,12 @@ tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] < Alen - 1 ) + if ( PyArray_DIMS( tmp )[0] < Alen - 1 ) { PyErr_SetString( PyExc_ValueError, "Vector must be at least length of others minus 1." ); return NULL; } - $1 = (PLINT *) PyArray_DATA(tmp); + $1 = (PLINT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLINT * ArrayCkMinus1 { Py_DECREF( tmp$argnum );} @@ -220,12 +220,12 @@ tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] < Alen - 1 ) + if ( PyArray_DIMS( tmp )[0] < Alen - 1 ) { PyErr_SetString( PyExc_ValueError, "Vector must be at least length of others minus 1." ); return NULL; } - $1 = (PLINT *) PyArray_DATA(tmp); + $1 = (PLINT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLINT * ArrayCkMinus1Null { Py_DECREF( tmp$argnum );} @@ -235,8 +235,8 @@ tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 ); if ( tmp == NULL ) return NULL; - Alen = PyArray_DIMS(tmp)[0]; - $1 = (PLINT *) PyArray_DATA(tmp); + Alen = PyArray_DIMS( tmp )[0]; + $1 = (PLINT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLINT * Array { Py_DECREF( tmp$argnum );} @@ -247,16 +247,17 @@ tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Alen ) + 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); + 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]; + if ( $1[i] > Ylen ) + Ylen = $1[i]; } %typemap( freearg ) const PLINT * ArrayN { Py_DECREF( tmp$argnum );} @@ -297,8 +298,8 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - $1 = Alen = PyArray_DIMS(tmp)[0]; - $2 = (PLFLT *) PyArray_DATA(tmp); + $1 = Alen = PyArray_DIMS( tmp )[0]; + $2 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) ( PLINT n, const PLFLT * Array ) { @@ -311,13 +312,13 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Alen ) + if ( PyArray_DIMS( tmp )[0] != Alen ) { PyErr_SetString( PyExc_ValueError, "Vectors must be same length." ); return NULL; } - $1 = (PLFLT *) PyArray_DATA(tmp); - $2 = PyArray_DIMS(tmp)[0]; + $1 = (PLFLT *) PyArray_DATA( tmp ); + $2 = PyArray_DIMS( tmp )[0]; } %typemap( freearg ) ( const PLFLT * ArrayCk, PLINT n ) { @@ -330,12 +331,12 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Alen ) + if ( PyArray_DIMS( tmp )[0] != Alen ) { PyErr_SetString( PyExc_ValueError, "Vectors must be same length." ); return NULL; } - $1 = (PLFLT *) PyArray_DATA(tmp); + $1 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLFLT * ArrayCk { Py_DECREF( tmp$argnum );} @@ -345,12 +346,12 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Alen ) + if ( PyArray_DIMS( tmp )[0] != Alen ) { PyErr_SetString( PyExc_ValueError, "Vectors must be same length." ); return NULL; } - $1 = (PLFLT *) PyArray_DATA(tmp); + $1 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLFLT * ArrayCkNull { Py_DECREF( tmp$argnum );} @@ -360,12 +361,12 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Xlen ) + if ( PyArray_DIMS( tmp )[0] != Xlen ) { PyErr_SetString( PyExc_ValueError, "Vectors must be same length." ); return NULL; } - $1 = (PLFLT *) PyArray_DATA(tmp); + $1 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLFLT * ArrayCkX { Py_DECREF( tmp$argnum );} @@ -375,12 +376,12 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Ylen ) + if ( PyArray_DIMS( tmp )[0] != Ylen ) { PyErr_SetString( PyExc_ValueError, "Vectors must be same length." ); return NULL; } - $1 = (PLFLT *) PyArray_DATA(tmp); + $1 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLFLT * ArrayCkY { Py_DECREF( tmp$argnum );} @@ -390,9 +391,9 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - Xlen = PyArray_DIMS(tmp)[0]; + Xlen = PyArray_DIMS( tmp )[0]; $2 = Xlen; - $1 = (PLFLT *) PyArray_DATA(tmp); + $1 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) ( const PLFLT * ArrayX, PLINT nx ) { @@ -405,8 +406,8 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - Xlen = PyArray_DIMS(tmp)[0]; - $1 = (PLFLT *) PyArray_DATA(tmp); + Xlen = PyArray_DIMS( tmp )[0]; + $1 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLFLT * ArrayX { Py_DECREF( tmp$argnum );} @@ -416,9 +417,9 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - Ylen = PyArray_DIMS(tmp)[0]; + Ylen = PyArray_DIMS( tmp )[0]; $2 = Ylen; - $1 = (PLFLT *) PyArray_DATA(tmp); + $1 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) ( const PLFLT * ArrayY, PLINT ny ) { @@ -431,8 +432,8 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - Ylen = PyArray_DIMS(tmp)[0]; - $1 = (PLFLT *) PyArray_DATA(tmp); + Ylen = PyArray_DIMS( tmp )[0]; + $1 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLFLT * ArrayY { Py_DECREF( tmp$argnum );} @@ -443,8 +444,8 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - $2 = PyArray_DIMS(tmp)[0]; - $1 = (PLFLT *) PyArray_DATA(tmp); + $2 = PyArray_DIMS( tmp )[0]; + $1 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) ( const PLFLT * Array, PLINT n ) { @@ -457,8 +458,8 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - Alen = PyArray_DIMS(tmp)[0]; - $1 = (PLFLT *) PyArray_DATA(tmp); + Alen = PyArray_DIMS( tmp )[0]; + $1 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) const PLFLT * Array { Py_DECREF( tmp$argnum );} @@ -469,17 +470,17 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 ); if ( tmp == NULL ) return NULL; - if ( Xlen != PyArray_DIMS(tmp)[0] || Ylen != PyArray_DIMS(tmp)[1] ) + if ( Xlen != PyArray_DIMS( tmp )[0] || Ylen != PyArray_DIMS( tmp )[1] ) { PyErr_SetString( PyExc_ValueError, "Vectors must match matrix." ); return NULL; } - $2 = PyArray_DIMS(tmp)[0]; - $3 = PyArray_DIMS(tmp)[1]; + $2 = PyArray_DIMS( tmp )[0]; + $3 = PyArray_DIMS( tmp )[1]; size = sizeof ( PLFLT ) * $3; $1 = (PLFLT **) malloc( sizeof ( PLFLT* ) * $2 ); for ( i = 0; i < $2; i++ ) - $1[i] = (PLFLT *) ( PyArray_DATA(tmp) + i * size ); + $1[i] = (PLFLT *) ( PyArray_DATA( tmp ) + i * size ); } %typemap( freearg ) ( const PLFLT * *MatrixCk, PLINT nx, PLINT ny ) { @@ -494,12 +495,12 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 ); if ( tmp == NULL ) return NULL; - Xlen = $2 = PyArray_DIMS(tmp)[0]; - Ylen = $3 = PyArray_DIMS(tmp)[1]; + Xlen = $2 = PyArray_DIMS( tmp )[0]; + Ylen = $3 = PyArray_DIMS( tmp )[1]; size = sizeof ( PLFLT ) * $3; $1 = (PLFLT **) malloc( sizeof ( PLFLT* ) * $2 ); for ( i = 0; i < $2; i++ ) - $1[i] = (PLFLT *) ( PyArray_DATA(tmp) + i * size ); + $1[i] = (PLFLT *) ( PyArray_DATA( tmp ) + i * size ); } %typemap( freearg ) ( const PLFLT * *Matrix, PLINT nx, PLINT ny ) { @@ -514,12 +515,12 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 ); if ( tmp == NULL ) return NULL; - Xlen = PyArray_DIMS(tmp)[0]; - Ylen = PyArray_DIMS(tmp)[1]; + Xlen = PyArray_DIMS( tmp )[0]; + Ylen = PyArray_DIMS( tmp )[1]; size = sizeof ( PLFLT ) * Ylen; $1 = (PLFLT **) malloc( sizeof ( PLFLT* ) * Xlen ); for ( i = 0; i < Xlen; i++ ) - $1[i] = (PLFLT *) ( PyArray_DATA(tmp) + i * size ); + $1[i] = (PLFLT *) ( PyArray_DATA( tmp ) + i * size ); } %typemap( freearg ) const PLFLT * *Matrix { Py_DECREF( tmp$argnum ); @@ -532,9 +533,9 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 ); if ( tmp == NULL ) return NULL; - Xlen = $2 = PyArray_DIMS(tmp)[0]; - Ylen = $3 = PyArray_DIMS(tmp)[1]; - $1 = (PLFLT *) PyArray_DATA(tmp); + Xlen = $2 = PyArray_DIMS( tmp )[0]; + Ylen = $3 = PyArray_DIMS( tmp )[1]; + $1 = (PLFLT *) PyArray_DATA( tmp ); } %typemap( freearg ) ( const PLFLT * Matrix, PLINT nx, PLINT ny ) { @@ -548,7 +549,7 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Xlen || PyArray_DIMS(tmp)[1] != Ylen ) + if ( PyArray_DIMS( tmp )[0] != Xlen || PyArray_DIMS( tmp )[1] != Ylen ) { PyErr_SetString( PyExc_ValueError, "Vectors must match matrix." ); return NULL; @@ -556,7 +557,7 @@ size = sizeof ( PLFLT ) * Ylen; $1 = (PLFLT **) malloc( sizeof ( PLFLT* ) * Xlen ); for ( i = 0; i < Xlen; i++ ) - $1[i] = (PLFLT *) ( PyArray_DATA(tmp) + i * size ); + $1[i] = (PLFLT *) ( PyArray_DATA( tmp ) + i * size ); } %typemap( freearg ) const PLFLT * *MatrixCk { Py_DECREF( tmp$argnum ); @@ -571,7 +572,7 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Xlen || PyArray_DIMS(tmp)[1] != Ylen ) + if ( PyArray_DIMS( tmp )[0] != Xlen || PyArray_DIMS( tmp )[1] != Ylen ) { PyErr_SetString( PyExc_ValueError, "Vectors must match matrix." ); return NULL; @@ -579,7 +580,7 @@ size = sizeof ( PLFLT ) * Ylen; $1 = (PLFLT **) malloc( sizeof ( PLFLT* ) * Xlen ); for ( i = 0; i < Xlen; i++ ) - $1[i] = (PLFLT *) ( PyArray_DATA(tmp) + i * size ); + $1[i] = (PLFLT *) ( PyArray_DATA( tmp ) + i * size ); } %typemap( freearg ) PLFLT * *OutMatrixCk { Py_DECREF( tmp$argnum ); @@ -596,9 +597,9 @@ tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 ); if ( tmp == NULL ) return NULL; - Ylen = PyArray_DIMS(tmp)[0]; + Ylen = PyArray_DIMS( tmp )[0]; $2 = Ylen; - $1 = (PLFLT *) PyArray_DATA(tmp); + $1 = (PLFLT *) PyArray_DATA( tmp ); // Make created 2D array have dimensions from prior ArrayX in the argument // list and this ArrayY. dims[0] = Xlen; @@ -631,7 +632,7 @@ tmp = (PyArrayObject *) PyArray_ContiguousFromObject( $input, NPY_STRING, 1, 1 ); if ( tmp == NULL ) return NULL; - if ( PyArray_DIMS(tmp)[0] != Alen ) + if ( PyArray_DIMS( tmp )[0] != Alen ) { PyErr_SetString( PyExc_ValueError, "Vectors must be same length." ); return NULL; @@ -639,7 +640,7 @@ $1 = (char **) malloc( sizeof ( char* ) * Alen ); for ( i = 0; i < Alen; i++ ) { - $1[i] = PyArray_DATA(tmp) + i * PyArray_STRIDES(tmp)[0]; + $1[i] = PyArray_DATA( tmp ) + i * PyArray_STRIDES( tmp )[0]; if ( $1[i] == NULL ) { free( $1 ); @@ -650,18 +651,18 @@ %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 ) +%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]; + Alen = PyArray_DIMS( tmp )[0]; $1 = Alen; - $2 = (char **) malloc( sizeof ( char* ) * Alen ); + $2 = (char **) malloc( sizeof ( char* ) * Alen ); for ( i = 0; i < Alen; i++ ) { - $2[i] = PyArray_DATA(tmp) + i * PyArray_STRIDES(tmp)[0]; + $2[i] = PyArray_DATA( tmp ) + i * PyArray_STRIDES( tmp )[0]; if ( $2[i] == NULL ) { free( $2 ); @@ -669,7 +670,10 @@ } } } -%typemap( freearg ) (PLINT n, const char **Array) { Py_DECREF( tmp$argnum ); free( $2 );} +%typemap( freearg ) ( PLINT n, const char **Array ) +{ + Py_DECREF( tmp$argnum ); free( $2 ); +} //************************** // String returning functions @@ -732,8 +736,8 @@ PyErr_SetString( PyExc_ValueError, "Expected a sequence to two 1D arrays." ); return NULL; } - tmpGrid1.nx = PyArray_DIMS(pltr_xg)[0]; - tmpGrid1.ny = PyArray_DIMS(pltr_yg)[0]; + tmpGrid1.nx = PyArray_DIMS( pltr_xg )[0]; + tmpGrid1.ny = PyArray_DIMS( pltr_yg )[0]; if ( isimg == 0 ) { if ( Xlen != tmpGrid1.nx || Ylen != tmpGrid1.ny ) @@ -750,8 +754,8 @@ return NULL; } } - tmpGrid1.xg = (PLFLT *) PyArray_DATA(pltr_xg); - tmpGrid1.yg = (PLFLT *) PyArray_DATA(pltr_yg); + tmpGrid1.xg = (PLFLT *) PyArray_DATA( pltr_xg ); + tmpGrid1.yg = (PLFLT *) PyArray_DATA( pltr_yg ); return &tmpGrid1; } @@ -780,14 +784,14 @@ PyErr_SetString( PyExc_ValueError, "Expected a sequence of two 2D arrays." ); return NULL; } - if ( PyArray_DIMS(pltr_xg)[0] != PyArray_DIMS(pltr_yg)[0] || - PyArray_DIMS(pltr_xg)[1] != PyArray_DIMS(pltr_yg)[1] ) + if ( PyArray_DIMS( pltr_xg )[0] != PyArray_DIMS( pltr_yg )[0] || + PyArray_DIMS( pltr_xg )[1] != PyArray_DIMS( pltr_yg )[1] ) { PyErr_SetString( PyExc_ValueError, "Arrays must be same size." ); return NULL; } - tmpGrid2.nx = PyArray_DIMS(pltr_xg)[0]; - tmpGrid2.ny = PyArray_DIMS(pltr_xg)[1]; + tmpGrid2.nx = PyArray_DIMS( pltr_xg )[0]; + tmpGrid2.ny = PyArray_DIMS( pltr_xg )[1]; if ( isimg == 0 ) { if ( Xlen != tmpGrid2.nx || Ylen != tmpGrid2.ny ) @@ -807,10 +811,10 @@ size = sizeof ( PLFLT ) * tmpGrid2.ny; tmpGrid2.xg = (PLFLT **) malloc( sizeof ( PLFLT* ) * tmpGrid2.nx ); for ( i = 0; i < tmpGrid2.nx; i++ ) - tmpGrid2.xg[i] = (PLFLT *) ( PyArray_DATA(pltr_xg) + i * size ); + tmpGrid2.xg[i] = (PLFLT *) ( PyArray_DATA( pltr_xg ) + i * size ); tmpGrid2.yg = (PLFLT **) malloc( sizeof ( PLFLT* ) * tmpGrid2.nx ); for ( i = 0; i < tmpGrid2.nx; i++ ) - tmpGrid2.yg[i] = (PLFLT *) ( PyArray_DATA(pltr_yg) + i * size ); + tmpGrid2.yg[i] = (PLFLT *) ( PyArray_DATA( pltr_yg ) + i * size ); return &tmpGrid2; } @@ -960,7 +964,7 @@ else { tmp = (PyArrayObject *) myArray_ContiguousFromObject( result, NPY_PLFLT, 1, 1 ); - if ( tmp == 0 || PyArray_DIMS(tmp)[0] != 2 ) + if ( tmp == 0 || PyArray_DIMS( tmp )[0] != 2 ) { fprintf( stderr, "pltr callback must return a 2 element array or sequence\n" ); PyErr_SetString( PyExc_RuntimeError, "pltr callback must return a 2-sequence." ); @@ -968,7 +972,7 @@ } else { - PLFLT* t = (PLFLT *) PyArray_DATA(tmp); + PLFLT* t = (PLFLT *) PyArray_DATA( tmp ); *tx = t[0]; *ty = t[1]; Py_XDECREF( tmp ); @@ -1086,8 +1090,8 @@ // grab the Global Interpreter Lock to be sure threads don't mess us up MY_BLOCK_THREADS // build the argument list - px = PyArray_SimpleNewFromData( 1, &n, NPY_PLFLT, (void *) xt ); - py = PyArray_SimpleNewFromData( 1, &n, NPY_PLFLT, (void *) yt ); + px = PyArray_SimpleNewFromData( 1, &n, NPY_PLFLT, (void *) xt ); + py = PyArray_SimpleNewFromData( 1, &n, NPY_PLFLT, (void *) yt ); arglist = Py_BuildValue( "(ddOOO)", x, y, px, py, pdata ); // call the python function result = PyEval_CallObject( python_ct, arglist ); Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/bindings/swig-support/plplotcapi.i 2013-06-06 21:44:33 UTC (rev 12372) @@ -107,14 +107,14 @@ // Flags for pllegend. -#define PL_LEGEND_NONE 1 -#define PL_LEGEND_COLOR_BOX 2 -#define PL_LEGEND_LINE 4 -#define PL_LEGEND_SYMBOL 8 -#define PL_LEGEND_TEXT_LEFT 16 -#define PL_LEGEND_BACKGROUND 32 -#define PL_LEGEND_BOUNDING_BOX 64 -#define PL_LEGEND_ROW_MAJOR 128 +#define PL_LEGEND_NONE 1 +#define PL_LEGEND_COLOR_BOX 2 +#define PL_LEGEND_LINE 4 +#define PL_LEGEND_SYMBOL 8 +#define PL_LEGEND_TEXT_LEFT 16 +#define PL_LEGEND_BACKGROUND 32 +#define PL_LEGEND_BOUNDING_BOX 64 +#define PL_LEGEND_ROW_MAJOR 128 // Flags for plcolorbar #define PL_COLORBAR_LABEL_LEFT 0x1 @@ -481,7 +481,7 @@ const PLINT *ArrayCkNull, const PLFLT *ArrayCkNull, const PLINT *ArrayCkNull, const char **ArrayCk ); -#if defined (SWIG_PYTHON) || defined(SWIG_JAVA) || defined(SWIG_OCTAVE) +#if defined ( SWIG_PYTHON ) || defined ( SWIG_JAVA ) || defined ( SWIG_OCTAVE ) void plcolorbar( PLFLT *OUTPUT, PLFLT *OUTPUT, PLINT opt, PLINT position, PLFLT x, PLFLT y, @@ -492,7 +492,7 @@ 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 ); + const PLINT *ArrayN, const PLFLT **MatrixCk ); #endif void Modified: trunk/examples/c++/x15.cc =================================================================== --- trunk/examples/c++/x15.cc 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/examples/c++/x15.cc 2013-06-06 21:44:33 UTC (rev 12372) @@ -105,7 +105,7 @@ void x15::plot1( PLFLT **z, PLFLT zmin, PLFLT zmax ) { PLFLT shade_min, shade_max, sh_color; - int sh_cmap = 0; + int sh_cmap = 0; PLFLT sh_width; int min_color = 0, max_color = 0; PLFLT min_width = 0.0, max_width = 0.0; @@ -145,7 +145,7 @@ void x15::plot2( PLFLT **z, PLFLT zmin, PLFLT zmax ) { PLFLT shade_min, shade_max, sh_color; - int sh_cmap = 0; + int sh_cmap = 0; PLFLT sh_width; int min_color = 0, max_color = 0; PLFLT min_width = 0.0, max_width = 0.0; Modified: trunk/examples/c++/x16.cc =================================================================== --- trunk/examples/c++/x16.cc 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/examples/c++/x16.cc 2013-06-06 21:44:33 UTC (rev 12372) @@ -139,21 +139,21 @@ x16::x16( int argc, const char ** argv ) { - int i, j; - PLFLT x, y, argx, argy, distort, r, t, zmin, zmax; - PLFLT *px = new PLFLT[PERIMETERPTS]; - PLFLT *py = new PLFLT[PERIMETERPTS]; - PLFLT *xg1 = new PLFLT[nx]; - PLFLT *yg1 = new PLFLT[ny]; - PLFLT **z; - PLFLT **w; - PLcGrid cgrid1; - PLcGrid2 cgrid2; - PLFLT *clevel = new PLFLT[ns]; - PLFLT *shedge = new PLFLT[ns + 1]; + int i, j; + PLFLT x, y, argx, argy, distort, r, t, zmin, zmax; + PLFLT *px = new PLFLT[PERIMETERPTS]; + PLFLT *py = new PLFLT[PERIMETERPTS]; + PLFLT *xg1 = new PLFLT[nx]; + PLFLT *yg1 = new PLFLT[ny]; + PLFLT **z; + PLFLT **w; + PLcGrid cgrid1; + PLcGrid2 cgrid2; + PLFLT *clevel = new PLFLT[ns]; + PLFLT *shedge = new PLFLT[ns + 1]; const int cont_color = 0; const PLFLT fill_width = 2.0, cont_width = 0.0; - PLFLT colorbar_width, colorbar_height; + PLFLT colorbar_width, colorbar_height; #define NUM_AXES 1 PLINT n_axis_opts = NUM_AXES; Modified: trunk/examples/c++/x33.cc =================================================================== --- trunk/examples/c++/x33.cc 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/examples/c++/x33.cc 2013-06-06 21:44:33 UTC (rev 12372) @@ -37,10 +37,10 @@ using namespace std; #endif -#define COLORBAR_KINDS 4 +#define COLORBAR_KINDS 4 #define COLORBAR_POSITIONS 4 -#define COLORBAR_LABELS 4 -#define COLORBAR_CAPS 4 +#define COLORBAR_LABELS 4 +#define COLORBAR_CAPS 4 class x33 { public: @@ -53,13 +53,13 @@ static const PLINT position_options[16]; static const char *special_symbols[5]; static const PLINT colorbar_option_kinds[COLORBAR_KINDS]; - static const char *colorbar_option_kind_labels[COLORBAR_KINDS]; + static const char *colorbar_option_kind_labels[COLORBAR_KINDS]; static const PLINT colorbar_position_options[COLORBAR_POSITIONS]; - static const char *colorbar_position_option_labels[COLORBAR_POSITIONS]; + static const char *colorbar_position_option_labels[COLORBAR_POSITIONS]; static const PLINT colorbar_label_options[COLORBAR_LABELS]; - static const char *colorbar_label_option_labels[COLORBAR_LABELS]; + static const char *colorbar_label_option_labels[COLORBAR_LABELS]; static const PLINT colorbar_cap_options[COLORBAR_CAPS]; - static const char *colorbar_cap_option_labels[COLORBAR_CAPS]; + static const char *colorbar_cap_option_labels[COLORBAR_CAPS]; void plcolorbar_example_page( int, int, int, PLINT, PLFLT, PLINT, PLFLT * ); void plcolorbar_example( const char *, int, PLINT, PLFLT, PLINT, PLFLT * ); @@ -105,7 +105,7 @@ PL_COLORBAR_IMAGE, PL_COLORBAR_GRADIENT }; -const char *x33::colorbar_option_kind_labels[COLORBAR_KINDS] = { +const char *x33::colorbar_option_kind_labels[COLORBAR_KINDS] = { "Shade colorbars", "Shade colorbars with custom labels", "Image colorbars", @@ -119,7 +119,7 @@ PL_POSITION_TOP, PL_POSITION_BOTTOM }; -const char *x33::colorbar_position_option_labels[COLORBAR_POSITIONS] = { +const char *x33::colorbar_position_option_labels[COLORBAR_POSITIONS] = { "Left", "Right", "Top", @@ -133,7 +133,7 @@ PL_COLORBAR_LABEL_TOP, PL_COLORBAR_LABEL_BOTTOM }; -const char *x33::colorbar_label_option_labels[COLORBAR_LABELS] = { +const char *x33::colorbar_label_option_labels[COLORBAR_LABELS] = { "Label left", "Label right", "Label top", @@ -147,7 +147,7 @@ PL_COLORBAR_CAP_HIGH, PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH }; -const char *x33::colorbar_cap_option_labels[COLORBAR_CAPS] = { +const char *x33::colorbar_cap_option_labels[COLORBAR_CAPS] = { "No caps", "Low cap", "High cap", @@ -859,7 +859,7 @@ // Free space that contained legend text. for ( k = 0; k < MAX_NLEGEND; k++ ) delete [] text[k]; - + // Color bar examples PLFLT values_small[2] = { -1.0e-200, 1.0e-200 }; PLFLT values_uneven[9] = { -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 }; @@ -873,18 +873,18 @@ // We can only test image and gradient colorbars with two element arrays for ( i = 2; i < COLORBAR_KINDS; i++ ) - { - plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 2, values_small ); - } + { + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 2, values_small ); + } // Test shade colorbars with larger arrays for ( i = 0; i < 2; i++ ) - { - plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, 9, values_even ); - } + { + plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, 9, values_even ); + } for ( i = 0; i < 2; i++ ) - { - plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 9, values_uneven ); - } + { + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 9, values_uneven ); + } //plend(); delete pls; Modified: trunk/examples/java/x16.java =================================================================== --- trunk/examples/java/x16.java 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/examples/java/x16.java 2013-06-06 21:44:33 UTC (rev 12372) @@ -92,21 +92,21 @@ double[] shedge = new double[NSHADES + 1]; final int cont_color = 0; final double fill_width = 2., cont_width = 0.; - double[] colorbar_width = new double[1]; - double[] colorbar_height = new double[1]; + double[] colorbar_width = new double[1]; + double[] colorbar_height = new double[1]; - int n_axis_opts = NUM_AXES; - int[] num_values = new int[NUM_AXES]; - double[][] values = new double[NUM_AXES][NSHADES+1]; - String axis_opts[] = { "bcvtm" }; - double axis_ticks[] = { 0.0 }; - int axis_subticks[] = { 0 }; - double filler_values[] = { 0.0, 1.0 }; - - int n_labels = NUM_LABELS; - int label_opts[] = { PL_COLORBAR_LABEL_BOTTOM }; - String labels[] = { "Magnitude" }; + int n_axis_opts = NUM_AXES; + int[] num_values = new int[NUM_AXES]; + double[][] values = new double[NUM_AXES][NSHADES + 1]; + String axis_opts[] = { "bcvtm" }; + double axis_ticks[] = { 0.0 }; + int axis_subticks[] = { 0 }; + double filler_values[] = { 0.0, 1.0 }; + int n_labels = NUM_LABELS; + int label_opts[] = { PL_COLORBAR_LABEL_BOTTOM }; + String labels[] = { "Magnitude" }; + // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); @@ -191,9 +191,10 @@ pls.smin( 0.0, 0.5 ); num_values[0] = NSHADES + 1; - for ( i = 0; i < NSHADES + 1; i++ ) { - values[0][i] = shedge[i]; - } + for ( i = 0; i < NSHADES + 1; i++ ) + { + values[0][i] = shedge[i]; + } pls.colorbar( colorbar_width, colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, @@ -240,9 +241,10 @@ pls.smin( 0.0, 0.5 ); num_values[0] = NSHADES + 1; - for ( i = 0; i < NSHADES + 1; i++ ) { - values[0][i] = shedge[i]; - } + for ( i = 0; i < NSHADES + 1; i++ ) + { + values[0][i] = shedge[i]; + } pls.colorbar( colorbar_width, colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, @@ -290,9 +292,10 @@ pls.smin( 0.0, 0.5 ); num_values[0] = NSHADES + 1; - for ( i = 0; i < NSHADES + 1; i++ ) { - values[0][i] = shedge[i]; - } + for ( i = 0; i < NSHADES + 1; i++ ) + { + values[0][i] = shedge[i]; + } pls.colorbar( colorbar_width, colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, @@ -341,13 +344,14 @@ pls.smin( 0.0, 0.5 ); num_values[0] = NSHADES + 1; - for ( i = 0; i < NSHADES + 1; i++ ) { - values[0][i] = shedge[i]; - } + for ( i = 0; i < NSHADES + 1; i++ ) + { + values[0][i] = shedge[i]; + } pls.colorbar( colorbar_width, colorbar_height, 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, + 2, 3.0, label_opts, labels, axis_opts, axis_ticks, axis_subticks, @@ -418,9 +422,10 @@ pls.smin( 0.0, 0.5 ); num_values[0] = NSHADES + 1; - for ( i = 0; i < NSHADES + 1; i++ ) { - values[0][i] = shedge[i]; - } + for ( i = 0; i < NSHADES + 1; i++ ) + { + values[0][i] = shedge[i]; + } pls.colorbar( colorbar_width, colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, Modified: trunk/examples/java/x33.java =================================================================== --- trunk/examples/java/x33.java 2013-06-06 21:32:48 UTC (rev 12371) +++ trunk/examples/java/x33.java 2013-06-06 21:44:33 UTC (rev 12372) @@ -58,205 +58,205 @@ // plcolorbar options - static String[] colorbar_option_kind_labels = { - "Shade colorbars", - "Shade colorbars with custom labels", - "Image colorbars", - "Gradient colorbars" + static String[] colorbar_option_kind_labels = { + "Shade colorbars", + "Shade colorbars with custom labels", + "Image colorbars", + "Gradient colorbars" }; - static String[] colorbar_position_option_labels = { - "Left", - "Right", - "Top", - "Bottom" + static String[] colorbar_position_option_labels = { + "Left", + "Right", + "Top", + "Bottom" }; - - static String[] colorbar_label_option_labels = { - "Label left", - "Label right", - "Label top", - "Label bottom" + + static String[] colorbar_label_option_labels = { + "Label left", + "Label right", + "Label top", + "Label bottom" }; - static String[] colorbar_cap_option_labels = { - "No caps", - "Low cap", - "High cap", - "Low and high caps" + static String[] colorbar_cap_option_labels = { + "No caps", + "Low cap", + "High cap", + "Low and high caps" }; - final static int COLORBAR_KINDS = 4; + final static int COLORBAR_KINDS = 4; final static int COLORBAR_POSITIONS = 4; - final static int COLORBAR_LABELS = 4; - final static int COLORBAR_CAPS = 4; + final static int COLORBAR_LABELS = 4; + final static int COLORBAR_CAPS = 4; void plcolorbar_example_page( int kind_i, int label_i, int cap_i, int cont_color, double cont_width, double[] values ) { - int i; - // Parameters for the colorbars on this page - int position_i, position, opt; - double x, y, x_length, y_length; - double[] ticks = { 0.0 }; - int[] sub_ticks = { 0 }; - double low_cap_color, high_cap_color; - boolean vertical, ifn; - int n_axes = 1; - String[] axis_opts = new String[1]; - int n_labels = 1; - int[] label_opts = { 0 }; - String[] label = new String[1]; - String title; - double[] colorbar_width = new double[1]; - double[] colorbar_height = new double[1]; - int[] n_values_array = new int[1]; - double[][] values_array = new double[1][values.length]; + int i; + // Parameters for the colorbars on this page + int position_i, position, opt; + double x, y, x_length, y_length; + double[] ticks = { 0.0 }; + int[] sub_ticks = { 0 }; + double low_cap_color, high_cap_color; + boolean vertical, ifn; + int n_axes = 1; + String[] axis_opts = new String[1]; + int n_labels = 1; + int[] label_opts = { 0 }; + String[] label = new String[1]; + String title; + double[] colorbar_width = new double[1]; + double[] colorbar_height = new double[1]; + int[] n_values_array = new int[1]; + double[][] values_array = new double[1][values.length]; - // Colorbar type options - int[] colorbar_option_kinds = { - PL_COLORBAR_SHADE, - PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, - PL_COLORBAR_IMAGE, - PL_COLORBAR_GRADIENT - }; - // Which side of the page are we positioned relative to? - int[] colorbar_position_options = { - PL_POSITION_LEFT, - PL_POSITION_RIGHT, - PL_POSITION_TOP, - PL_POSITION_BOTTOM - }; - // Colorbar label positioning options - int[] colorbar_label_options = { - PL_COLORBAR_LABEL_LEFT, - PL_COLORBAR_LABEL_RIGHT, - PL_COLORBAR_LABEL_TOP, - PL_COLORBAR_LABEL_BOTTOM - }; - // Colorbar cap options - int[] colorbar_cap_options = { - PL_COLORBAR_CAP_NONE, - PL_COLORBAR_CAP_LOW, - PL_COLORBAR_CAP_HIGH, - PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH - }; + // Colorbar type options + int[] colorbar_option_kinds = { + PL_COLORBAR_SHADE, + PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, + PL_COLORBAR_IMAGE, + PL_COLORBAR_GRADIENT + }; + // Which side of the page are we positioned relative to? + int[] colorbar_position_options = { + PL_POSITION_LEFT, + PL_POSITION_RIGHT, + PL_POSITION_TOP, + PL_POSITION_BOTTOM + }; + // Colorbar label positioning options + int[] colorbar_label_options = { + PL_COLORBAR_LABEL_LEFT, + PL_COLORBAR_LABEL_RIGHT, + PL_COLORBAR_LABEL_TOP, + PL_COLORBAR_LABEL_BOTTOM + }; + // Colorbar cap options + int[] colorbar_cap_options = { + PL_COLORBAR_CAP_NONE, + PL_COLORBAR_CAP_LOW, + PL_COLORBAR_CAP_HIGH, + PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH + }; - n_values_array[0] = values.length; - for ( i = 0; i < n_values_array[0]; i++ ) - values_array[0][i] = values[i]; + n_values_array[0] = values.length; + for ( i = 0; i < n_values_array[0]; i++ ) + values_array[0][i] = values[i]; - low_cap_color = 0.0; - high_cap_color = 1.0; + low_cap_color = 0.0; + high_cap_color = 1.0; - // Start a new page - pls.adv( 0 ); + // Start a new page + pls.adv( 0 ); - // Draw one colorbar relative to each side of the page - for ( position_i = 0; position_i < COLORBAR_POSITIONS; position_i++ ) - { - position = colorbar_position_options[position_i]; - opt = - colorbar_option_kinds[kind_i] | - colorbar_label_options[label_i] | - colorbar_cap_options[cap_i]; - - vertical = ((position & PL_POSITION_LEFT) != 0) || ((position & PL_POSITION_RIGHT) != 0); - ifn = ((position & PL_POSITION_LEFT) != 0) || ((position & PL_POSITION_BOTTOM) != 0); + // Draw one colorbar relative to each side of the page + for ( position_i = 0; position_i < COLORBAR_POSITIONS; position_i++ ) + { + position = colorbar_position_options[position_i]; + opt = + colorbar_option_kinds[kind_i] | + colorbar_label_options[label_i] | + colorbar_cap_options[cap_i]; - // 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; - } + vertical = ( ( position & PL_POSITION_LEFT ) != 0 ) || ( ( position & PL_POSITION_RIGHT ) != 0 ); + ifn = ( ( position & PL_POSITION_LEFT ) != 0 ) || ( ( position & PL_POSITION_BOTTOM ) != 0 ); - // Set appropriate labelling options. - if ( ifn ) + // Set the offset position on the page + if ( vertical ) { - if ( cont_color == 0 || cont_width == 0. ) + 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; + } + + // Set appropriate labelling options. + if ( ifn ) + { + if ( cont_color == 0 || cont_width == 0. ) { - axis_opts[0] = "uwtivn"; - } - else - { - axis_opts[0] = "uwxvn"; - } - } - else + axis_opts[0] = "uwtivn"; + } + else + { + axis_opts[0] = "uwxvn"; + } + } + else { - if ( cont_color == 0 || cont_width == 0. ) - { - axis_opts[0] = "uwtivm"; - } - else + if ( cont_color == 0 || cont_width == 0. ) { - axis_opts[0] = "uwxvm"; - } - } - - label[0] = colorbar_position_option_labels[position_i] + ", " + - colorbar_label_option_labels[label_i]; + axis_opts[0] = "uwtivm"; + } + else + { + axis_opts[0] = "uwxvm"; + } + } - // Smaller text - pls.schr( 0.0, 0.75 ); - // Small ticks on the vertical axis - pls.smaj( 0.0, 0.5 ); - pls.smin( 0.0, 0.5 ); + label[0] = colorbar_position_option_labels[position_i] + ", " + + colorbar_label_option_labels[label_i]; - pls.vpor( 0.20, 0.80, 0.20, 0.80 ); - pls.wind( 0.0, 1.0, 0.0, 1.0 ); - // Set interesting background colour. - pls.scol0a( 15, 0, 0, 0, 0.20 ); - pls.colorbar( colorbar_width, colorbar_height, - 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 ); + // Smaller text + pls.schr( 0.0, 0.75 ); + // Small ticks on the vertical axis + pls.smaj( 0.0, 0.5 ); + pls.smin( 0.0, 0.5 ); - // Reset text and tick sizes - pls.schr( 0.0, 1.0 ); - pls.smaj( 0.0, 1.0 ); - pls.smin( 0.0, 1.0 ); - } + pls.vpor( 0.20, 0.80, 0.20, 0.80 ); + pls.wind( 0.0, 1.0, 0.0, 1.0 ); + // Set interesting background colour. + pls.scol0a( 15, 0, 0, 0, 0.20 ); + pls.colorbar( colorbar_width, colorbar_height, + 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 ); - // Draw a page title - title = colorbar_option_kind_labels[kind_i] + " - " + - colorbar_cap_option_labels[cap_i]; - pls.vpor( 0.0, 1.0, 0.0, 1.0 ); - pls.wind( 0.0, 1.0, 0.0, 1.0 ); - pls.ptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); + // Reset text and tick sizes + pls.schr( 0.0, 1.0 ); + pls.smaj( 0.0, 1.0 ); + pls.smin( 0.0, 1.0 ); + } + + // Draw a page title + title = colorbar_option_kind_labels[kind_i] + " - " + + colorbar_cap_option_labels[cap_i]; + pls.vpor( 0.0, 1.0, 0.0, 1.0 ); + pls.wind( 0.0, 1.0, 0.0, 1.0 ); + pls.ptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); } void plcolorbar_example( String palette, int kind_i, int cont_color, double cont_width, double[] values ) { - int label_i, cap_i; - - // Load the color palette - pls.spal1( palette, true ); - - for ( label_i = 0; label_i < COLORBAR_LABELS; label_i++ ) - { - for ( cap_i = 0; cap_i < COLORBAR_CAPS; cap_i++ ) + int label_i, cap_i; + + // Load the color palette + pls.spal1( palette, true ); + + for ( label_i = 0; label_i < COLORBAR_LABELS; label_i++ ) + { + for ( cap_i = 0; cap_i < COLORBAR_CAPS; cap_i++ ) { - plcolorbar_example_page( kind_i, label_i, cap_i, - cont_color, cont_width, - values ); - } - } + plcolorbar_example_page( kind_i, label_i, cap_i, + cont_color, cont_width, + values ); + } + } } @@ -888,31 +888,31 @@ null, null, null, null ); max_height = Math.max( max_height, legend_height[0] ); - // Color bar examples - double[] values_small = { -1.0e-200, 1.0e-200 }; - double[] 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 }; - double[] 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 }; + // Color bar examples + double[] values_small = { -1.0e-200, 1.0e-200 }; + double[] 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 }; + double[] 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. - pls.scolbg( 70, 185, 70 ); - // Cut out the greatest and smallest bits of the color spectrum to - // leave colors for the end caps. - pls.scmap1_range( 0.01, 0.99 ); + // Use unsaturated green background colour to contrast with black caps. + pls.scolbg( 70, 185, 70 ); + // Cut out the greatest and smallest bits of the color spectrum to + // leave colors for the end caps. + pls.scmap1_range( 0.01, 0.99 ); - // We can only test image and gradient colorbars with two element arrays - for ( i = 2; i < COLORBAR_KINDS; i++ ) - { - plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_small ); - } - // Test shade colorbars with larger arrays - for ( i = 0; i < 2; i++ ) + // We can only test image and gradient colorbars with two element arrays + for ( i = 2; i < COLORBAR_KINDS; i++ ) { - plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, values_even ); - } - for ( i = 0; i < 2; i++ ) + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_small ); + } + // Test shade colorbars with larger arrays + for ( i = 0; i < 2; i++ ) { - plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_uneven ); - } + plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, values_even ); + } + for ( i = 0; i < 2; i++ ) + { + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_uneven ); + } pls.end(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2013-06-07 16:03:37
|
Revision: 12374 http://sourceforge.net/p/plplot/code/12374 Author: andrewross Date: 2013-06-07 16:03:35 +0000 (Fri, 07 Jun 2013) Log Message: ----------- Update lua bindings to implement latest colorbar API and update examples accordingly. Modified Paths: -------------- trunk/bindings/lua/plplotluac.i trunk/bindings/swig-support/plplotcapi.i trunk/examples/lua/x16.lua trunk/examples/lua/x33.lua Modified: trunk/bindings/lua/plplotluac.i =================================================================== --- trunk/bindings/lua/plplotluac.i 2013-06-06 21:44:55 UTC (rev 12373) +++ trunk/bindings/lua/plplotluac.i 2013-06-07 16:03:35 UTC (rev 12374) @@ -230,7 +230,32 @@ LUA_FREE_ARRAY( $1 ); } +// No length but remember size to check others +%typemap( in ) const PLINT * ArrayN( int temp ) +{ + int i; + $1 = (PLINT *) LUA_get_int_num_array_var( L, $input, &temp ); + if ( !$1 ) + SWIG_fail; + if (temp != Alen) + { + lua_pushfstring( L, "Tables must be of same length." ); + SWIG_fail; + } + + Xlen = temp; + Ylen = -1; + for ( i = 0; i < Xlen; i++ ) + if ( $1[i] > Ylen ) Ylen = $1[i]; + +} +%typemap( freearg ) ( const PLINT * ArrayN ) +{ + LUA_FREE_ARRAY( $1 ); +} + + //-------------------------------------------------------------------------- // PLFLT Arrays //-------------------------------------------------------------------------- @@ -1240,8 +1265,38 @@ } } +%typemap( in ) ( PLINT n, const char **Array ) +{ + int i; + $1 = SWIG_table_size( L, $input ); + Alen = $1; + $2 = malloc( sizeof ( char* ) * Alen ); + for ( i = 1; i <= Alen; i++ ) + { + lua_rawgeti( L, $input, i ); + if ( lua_isstring( L, -1 ) ) + { + $2[i - 1] = (char *) lua_tostring( L, -1 ); + } + else + { + lua_pop( L, 1 ); + lua_pushfstring( L, "Requires a sequence of strings." ); + SWIG_fail; + } + lua_pop( L, 1 ); + } +} +%typemap( freearg ) ( PLINT n, const char **Array ) +{ + if ( $2 ) + { + free( $2 ); $2 = NULL; + } +} + // Process options list using current options info. %typemap( in, checkfn = "lua_istable" ) ( int *p_argc, const char **argv ) { @@ -1308,6 +1363,7 @@ %rename( clear ) plclear; %rename( col0 ) plcol0; %rename( col1 ) plcol1; +%rename( colorbar ) plcolorbar; %rename( configtime ) plconfigtime; %rename( cont ) plcont; %rename( cpstrm ) plcpstrm; @@ -1398,6 +1454,7 @@ %rename( scmap1l ) plscmap1l; %rename( scmap1la ) plscmap1la; %rename( scmap1n ) plscmap1n; +%rename( scmap1_range ) plscmap1_range; %rename( scol0 ) plscol0; %rename( scol0a ) plscol0a; %rename( scolbg ) plscolbg; Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2013-06-06 21:44:55 UTC (rev 12373) +++ trunk/bindings/swig-support/plplotcapi.i 2013-06-07 16:03:35 UTC (rev 12374) @@ -481,7 +481,6 @@ const PLINT *ArrayCkNull, const PLFLT *ArrayCkNull, const PLINT *ArrayCkNull, const char **ArrayCk ); -#if defined ( SWIG_PYTHON ) || defined ( SWIG_JAVA ) || defined ( SWIG_OCTAVE ) void plcolorbar( PLFLT *OUTPUT, PLFLT *OUTPUT, PLINT opt, PLINT position, PLFLT x, PLFLT y, @@ -493,7 +492,6 @@ PLINT n, const char **Array, const PLFLT *ArrayCk, const PLINT *ArrayCk, const PLINT *ArrayN, const PLFLT **MatrixCk ); -#endif void pllightsource( PLFLT x, PLFLT y, PLFLT z ); Modified: trunk/examples/lua/x16.lua =================================================================== --- trunk/examples/lua/x16.lua 2013-06-06 21:44:55 UTC (rev 12373) +++ trunk/examples/lua/x16.lua 2013-06-07 16:03:35 UTC (rev 12374) @@ -72,7 +72,19 @@ return z<0.4 or z>0.6 end +-- return single bit (for OR) +function bit(x,b) + return ((x % 2^b) - (x % 2^(b-1)) > 0) +end +-- logic OR for number values +function lor(x,y) + result = 0 + for p=1,16 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end + return result +end + + ---------------------------------------------------------------------------- -- main -- @@ -86,6 +98,14 @@ cont_color = 0 cont_width = 0. +axis_opts = { "bcvtm" } +num_values = {} +values = {} +axis_ticks = { 0.0 } +axis_subticks = { 0 } +label_opts = { pl.PL_COLORBAR_LABEL_BOTTOM } +labels = { "Magnitude" } + -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) @@ -169,6 +189,21 @@ pl.shades(z, -1, 1, -1, 1, shedge, fill_width, cont_color, cont_width, 1) +-- Smaller text +pl.schr( 0.0, 0.75 ) +-- Small ticks on the vertical axis +pl.smaj( 0.0, 0.5 ) +pl.smin( 0.0, 0.5 ) + +num_values[1] = ns + 1 +values[1] = shedge +colorbar_width, colorbar_height = pl.colorbar( lor(pl.PL_COLORBAR_SHADE, pl.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 +pl.schr( 0.0, 1.0 ) +pl.smaj( 0.0, 1.0 ) +pl.smin( 0.0, 1.0 ) + pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) pl.col0(2) @@ -193,6 +228,22 @@ pl.shades(z, -1, 1, -1, 1, shedge, fill_width, cont_color, cont_width, 1, "pltr1", cgrid1) +-- Smaller text +pl.schr( 0.0, 0.75 ) +-- Small ticks on the vertical axis +pl.smaj( 0.0, 0.5 ) +pl.smin( 0.0, 0.5 ) + +num_values[1] = ns + 1 +values[1] = shedge + +colorbar_width, colorbar_height = pl.colorbar( lor(pl.PL_COLORBAR_SHADE, pl.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 +pl.schr( 0.0, 1.0 ) +pl.smaj( 0.0, 1.0 ) +pl.smin( 0.0, 1.0 ) + pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) pl.col0(2) @@ -215,6 +266,21 @@ pl.shades(z, -1, 1, -1, 1, shedge, fill_width, cont_color, cont_width, 0, "pltr2", cgrid2) +-- Smaller text +pl.schr( 0.0, 0.75 ) +-- Small ticks on the vertical axis +pl.smaj( 0.0, 0.5 ) +pl.smin( 0.0, 0.5 ) + +num_values[1] = ns + 1 +values[1] = shedge +colorbar_width, colorbar_height = pl.colorbar( lor(pl.PL_COLORBAR_SHADE, pl.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 +pl.schr( 0.0, 1.0 ) +pl.smaj( 0.0, 1.0 ) +pl.smin( 0.0, 1.0 ) + pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) pl.col0(2) @@ -239,6 +305,21 @@ pl.shades(z, -1, 1, -1, 1, shedge, fill_width, 2, 3., 0, "pltr2", cgrid2) +-- Smaller text +pl.schr( 0.0, 0.75 ) +-- Small ticks on the vertical axis +pl.smaj( 0.0, 0.5 ) +pl.smin( 0.0, 0.5 ) + +num_values[1] = ns + 1 +values[1] = shedge +colorbar_width, colorbar_height = pl.colorbar( lor(pl.PL_COLORBAR_SHADE, pl.PL_COLORBAR_SHADE_LABEL), 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, 2, 3., label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ) + +-- Reset text and tick sizes +pl.schr( 0.0, 1.0 ) +pl.smaj( 0.0, 1.0 ) +pl.smin( 0.0, 1.0 ) + pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) pl.col0(2) @@ -308,6 +389,21 @@ -- Now we can shade the interior region. pl.shades(z, -1, 1, -1, 1, shedge, fill_width, cont_color, cont_width, 0, "pltr2", cgrid2) +-- Smaller text +pl.schr( 0.0, 0.75 ) +-- Small ticks on the vertical axis +pl.smaj( 0.0, 0.5 ) +pl.smin( 0.0, 0.5 ) + +num_values[1] = ns + 1 +values[1] = shedge +colorbar_width, colorbar_height = pl.colorbar( lor(pl.PL_COLORBAR_SHADE, pl.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 +pl.schr( 0.0, 1.0 ) +pl.smaj( 0.0, 1.0 ) +pl.smin( 0.0, 1.0 ) + -- Now we can draw the perimeter. (If do before, shade stuff may overlap.) for i = 1, PERIMETERPTS do t = 2*math.pi/(PERIMETERPTS-1)*(i-1) Modified: trunk/examples/lua/x33.lua =================================================================== --- trunk/examples/lua/x33.lua 2013-06-06 21:44:55 UTC (rev 12373) +++ trunk/examples/lua/x33.lua 2013-06-07 16:03:35 UTC (rev 12374) @@ -1,4 +1,4 @@ ---[[ $Id: x04.lua 11667 2011-03-21 03:35:08Z airwin $ +--[[ $Id: x33.lua 11667 2011-03-21 03:35:08Z airwin $ Demonstrate most pllegend capability including unicode symbols. @@ -24,25 +24,25 @@ -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") ----------------------------------------------------------------------------- --- plot1 --- --- Log-linear plot. ----------------------------------------------------------------------------- - -- return single bit (for OR) function bit(x,b) return ((x % 2^b) - (x % 2^(b-1)) > 0) end -- logic OR for number values - function lor(x,y) result = 0 - for p=1,8 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end + for p=1,32 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end return result end +-- logic AND for number values +function land(x,y) + result = 0 + for p=1,32 do result = result + (((bit(x,p) and bit(y,p)) == true) and 2^(p-1) or 0) end + return result +end + -- Intialize pllegend arrays taking advantage of Lua's default global scope. function initialize_pllegend_arrays(nlegend) @@ -78,6 +78,116 @@ end end +function plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, n_values, values ) + -- Parameters for the colorbars on this page + ticks = { 0.0 } + sub_ticks = { 0 } + axis_opts = {} + label_opts = { 0 } + n_values_array = {} + values_array = {} + label = {} + + n_values_array[1] = n_values + values_array[1] = values + + low_cap_color = 0.0 + high_cap_color = 1.0 + + -- Start a new page + pl.adv( 0 ) + + -- Draw one colorbar relative to each side of the page + for position_i = 0,COLORBAR_POSITIONS-1 do + position = colorbar_position_options[position_i+1] + opt = + lor(colorbar_option_kinds[kind_i+1], + lor(colorbar_label_options[label_i+1], + colorbar_cap_options[cap_i+1])) + + vertical = lor(land(position,pl.PL_POSITION_LEFT), land(position,pl.PL_POSITION_RIGHT)) + ifn = lor(land(position, pl.PL_POSITION_LEFT), land(position, pl.PL_POSITION_BOTTOM)) + + -- Set the offset position on the page + if vertical > 0 then + 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 + end + + -- Set appropriate labelling options. + if ifn > 0 then + if ( cont_color == 0 ) or ( cont_width == 0. ) then + axis_opts[1] = "uwtivn" + else + axis_opts[1] = "uwxvn" + end + else + if ( cont_color == 0 ) or ( cont_width == 0. ) then + axis_opts[1] = "uwtivm" + else + axis_opts[1] = "uwxvm" + end + end + + label[1] = string.format( "%s, %s", + colorbar_position_option_labels[position_i+1], + colorbar_label_option_labels[label_i+1] ) + + -- Smaller text + pl.schr( 0.0, 0.75 ) + -- Small ticks on the vertical axis + pl.smaj( 0.0, 0.5 ) + pl.smin( 0.0, 0.5 ) + + pl.vpor( 0.20, 0.80, 0.20, 0.80 ) + pl.wind( 0.0, 1.0, 0.0, 1.0 ) + -- Set interesting background colour. + pl.scol0a( 15, 0, 0, 0, 0.20 ); + colorbar_width, colorbar_height = pl.colorbar( + lor(opt, lor(pl.PL_COLORBAR_BOUNDING_BOX, pl.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 ) + + -- Reset text and tick sizes + pl.schr( 0.0, 1.0 ) + pl.smaj( 0.0, 1.0 ) + pl.smin( 0.0, 1.0 ) + end + + -- Draw a page title + title = string.format( "%s - %s", + colorbar_option_kind_labels[kind_i+1], + colorbar_cap_option_labels[cap_i+1] ) + pl.vpor( 0.0, 1.0, 0.0, 1.0 ) + pl.wind( 0.0, 1.0, 0.0, 1.0 ) + pl.ptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ) +end + +function plcolorbar_example( palette, kind_i, cont_color, cont_width, n_values, values ) + -- Load the color palette + pl.spal1( palette, 1 ) + + for label_i = 0, COLORBAR_LABELS-1 do + for cap_i = 0, COLORBAR_CAPS-1 do + plcolorbar_example_page( kind_i, label_i, cap_i, + cont_color, cont_width, + n_values, values ) + end + end +end + ---------------------------------------------------------------------------- -- main ---------------------------------------------------------------------------- @@ -110,6 +220,69 @@ "✦" } +-- plcolorbar options +COLORBAR_KINDS = 4 +-- Colorbar type options +colorbar_option_kinds = { + pl.PL_COLORBAR_SHADE, + lor(pl.PL_COLORBAR_SHADE, pl.PL_COLORBAR_SHADE_LABEL), + pl.PL_COLORBAR_IMAGE, + pl.PL_COLORBAR_GRADIENT +} + +colorbar_option_kind_labels = { + "Shade colorbars", + "Shade colorbars with custom labels", + "Image colorbars", + "Gradient colorbars" +} + +-- Which side of the page are we positioned relative to? +COLORBAR_POSITIONS = 4 +colorbar_position_options = { + pl.PL_POSITION_LEFT, + pl.PL_POSITION_RIGHT, + pl.PL_POSITION_TOP, + pl.PL_POSITION_BOTTOM +} + +colorbar_position_option_labels = { + "Left", + "Right", + "Top", + "Bottom" +} + +-- Colorbar label positioning options +COLORBAR_LABELS = 4 +colorbar_label_options = { + pl.PL_COLORBAR_LABEL_LEFT, + pl.PL_COLORBAR_LABEL_RIGHT, + pl.PL_COLORBAR_LABEL_TOP, + pl.PL_COLORBAR_LABEL_BOTTOM +} +colorbar_label_option_labels = { + "Label left", + "Label right", + "Label top", + "Label bottom" +} + +-- Colorbar cap options +COLORBAR_CAPS = 4 +colorbar_cap_options = { + pl.PL_COLORBAR_CAP_NONE, + pl.PL_COLORBAR_CAP_LOW, + pl.PL_COLORBAR_CAP_HIGH, + lor(pl.PL_COLORBAR_CAP_LOW, pl.PL_COLORBAR_CAP_HIGH) +} +colorbar_cap_option_labels = { + "No caps", + "Low cap", + "High cap", + "Low and high caps" +} + -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) @@ -612,4 +785,27 @@ symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = math.max(max_height, legend_height) +-- 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. +pl.scolbg( 70, 185, 70 ) +-- Cut out the greatest and smallest bits of the color spectrum to +-- leave colors for the end caps. +pl.scmap1_range( 0.01, 0.99 ) + +-- We can only test image and gradient colorbars with two element arrays +for i = 2, COLORBAR_KINDS-1 do + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 2, values_small ) +end +-- Test shade colorbars with larger arrays +for i = 0,1 do + plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, 9, values_even ) +end +for i = 0,1 do + plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 9, values_uneven ) +end + pl.plend() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |