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. |