[R] R plot split screen in uneven panels

Franklin Bretschneider bret@chr @ending from x@4@ll@nl
Wed Dec 12 17:45:31 CET 2018


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   40    0
> [2,]   20   60   40    0
>> 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 using 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
bretschr using xs4all.nl



More information about the R-help mailing list