I've written a very simple bit of code to plot a trajectory using rgl: x <- (c(0,-5.947,-11.496,-16.665,-21.474,-25.947,-30.116,-34.017,-37.684,-41.148,-44.435,-47.568,-50.567,-53.448,-56.223,-58.906)) y <- (c(0,33.729,65.198,94.514,121.784,147.151,170.797,192.920,213.717,233.360,252.003,269.774,286.781,303.117,318.858,334.071)) z <- (c(3,11.914,19.629,26.066,31.167,34.902,37.262,38.257,37.903,36.221,33.233,28.964,23.442,16.696,8.761,-0.325)) plot3d(x,y,z, type='l',axes=FALSE, box=FALSE) I have a PNG file that I want to place the plot on top of. I've arranged the image so that the point at x=282 px and y=52 px should correspond with the origin of the graph. Thanks in advance for your help, --CW _________________________________________________________________ id=1&media=aero-shake-7second&listid=1&stop=1&ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_7secdemo:122009 [[alternative HTML version deleted]]
On 05/12/2009 3:07 AM, Colin Wyers wrote:> I've written a very simple bit of code to plot a trajectory using rgl: > > > > x <- (c(0,-5.947,-11.496,-16.665,-21.474,-25.947,-30.116,-34.017,-37.684,-41.148,-44.435,-47.568,-50.567,-53.448,-56.223,-58.906)) > y <- (c(0,33.729,65.198,94.514,121.784,147.151,170.797,192.920,213.717,233.360,252.003,269.774,286.781,303.117,318.858,334.071)) > z <- (c(3,11.914,19.629,26.066,31.167,34.902,37.262,38.257,37.903,36.221,33.233,28.964,23.442,16.696,8.761,-0.325)) > plot3d(x,y,z, type='l',axes=FALSE, box=FALSE) > > > > I have a PNG file that I want to place the plot on top of. I've arranged the image so that the point at x=282 px and y=52 px should correspond with the origin of the graph.One way is to use the PNG file as a texture on a rectangle behind the line. demo(flag) does a fairly elaborate example of this. See ?rgl.surface for the description of how to do it. Another way is to use the image on the background sphere; example(bg3d) and demo(envmap) do this. Duncan Murdoch
Seemingly Similar Threads
- Position of corporate logo beneath diagram
- [LLVMdev] How to reply beneath the message I want to talk about in the Thread
- [LLVMdev] "Re: How to reply beneath the message I want to talk about in the Thread"
- ADV: Other silly shiny postmasters will exclude monthly beneath hackers.
- New R package kwb.hantush (0.2.1): calculation of groundwater mounding beneath an (stormwater) infiltration basin