[R] specifying dimensions of a graphic (not the window...)
Evan Cooch
evan.cooch at gmail.com
Mon Feb 9 01:41:31 CET 2015
Greetings --
Graphics newbie (I generally don't use R for graphics, so if the
question is 'obvious', point that out gently ;-)
I'm trying to use levelplot in the lattice package, to generate what
I'll call a 'decision table', where optimal decisions (discrete, on the
interval [0.0,0.5] by increments of 0.1) from a dynamic programming
problem are plotted as a function of time since the time horizon. The
'matrix' I'm trying to plot is 100 rows x 10 columns. While using the
following works, more or less...
rgb.palette <- colorRampPalette(c("red", "green"), space = "rgb")
levelplot(t(results$policy), main="optimal harvest", xlab="time from
end", ylab="state (N)", col.regions=rgb.palette(6), cuts=6,
at=seq(0,0.5,0.1))
the rendered figure is waaaaay too narrow. I want to make the
proportions of the 'levelplot' (what I usually call a 'heat map') square
(or something else that I specify). I'm used to dedicated graphics
applications wherew I simply grab the figure and resize it to whatever
aspect ratio I want. Obviously, with R, I need to invoke some sort of
command line argument.
In my searches, I've found a fair number of queries/answers about how to
change the size of the graphics windows, but I could care lerss what the
graphics window sizing is (presumably, it should adjust to whatever the
size of the underlying graphic is). I want to 'hard code' the dimensions
of the graphic itself, not the window it's rendered in.
I'm sure the answer is out there, but I've been unsuccessful at finding
the magic keywords in my searches.
Thanks in advance.
[[alternative HTML version deleted]]
More information about the R-help
mailing list