codebox icon indicating copy to clipboard operation
codebox copied to clipboard

table.graph.r does not work with par(mfrow=c(1,2)) multi-graph-display

Open flberger opened this issue 8 years ago • 1 comments

I am trying to display two table graphs side by side using par(mfrow=c(1,2)). However, the result displays only one graph, on the left side.

I've also tried to add , mfrow=c(1,2) to the first or both calls to table.graph(), but to no avail.

It would be convenient if table.graph honored mfrow, or offered another way to support side-by-side plots.

flberger avatar Feb 21 '17 14:02 flberger

This plot make heavy use of par and margin to fit all the text. par(mfrow=c(1,2)) will not work properly. You can use split.screen like so:

source('table.graph.r')
def.par <- par(no.readonly = TRUE)
split.screen(c(1,2))
table.graph(WorldPhones[,1:2], label.cex=0.7, title.cex=1.2, mar=c(5, 5, 1, 5))
par(def.par)
screen(2)
table.graph(WorldPhones[,1:2], label.cex=0.7, title.cex=1.2, mar=c(5, 5, 1, 5))

example: http://imgur.com/a/CQZjL

bobthecat avatar Mar 01 '17 12:03 bobthecat