[R] Axes Alignment Problem for Multiple Plots

Barbaglia, Guido (ESA) Guido.Barbaglia at fao.org
Tue Apr 19 17:42:24 CEST 2011


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


More information about the R-help mailing list