Hello,

I'm producing multiple dotcharts and I want each plotting area (the area
containing the dots only- not the labels) to be the same width. Currently,
the width of the area depends on the length of the labels. I've tried
different margin arguments but they change the parameter of the whole plot
(dots + labels) rather than just the dot area.

A reproducible example is below; I want the dot area to be the same
physical width across charts regardless of the label width. Any suggestions
would be greatly appreciated!

Ryan Derickson


library(Hmisc)
pdf("dotchart2 demo.pdf")

# This plot width is wider

par(omi=c(0, 2, 0, 0), mar=c(2,4,1,1))

num<-rnorm(40, 0, 1)
lab<-paste(rep(letters[1:20],2),rep(letters[1:20],2),rep(letters[1:20],2),rep(letters[1:20],2)

 
,rep(letters[1:20],2),rep(letters[1:20],2),rep(letters[1:20],2),rep(letters[1:20],2),
sep="")

dat<-data.frame(num, lab)
dat<-dat[order(num),]

dotchart2(dat$num, label=dat$lab, xlim=c(-3,3))


# This plot width is narrower

par(omi=c(0, 2, 0, 0), mar=c(2,4,1,1))

num<-rnorm(40, 0, 1)
lab<-paste(rep(letters[1:20],2),rep(letters[1:20],2),rep(letters[1:20],2),rep(letters[1:20],2),
sep="")

dat<-data.frame(num, lab)
dat<-dat[order(num),]

dotchart2(dat$num, label=dat$lab, xlim=c(-3,3))

dev.off()

        [[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.

Reply via email to