Barbaglia, Guido (ESA)
2011-Apr-19 15:42 UTC
[R] Axes Alignment Problem for Multiple Plots
Dear all, I'm trying to plot, in the same window, two different series, using barplot() for the first one and plot() for the second. What happens is that the second chart has a different axes origin, therefore the final plot is wrong. This piece of code shows the differences between the values of par()$usr: barplot(coredata(Z0), beside=TRUE, ylim=c(0,100)); par()$usr; par(new=T); plot(coredata(Z0), ylim=c(0,100)); par()$usr; I would like to know how it is possible to edit the values of par()$usr[3:4] of the second chart in order to be the same of the first one or, alternatively, how can I plot together bar and line series within the same reference system. Best Regards Guido Barbaglia
What is Coredata(Z0)? It would be very useful. as the posting guidelines suggest to supply working code and sample data. --- On Tue, 4/19/11, Barbaglia, Guido (ESA) <Guido.Barbaglia at fao.org> wrote:> From: Barbaglia, Guido (ESA) <Guido.Barbaglia at fao.org> > Subject: [R] Axes Alignment Problem for Multiple Plots > To: "r-help at r-project.org" <r-help at r-project.org> > Cc: "Stigler, Matthieu (EST)" <Matthieu.Stigler at fao.org> > Received: Tuesday, April 19, 2011, 11:42 AM > Dear all, > > ???I'm trying to plot, in the same window, > two different series, using barplot() for the first one and > plot() for the second. What happens is that the second chart > has a different axes origin, therefore the final plot is > wrong. This piece of code shows the differences between the > values of par()$usr: > > ???barplot(coredata(Z0), beside=TRUE, > ylim=c(0,100)); > ???par()$usr; > ???par(new=T); > ???plot(coredata(Z0), ylim=c(0,100)); > ???par()$usr; > > I would like to know how it is possible to edit the values > of par()$usr[3:4] of the second chart in order to be the > same of the first one or, alternatively, how can I plot > together bar and line series within the same reference > system. > > > Best Regards > Guido Barbaglia > ______________________________________________ > R-help at r-project.org > mailing list > 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. >
Possibly Parallel Threads
- error with source(): invalid 'times' value
- converting a character matrix into numeric....
- (FULL) Need help to optimize a piece of code involving zoo objects
- Need help to optimize a piece of code involving zoo objects
- converting a character matrix into numeric....