Re: [R] R plot split screen in uneven panels

2018-12-13 Thread Luigi Marongiu
Thank you, that worked good. I tried to read the help for
layout/split.screen but I found it confusing.
On Wed, Dec 12, 2018 at 5:51 PM Bert Gunter  wrote:
>
> Incidentally, here is another way to do what (I think) you asked using 
> layout():
>
> m <- matrix(c(1,2,2), nrow =1)
> layout(m)
> plot(1:10, type = "p",main = "The First Plot")
> plot(10:1, type = "l", main ="The Second Plot")
>
> On my device, the plots use different size fonts, point sizes, etc. and so 
> aesthetically differ. I do not know why and am too lazy to delve into the 
> code.
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and 
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Wed, Dec 12, 2018 at 8:39 AM Bert Gunter  wrote:
>>
>> ?layout
>> Please read the Help file **carefully** and work through the **examples**. I 
>> cannot explain better than they.
>> Here is code using layout() that I think does what you want:
>>
>> m <- matrix(1:2, nrow =1)
>> layout(m, widths = c(1,2))
>> plot(1:10, type = "p",main = "The First Plot")
>> plot(10:1, type = "l", main ="The Second Plot")
>>
>> Note that both the lattice package and ggplot2 can also do this sort of 
>> thing much more flexibly(and therefore requiring more effort to learn).
>>
>> Cheers,
>> Bert
>>
>>
>> Bert Gunter
>>
>> "The trouble with having an open mind is that people keep coming along and 
>> sticking things into it."
>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>>
>>
>> On Wed, Dec 12, 2018 at 7:19 AM Luigi Marongiu  
>> wrote:
>>>
>>> Dear all,
>>> I would like to draw two plots in the same device so that there is a
>>> single row and two columns, with the first column being 1/3 of the
>>> device's width.
>>> I am creating a PNG object with width = 30 and height = 20 cm.
>>> I know that I should use split.screen or layout but I am lost with the
>>> matrix to pass to the functions.
>>> For istance, I tried:
>>> # distance in arbitrary units (so let's say cm) from of corners
>>> # left, right, bottom, and top counting from bottom left corner
>>> # that is first panel has the bottom right corner 20 cm from the bottom 
>>> left?
>>> > m = matrix(c(0,20,40,0, 20,60,40,0), byrow=T, ncol=4)
>>> > m
>>>  [,1] [,2] [,3] [,4]
>>> [1,]0   20   400
>>> [2,]   20   60   400
>>> > split.screen(m)
>>> Error in par(split.screens[[cur.screen]]) :
>>>   invalid value specified for graphical parameter "fig"
>>> > m[1,]
>>> [1]  0 20 40  0
>>> > split.screen(m[1,])
>>> Error in split.screen(m[1, ]) : 'figs' must specify at least one screen
>>>
>>> What should be the syntax for this task?
>>>
>>> --
>>> Best regards,
>>> Luigi
>>>
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.



-- 
Best regards,
Luigi

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R plot split screen in uneven panels

2018-12-13 Thread Martin Maechler
> Bert Gunter 
> on Wed, 12 Dec 2018 08:51:04 -0800 writes:

> Incidentally, here is another way to do what (I think) you asked using
> layout():

> m <- matrix(c(1,2,2), nrow =1)
> layout(m)
> plot(1:10, type = "p", main ="The First Plot")
> plot(10:1, type = "l", main ="The Second Plot")

> On my device, the plots use different size fonts, point sizes, etc. and so
> aesthetically differ. 

Really? -- Not at all for me [Linux default device =
X11(type="cairo")], where all these are identical on the left
and the right plot.

Such behavior seems like a bogous graphics device  or
bogous interaction with underlying libraries or ??

> I do not know why and am too lazy to delve into the code.
> Bert Gunter

Can you at least tell us a bit more, e.g.

  dev.capabilities()
?

Best, Martin

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R plot split screen in uneven panels

2018-12-12 Thread Bert Gunter
Incidentally, here is another way to do what (I think) you asked using
layout():

m <- matrix(c(1,2,2), nrow =1)
layout(m)
plot(1:10, type = "p",main = "The First Plot")
plot(10:1, type = "l", main ="The Second Plot")

On my device, the plots use different size fonts, point sizes, etc. and so
aesthetically differ. I do not know why and am too lazy to delve into the
code.

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Dec 12, 2018 at 8:39 AM Bert Gunter  wrote:

