Note that there are some explanatory texts on larger screens.

plurals
  1. POAlternative to grid.cap() for Rotating/Tilting an Image plot in R
    text
    copied!<p>I can't seem to find much information on this. I would like to rotate the main plot in and image while leaving the legend and title unaltered. </p> <p>Here's an example. You'll need <code>fields</code> package which gives you the <code>image.plot</code> function.</p> <pre><code>x=1:10 y=1:10 z=matrix(-50:49,10,10) image.plot(x,y,z, main="Some Fancy Title",yaxt="n",xaxt="n", ylab="", xlab="") </code></pre> <p>So again I just want to rotate the main image and leave the title and legend in place. Btw I'm rotating 36 degrees so I can't just rotate the matrix I'm feeding <code>image.plot</code>. The <code>grid</code> package seems to lead me in the right direction but it is frustrating how I cannot plot directly into their so called <code>viewports</code> with plot or anything else from <code>base</code>. I must say not a fan of the <code>grid</code> package so far. </p> <p>I found <a href="https://stackoverflow.com/questions/3792803/is-it-possible-to-rotate-a-plot-in-r-base-graphics">this post</a> which provides some helpful information in answer 5. I know from this that I should be able to use <code>grid.cap()</code> to capture a raster of my device and use <code>grid.raster(cap, vp=viewport(angle=36))</code> to import the plot into the correct viewport. I'm having problems getting this method to working for me and it seems pretty inefficient to boot. I will be plotting literally thousands of images to create gifs of various temporally and spatially varying data I have modeled. </p> <p>What I'm looking for is either a way to get <code>grid.cap()</code> to work with the above example and rotate only the main part of the image 36 degrees or an alternative doing the same thing that will work well with my volume of plots. Much thanks to anyone that gives this some thought.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload