[R] specifying dimensions of a graphic (not the window...)

Evan Cooch evan.cooch at gmail.com
Mon Feb 9 02:13:06 CET 2015


On 2/8/2015 7:41 PM, Evan Cooch wrote:
> 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))
>
>

Sufficient solution to the problem for now -- adding the option 
aspect="fill" fills the window, and if I specify the size of the window, 
then this amounts to the same thing, more or less.

Seems kind of a backward way to do it. I'd have thought setting size of 
the graphic, and then having the window size change dynamically around 
said graphic, would have been more intuitive.




	[[alternative HTML version deleted]]



More information about the R-help mailing list