Is there any possibility to keep the groups of every lattice graph with
the doubleYScale function ?
Or, might you give me some orientations to realize the graph keeping the
groups using the lattice package ?
Thank you
Best regards
Laurent
#-----o<------------------------------------------------------------------------------>o-----------------
library(lattice)
library(latticeExtra)
##
## creation of the first lattice graph gr_Gx with a group of two elements
##
lattice.par <- trellis.par.get()
my.superpose.line <- lattice.par$superpose.line
my.superpose.line$col[1:2] <- c("black","red")
gr_Gx <- xyplot( value ~ time | region
, data = df.m
, subset = sensor %in% c("G2","G4")
, group = sensor
, type ="l"
, scales = list( y = list(log=10)
, x = list(relation="free", axs =
"i", abbreviate=TRUE))
, yscale.components = yscale.components.log10ticks
, par.settings = list(
superpose.line = my.superpose.line
)
)
print(gr_Gx)
##
## creation of the second lattice graph gr_Tx with a group of five elements
##
lattice.par <- trellis.par.get()
my.superpose.line <- lattice.par$superpose.line
my.superpose.line$col[1:5] <- c(1,2,3,4,5)
gr_Tx <- xyplot( value ~ time | region
, group = sensor
, subset = sensor %in% c("T1","T2","T3","T4","T5")
, data= df.m
, type = "l"
, scales = list( x= list( axs = "i", relation = "free"
, abbreviate = TRUE))
, par.settings = list( superpose.line =
my.superpose.line )
)
print(gr_Tx)
##
## overlap the two lattice graphs
## We lost the groups of every lattice
##
gr_Gx_Tx <- latticeExtra::doubleYScale(gr_Gx, gr_Tx)
print(gr_Gx_Tx)
#----o<------------------------------------------------------------------------------>o-----------------
The data :
df.m <- structure(list(time = c(0.000250101089477539, 0.000250101089477539,
0.000250101089477539, 0.000250101089477539, 0.000250101089477539,
0.000250101089477539, 0.000250101089477539, 0.000500202178955078,
0.000500202178955078, 0.000500202178955078, 0.000500202178955078,
0.000500202178955078, 0.000500202178955078, 0.000500202178955078,
0.000750064849853516, 0.000750064849853516, 0.000750064849853516,
0.000750064849853516, 0.000750064849853516, 0.000750064849853516,
0.000750064849853516, 0.00100016593933105, 0.00100016593933105,
0.00100016593933105, 0.00100016593933105, 0.00100016593933105,
0.00100016593933105, 0.00100016593933105, 0.00125002861022949,
0.00125002861022949, 0.00125002861022949, 0.00125002861022949,
0.00125002861022949, 0.00125002861022949, 0.00125002861022949,
0.00150012969970703, 0.00150012969970703, 0.00150012969970703,
0.00150012969970703, 0.00150012969970703, 0.00150012969970703,
0.00150012969970703, 0.00175023078918457, 0.00175023078918457,
0.00175023078918457, 0.00175023078918457, 0.00175023078918457,
0.00175023078918457, 0.00175023078918457, 0.00200009346008301,
0.00200009346008301, 0.00200009346008301, 0.00200009346008301,
0.00200009346008301, 0.00200009346008301, 0.00200009346008301,
0.00225019454956055, 0.00225019454956055, 0.00225019454956055,
0.00225019454956055, 0.00225019454956055, 0.00225019454956055,
0.00225019454956055, 0.00250005722045898, 0.00250005722045898,
0.00250005722045898, 0.00250005722045898, 0.00250005722045898,
0.00250005722045898, 0.00250005722045898, 0.00275015830993652,
0.00275015830993652, 0.00275015830993652, 0.00275015830993652,
0.00275015830993652, 0.00275015830993652, 0.00275015830993652,
0.00300002098083496, 0.00300002098083496, 0.00300002098083496,
0.00300002098083496, 0.00300002098083496, 0.00300002098083496,
0.00300002098083496, 0.0032501220703125, 0.0032501220703125,
0.0032501220703125, 0.0032501220703125, 0.0032501220703125,
0.0032501220703125,
0.0032501220703125, 0.00350022315979004, 0.00350022315979004,
0.00350022315979004, 0.00350022315979004, 0.00350022315979004,
0.00350022315979004, 0.00350022315979004, 0.00375008583068848,
0.00375008583068848, 0.00375008583068848, 0.00375008583068848,
0.00375008583068848, 0.00375008583068848, 0.00375008583068848,
0.00400018692016602, 0.00400018692016602, 0.00400018692016602,
0.00400018692016602, 0.00400018692016602, 0.00400018692016602,
0.00400018692016602, 0.00425004959106445, 0.00425004959106445,
0.00425004959106445, 0.00425004959106445, 0.00425004959106445,
0.00425004959106445, 0.00425004959106445, 0.00450015068054199,
0.00450015068054199, 0.00450015068054199, 0.00450015068054199,
0.00450015068054199, 0.00450015068054199, 0.00450015068054199,
0.00475001335144043, 0.00475001335144043, 0.00475001335144043,
0.00475001335144043, 0.00475001335144043, 0.00475001335144043,
0.00475001335144043), sensor = c("G2", "G4", "T1", "T2", "T3",
"T4", "T5", "G2", "G4", "T1", "T2", "T3", "T4", "T5", "G2", "G4",
"T1", "T2", "T3", "T4", "T5", "G2", "G4", "T1", "T2", "T3", "T4",
"T5", "G2", "G4", "T1", "T2", "T3", "T4", "T5", "G2", "G4", "T1",
"T2", "T3", "T4", "T5", "G2", "G4", "T1", "T2", "T3", "T4", "T5",
"G2", "G4", "T1", "T2", "T3", "T4", "T5", "G2", "G4", "T1", "T2",
"T3", "T4", "T5", "G2", "G4", "T1", "T2", "T3", "T4", "T5", "G2",
"G4", "T1", "T2", "T3", "T4", "T5", "G2", "G4", "T1", "T2", "T3",
"T4", "T5", "G2", "G4", "T1", "T2", "T3", "T4", "T5", "G2", "G4",
"T1", "T2", "T3", "T4", "T5", "G2", "G4", "T1", "T2", "T3", "T4",
"T5", "G2", "G4", "T1", "T2", "T3", "T4", "T5", "G2", "G4", "T1",
"T2", "T3", "T4", "T5", "G2", "G4", "T1", "T2", "T3", "T4", "T5",
"G2", "G4", "T1", "T2", "T3", "T4", "T5"), value = c(0.82246387,
0.087782182, 279.797452, 280.4561376, 279.0974149, 280.4561376,
280.0033092, 0.497085421, 0.09618856, 279.6739299, 280.1679832,
278.8502975, 280.8265749, 279.9621391, 0.553148733, 0.081679087,
279.7151046, 280.0856475, 279.7562786, 281.9787114, 280.2914819,
0.642081754, 0.089700232, 279.7151046, 280.2914819, 280.7854178,
279.3033279, 279.7562786, 0.398027343, 0.094197026, 279.9209683,
280.3326468, 281.3204096, 280.0444787, 280.1268157, 0.759092342,
0.087119837, 279.9621391, 280.4149746, 281.4850005, 279.5092244,
280.373811, 0.289783197, 0.090064786, 279.9621391, 280.4149746,
280.9911968, 278.6443482, 279.797452, 0.517901378, 0.094528963,
279.9209683, 280.6619426, 279.7562786, 281.1969597, 280.3326468,
0.708271104, 0.095114161, 279.7151046, 280.5384615, 279.1797821,
280.4561376, 279.9209683, 1.178671343, 0.099874465, 279.797452,
280.0856475, 279.0150451, 280.9500423, 279.8797969, 1.101495437,
0.102470373, 279.9209683, 280.1679832, 279.6739299, 281.8964327,
280.4561376, 0.659228704, 0.096755622, 279.6327545, 280.0444787,
280.5384615, 279.2209647, 279.797452, 0.884443388, 0.102303788,
279.7562786, 280.2503163, 281.2792603, 280.0444787, 280.1268157,
0.836088938, 0.101041082, 280.1268157, 280.5384615, 281.4438538,
279.4680464, 280.3326468, 1.249971134, 0.107426276, 280.1268157,
280.5384615, 280.9911968, 278.4383823, 279.8386248, 0.827054859,
0.100433257, 279.797452, 280.4149746, 280.0033092, 281.2792603,
280.2091501, 0.817296467, 0.10996377, 279.7562786, 280.2914819,
279.2621466, 280.4561376, 279.9621391, 0.449069929, 0.109872197,
279.7151046, 280.1268157, 278.9326726, 280.8677313, 280.0033092,
0.711569413, 0.115516437, 279.8797969, 280.0444787, 279.6327545,
282.0198498, 280.4149746), region = structure(c(1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L), levels = c("[0.00025,0.001]", "(0.001,0.002]", "(0.002,0.003]",
"(0.003,0.004]", "(0.004,0.00475]"), class = "factor"))
, row.names = c(NA,-133L), class = c("tbl_df", "tbl", "data.frame"))
--
Cet e-mail a été vérifié par le logiciel antivirus d'Avast.
www.avast.com
______________________________________________
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.