[R] fine control of plots after use of layout(matrix ...

Sarah Goslee sarah.goslee at gmail.com
Sun Jun 3 23:12:18 CEST 2012


On Sun, Jun 3, 2012 at 5:02 PM, Matthew Johnson <mcooganj at gmail.com> wrote:
> Thanks. The solution i have been persuing is reading Murrell - and
> trying to figure out grid / Viewport commands. Is it best to stay in
> the base graphics package if possible?

It really depends on what you need to do. Your original example used
plot, so I went with par.

Murrell's explanation of par() options is also very good.

Sarah

> On 04/06/2012, at 6:20 AM, Sarah Goslee <sarah.goslee at gmail.com> wrote:
>
>> On Sun, Jun 3, 2012 at 4:05 PM, Matthew Johnson <mcooganj at gmail.com> wrote:
>>> Thanks. So i can call par after the layout command? I did not realise.
>>
>> Some par options are set by calling par() directly, while others must
>> be included in the plot command itself.
>>
>> Sarah
>>
>>> Sent from my iPad
>>>
>>> On 03/06/2012, at 9:42 PM, Sarah Goslee <sarah.goslee at gmail.com> wrote:
>>>
>>>
>>>
>>> On Sunday, June 3, 2012, Matthew Johnson wrote:
>>>>
>>>> Sir,
>>>
>>>
>>> I'm no sir, but you need to spend some quality time reading ?par to lean
>>> abot axes and margins.
>>>
>>> Sarah
>>>
>>>>
>>>> I would like to create a combined line-bar plot, with the line up top and
>>>> bar plot below, but with the x-axes suppressed on the topmost plot, the
>>>> line and bar plot areas joined by a common line, and the x-axes (of dates)
>>>> joined to the bottom part of the bar plot.
>>>>
>>>> i have been able to format the area using the layout(matrix( ... commands,
>>>> but cannot figure out the final step.
>>>>
>>>> here's the code so far:
>>>>
>>>>
>>>> layout(matrix(c(1,2), 2, 1, byrow=TRUE), widths=c(3,3), heights=c(2,1))
>>>> plot(saDwlPx[,1])
>>>> barplot(saDwlMoM[,1])
>>>>
>>>> thanks + best regards
>>>>
>>>> matt johnson
>>>>
>>>
-- 
Sarah Goslee
http://www.sarahgoslee.com



More information about the R-help mailing list