From: Arjen M. <arj...@wl...> - 2005-05-20 06:44:59
|
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 second Alan's advice, but I would like to know what makes you think that the code is too slow? After all, a single call to some more convenient PLplot routine would have to go through the same loop and I do not think that is going to be much more efficient - unless wxWorks is doing an screen update with each call to myPlot->poin() ... Regards, Arjen |