[R] par function for barchart

Massimiliano Tripoli mtripoli at istat.it
Wed Jan 14 10:46:57 CET 2015


Dear R-users,
I can't put 1 x 2 pictures on one plot by using barchart function of lattice package.
I often use par function but I'm not able to do it.
This is my code and data: 

mydata <-
structure(list(REGIONE = c("ABRUZZO", "BOLZANO - BOZEN", "CALABRIA", 
"CAMPANIA", "EMILIA-ROMAGNA", "FRIULI-VENEZIA GIULIA", "LAZIO", 
"LIGURIA", "MARCHE", "MOLISE", "PIEMONTE", "PUGLIA", "SARDEGNA", 
"SICILIA", "TOSCANA", "TRENTO", "UMBRIA", "VALLE D'AOSTA", "VENETO"
), X1 = c(100, 100, 0, 100, 13.79, 0, 0, 100, 14.29, 100, 21.33, 
85.54, 95.04, 12.94, 0, 100, 0, 100, 100), X2 = c(0, 45.24, 0, 
11.76, 0, 0, 0, 0, 38.57, 0, 0, 0, 4.96, 0, 0, 0, 70.27, 0, 0
)), .Names = c("REGIONE", "X1", "X2"), class = "data.frame", row.names = c(NA, 
-19L))

require(lattice)

op <- par(mfrow=c(1,2))
barchart(REGIONE ~ X1,data=mydata,col="red")
barchart(REGIONE ~ X2,data=mydata,col="green")
par(op)

Can anyone help me, please?

Thanks,

Massimiliano
-- 
Massimiliano Tripoli 
Collaboratore T.E.R. scado il 31/12/2017 
ISTAT - DCCN - Direzione Centrale della Contabilità Nazionale 
U.O. Contabilità dei flussi di materia del sistema economico - CSA/C 
Via Depretis, 74/B 00184 Roma 
Tel. 06.4673.3132 
E-mail: mtripoli at istat.it 



More information about the R-help mailing list