|
From: Alan W. I. <ir...@be...> - 2005-05-20 06:29:28
|
On 2005-05-19 17:33-0700 fred wrote:
> Hello,
>
> I'm using the wxWidgets binding of plPlot, wxPlot,
> but I think my question is general enough to post
> here. I apologize in advance if this question is
> obvious.
>
> I have a three data arrays, x[], y[], z[], all of
> equal length. I would like to plot the x, y arrays
> against each other using z to color the points. I
> don't think that a contour plot will work here, as the
> z[] values are discontinuous and non-linear in x and
> y. For those of you who use R, I am basically trying
> to call something like:
>
> plot( x, y, col = z)
>
> In plplot, I tried the following:
>
> for( int i = 0; i < NUM_POINTS; i++ ){
> myPlot->col( z[i] );
> myPlot->poin( 1, x[i], y[i], 1 );
> }
>
> This kind of works, but it is slow and inelegant and
> some of the colors don't seem to display properly.
> Moreover, a continuous color range along the lines
> "Color Map 1" from the documentation would be
> preferable. I think that I may want to use a shade
> plot, but it is not well documented, and I only want
> to color the individual points.
>
> Advice? Suggestions? Thanks in advance.
I am not familiar with the wxWidgets interface to plPlot, but be sure you
are using the latest version. I see an interface based on PLplot-5.5.1
mentioned at http://personales.unican.es/carreracg/web/wxplot.html, but it
is possible a later version interface has been generated. (We just released
PLplot-5.5.3.)
I don't think you want a shade plot from the description of your data. I
assume (but I don't know for sure) the wxWidgets interface has all the
common PLplot API implemented. If so, then I suggest the above code should
work, except you should replace myPlot->col( z[i] ); with myPlot->col1( z[i]
); (and make sure that z[i] is in the range from 0.0 to 1.0). That will
give you the continuous colours you want. See
http://plplot.sourceforge.net/docbook-manual/plplot-html-5.5.3/ for the
latest PLplot documentation and look there for links to plcol1.
Alan
__________________________
Alan W. Irwin
email: ir...@be...
phone: 250-727-2902
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
|