[R] vectors on top of contours, and lattice
Deepayan Sarkar
deepayan.sarkar at gmail.com
Wed Apr 8 18:24:44 CEST 2009
On 4/8/09, Cable, Samuel B Civ USAF AFMC AFRL/RVBXI
<Samuel.Cable at hanscom.af.mil> wrote:
> OK, I needed to plot a set of vectors on top of a contour plot. I
> figured out a way to do this. I create a panel function that calls
> "larrows()" with arguments constructed from my vector data. Then, when
> I go to do the contour plot, I call contourplot() with the "panel"
> argument set to point to my newly created panel function.
>
>
>
> So far, so good.
>
>
>
> Now, I need to do a series of contour plots, each overlaid with a
> different set of vectors. I can call contourplot(z~x*y,...) but now
> I'm stuck, because each contour plot will be overlaid with the *same*
> vector plot. This won't work because each set of contoured data has its
> own particular set of associated vector data. (BTW, I am not doing
> gradients here. The vector data is its own entity, not derivable from
> the contoured data.) Can I somehow define a whole series of panel
> functions and coax contourplot() to choose the right one for each of its
> plots? Or do I have to revise my entire approach here?
See ?packet.number for one approach. This should allow you to extract
the correct component of the vector data inside the panel function.
-Deepayan
More information about the R-help
mailing list