|
From: <hez...@us...> - 2013-10-29 00:18:50
|
Revision: 12639
http://sourceforge.net/p/plplot/code/12639
Author: hezekiahcarty
Date: 2013-10-29 00:18:45 +0000 (Tue, 29 Oct 2013)
Log Message:
-----------
Update OCaml example 16, small type fix for OCaml's plshades
This version should have no visual difference between the C
and OCaml example 16. There is still a postscript output
difference due to some color setting and restoration which
is performed in the OCaml version. That difference will be
addressed in a later commit.
Modified Paths:
--------------
trunk/bindings/ocaml/plplot_impl.c
trunk/examples/ocaml/x16.ml
Modified: trunk/bindings/ocaml/plplot_impl.c
===================================================================
--- trunk/bindings/ocaml/plplot_impl.c 2013-10-28 22:05:41 UTC (rev 12638)
+++ trunk/bindings/ocaml/plplot_impl.c 2013-10-29 00:18:45 UTC (rev 12639)
@@ -450,7 +450,7 @@
void ml_plshades( const PLFLT **a, PLINT nx, PLINT ny,
PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
PLFLT *clevel, PLINT nlevel, PLFLT fill_width,
- PLINT cont_color, PLINT cont_width,
+ PLINT cont_color, PLFLT cont_width,
PLBOOL rectangular )
{
c_plshades( a, nx, ny,
Modified: trunk/examples/ocaml/x16.ml
===================================================================
--- trunk/examples/ocaml/x16.ml 2013-10-28 22:05:41 UTC (rev 12638)
+++ trunk/examples/ocaml/x16.ml 2013-10-29 00:18:45 UTC (rev 12639)
@@ -9,6 +9,33 @@
open Plplot
+let colorbar ?color ?contour values =
+ (* Smaller text *)
+ plschr 0.0 0.75;
+ (* Small ticks on the vertical axis *)
+ plsmaj 0.0 0.5;
+ plsmin 0.0 0.5;
+
+ let axis =
+ [
+ `frame0;
+ `frame1;
+ `vertical_label;
+ `unconventional_label;
+ `major_ticks;
+ ]
+ in
+ let shade = Plot.shade_colorbar ~custom:true ~axis values in
+ let pos = Plot.viewport_pos ~inside:false 0.005 0.0 in
+ Plot.plot [
+ Plot.colorbar ?color ?contour ~orient:(`top (0.0375, 0.875)) ~label:[`bottom "Magnitude"] ~pos shade;
+ ];
+
+ (* Reset text and tick sizes *)
+ plschr 0.0 1.0;
+ plsmaj 0.0 1.0;
+ plsmin 0.0 1.0
+
let pi = atan 1.0 *. 4.0
(* Fundamental settings. See notes[] for more info. *)
@@ -133,6 +160,8 @@
plshades z (-1.0) 1.0 (-1.0) 1.0 shedge fill_width cont_color cont_width true;
+ colorbar shedge;
+
plcol0 1;
plbox "bcnst" 0.0 0 "bcnstv" 0.0 0;
plcol0 2;
@@ -153,6 +182,8 @@
plset_pltr (pltr1 xg1 yg1);
plshades z (-1.0) 1.0 (-1.0) 1.0 shedge fill_width cont_color cont_width true;
+ colorbar shedge;
+
plcol0 1;
plbox "bcnst" 0.0 0 "bcnstv" 0.0 0;
plcol0 2;
@@ -174,6 +205,8 @@
plshades
z (-1.0) 1.0 (-1.0) 1.0 shedge fill_width cont_color cont_width false;
+ colorbar shedge;
+
plcol0 1;
plbox "bcnst" 0.0 0 "bcnstv" 0.0 0;
plcol0 2;
@@ -195,6 +228,8 @@
plshades z (-1.0) 1.0 (-1.) 1.0 shedge fill_width 2 3.0 false;
+ colorbar ~color:(`index 2) ~contour:(`index 2, 3.0) shedge;
+
plcol0 1;
plbox "bcnst" 0.0 0 "bcnstv" 0.0 0;
plcol0 2;
@@ -214,6 +249,8 @@
plset_defined zdefined;
plshades
z (-1.0) 1.0 (-1.0) 1.0 shedge fill_width cont_color cont_width false;
+
+ colorbar shedge;
plunset_defined ();
plcol0 1;
@@ -257,6 +294,8 @@
plshades
z (-1.0) 1.0 (-1.0) 1.0 shedge fill_width cont_color cont_width false;
+ colorbar shedge;
+
(* Now we can draw the perimeter. (If do before, shade stuff may overlap.) *)
let px = Array.make perimeterpts 0.0 in
let py = Array.make perimeterpts 0.0 in
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|