[R] Three questions about plotting
jim at bitwrit.com.au
Fri Feb 28 04:03:49 CET 2014
On 02/28/2014 11:19 AM, David Parkhurst wrote:
> I would like to plot three graphs, one above the other, of three “y”
> variables that have different scales against a common Date variable, as
> with the code below.
> Q1. If I understand correctly, I can't use lattice graphics because my
> y's have different scales. Is that correct? All the lattice or trellis
> plots I've seen have common “y” scales for all plots.
> I have two problems with what this code produces:
> Q2. How can I get the vertical dimension of all three plots to be the
> same? I know that I've made them different by using different mar
> numbers, but I had to do that, I thought, to leave room for date axis
> labels. I don't want to leave wasted space between the plots.
You can get what you want with:
rather than mfrow. Also, try using:
# first plot
# second plot
par(mar=c(0,4,0,4)) # and yaxt="n"
# third plot
> Q3. Why are my dates not coming out in the format I've specified in the
> axis.Date statement?
More information about the R-help