[R] trellis/lattice: How to plot 4 panels with the same x-scale but different y-scales?
deepayan.sarkar at gmail.com
Thu May 6 15:09:57 CEST 2010
On Thu, May 6, 2010 at 6:24 PM, Marius Hofert <m_hofert at web.de> wrote:
> Thanks, Deepayan.
> Is it at least possible to increase the space between the panels in the following plot?:
> x=rep(c(1,2,3),4) # x values
> y=1:12 # y values
> z=rep(1:4,each=3) # panel number
par.settings = list(layout.widths = list(axis.panel = 2))
(similarly layout.heights for vertical gap).
> On 2010-05-06, at 13:53 , Deepayan Sarkar wrote:
>> On Thu, May 6, 2010 at 12:16 PM, Marius Hofert <m_hofert at web.de> wrote:
>>> Dear R experts,
>>> I have four plots I would like to plot attached to each other (in panels).
>>> All plots have the same x-scale, but different y-scales. The example below shows
>>> pretty much what I would like to have, except that for the two plots in the
>>> "second column" (of this 2x2 plot-matrix), I would like to have the y-ticks
>>> shown on the right side such that the four plot panels are attached to each other/glued
>>> together. How can I achieve this?
>> There is no easy way.
>> For the first step of a difficult way, see ?axis.default
>>> I found a solution for a 2x1 matrix in the R-help archive, but this problem here is different.
>>> Ps: I guess the "scales=..." should somehow go inside the panel function, so that
>>> the panel number tells the "alternating"-argument where it has to print the ticks.
>>> x=rep(c(1,2,3),4) # x values
>>> y=1:12 # y values
>>> z=rep(1:4,each=3) # panel number
>>> R-help at r-project.org mailing list
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help