> ?layout
> Please read the Help file **carefully** and work through the **examples**.
> I cannot explain better than they.
> Here is code using layout() that I think does what you want:
>
> m <- matrix(1:2, nrow =1)
> layout(m, widths = c(1,2))
> plot(1:10, type = "p",main = "The First Plot")
> plot(10:1, type = "l", main ="The Second Plot")
>
> Note that both the lattice package and ggplot2 can also do this sort of
> thing much more flexibly(and therefore requiring more effort to learn).
>
> Cheers,
> Bert
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Wed, Dec 12, 2018 at 7:19 AM Luigi Marongiu 
> wrote:
>
>> Dear all,
>> I would like to draw two plots in the same device so that there is a
>> single row and two columns, with the first column being 1/3 of the
>> device's width.
>> I am creating a PNG object with width = 30 and height = 20 cm.
>> I know that I should use split.screen or layout but I am lost with the
>> matrix to pass to the functions.
>> For istance, I tried:
>> # distance in arbitrary units (so let's say cm) from of corners
>> # left, right, bottom, and top counting from bottom left corner
>> # that is first panel has the bottom right corner 20 cm from the bottom
>> left?
>> > m = matrix(c(0,20,40,0, 20,60,40,0), byrow=T, ncol=4)
>> > m
>>  [,1] [,2] [,3] [,4]
>> [1,]0   20   400
>> [2,]   20   60   400
>> > split.screen(m)
>> Error in par(split.screens[[cur.screen]]) :
>>   invalid value specified for graphical parameter "fig"
>> > m[1,]
>> [1]  0 20 40  0
>> > split.screen(m[1,])
>> Error in split.screen(m[1, ]) : 'figs' must specify at least one screen
>>
>> What should be the syntax for this task?
>>
>> --
>> Best regards,
>> Luigi
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R plot split screen in uneven panels

2018-12-12 Thread Franklin Bretschneider
Dear Luigi Marongiu,


Re: 

> Dear all,
> I would like to draw two plots in the same device so that there is a
> single row and two columns, with the first column being 1/3 of the
> device's width.
> I am creating a PNG object with width = 30 and height = 20 cm.
> I know that I should use split.screen or layout but I am lost with the
> matrix to pass to the functions.
> For istance, I tried:
> # distance in arbitrary units (so let's say cm) from of corners
> # left, right, bottom, and top counting from bottom left corner
> # that is first panel has the bottom right corner 20 cm from the bottom left?
>> m = matrix(c(0,20,40,0, 20,60,40,0), byrow=T, ncol=4)
>> m
> [,1] [,2] [,3] [,4]
> [1,]0   20   400
> [2,]   20   60   400
>> split.screen(m)
> Error in par(split.screens[[cur.screen]]) :
>  invalid value specified for graphical parameter "fig"
>> m[1,]
> [1]  0 20 40  0
>> split.screen(m[1,])
> Error in split.screen(m[1, ]) : 'figs' must specify at least one screen
> 
> What should be the syntax for this task?
> 
> -- 
> Best regards,
> Luigi
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Screen parrts shoeld be fractions (0 ...1), not percentages.
And bottom first, so ...

m = matrix(c(0,20,0,40, 20,60,0,40)/100, byrow=T, ncol=4)

 ... will work.

Success and
Best regards,

Franklin
---

Franklin Bretschneider
Dept of Biology
Utrecht University
brets...@xs4all.nl

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R plot split screen in uneven panels

2018-12-12 Thread Bert Gunter
?layout
Please read the Help file **carefully** and work through the **examples**.
I cannot explain better than they.
Here is code using layout() that I think does what you want:

m <- matrix(1:2, nrow =1)
layout(m, widths = c(1,2))
plot(1:10, type = "p",main = "The First Plot")
plot(10:1, type = "l", main ="The Second Plot")

Note that both the lattice package and ggplot2 can also do this sort of
thing much more flexibly(and therefore requiring more effort to learn).

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Dec 12, 2018 at 7:19 AM Luigi Marongiu 
wrote:

> Dear all,
> I would like to draw two plots in the same device so that there is a
> single row and two columns, with the first column being 1/3 of the
> device's width.
> I am creating a PNG object with width = 30 and height = 20 cm.
> I know that I should use split.screen or layout but I am lost with the
> matrix to pass to the functions.
> For istance, I tried:
> # distance in arbitrary units (so let's say cm) from of corners
> # left, right, bottom, and top counting from bottom left corner
> # that is first panel has the bottom right corner 20 cm from the bottom
> left?
> > m = matrix(c(0,20,40,0, 20,60,40,0), byrow=T, ncol=4)
> > m
>  [,1] [,2] [,3] [,4]
> [1,]0   20   400
> [2,]   20   60   400
> > split.screen(m)
> Error in par(split.screens[[cur.screen]]) :
>   invalid value specified for graphical parameter "fig"
> > m[1,]
> [1]  0 20 40  0
> > split.screen(m[1,])
> Error in split.screen(m[1, ]) : 'figs' must specify at least one screen
>
> What should be the syntax for this task?
>
> --
> Best regards,
> Luigi
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.