On Fri, Mar 7, 2008 at 8:23 AM, Paul Wellner Bou <paul@...> wrote:
> i am writing a program in C++ where I am implementing the stuff I
> developed my thesis about eye glass optics with Matlab/Octave. I tried a
> C++ interface to gnuplot, but as the interface is not very nice and as I
> did not find this feature there until now, I am trying the C++ PLPlot
> interface right now.
> I need to draw graphs like those: http://m21s26.vlinux.de/math/gsg.png
> The data does not fit in a regular grid, so there has to be a kind of
> triangulation or something similar. In Matlab I use the function
> griddata for this. The lines to draw this graphs in Matlab are following:
> lmin = min(min(Zi));
> lmax = max(max(Zi));
> [C,h] = contourf(Xi,Yi,Zi,levels,'LineStyle','none');
> axis equal;
> grid on;
> Is there a way to do this with PLPlot? And if there is, how? Is this
> possible with the plstream::fcont method? Does PLPlot implement some
> kind of triangulation or do I have to write this on my own?
Would plgriddata do what you need?
PLplot comes with several gridding methods, and I have used it for a
few simple tests.
plshades (or multiple calls to plshade) can generate the actual plot.
PLplot does not have a built-in function to draw a color bar. I have
written a simple one in OCaml which can probably be translated to
C/C++ without a lot of trouble:
color_bar at line 77 uses color map 1 (continuous colors) and
color_bar0 at line 137 uses color map 0 (indexed colors). The OCaml
plplot functions follow the C functions pretty closely.
This is an example of what a color_bar0 color bar looks like:
color_bar would be similar.
> Another issue: Is there a way to draw "quiver" graphs like this one?
> (In this case I multiplied the arrow length of the points with the z value.)
I think plvect will do what you want here.
plsvect can change the arrow style, and will hopefully give you what you want.
I am new to PLplot as well, so these may not be the best methods
available. They should help with what you need though.
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science