[R] Set axis limits in mixtools plot
Mike Harwood
harwood262 at gmail.com
Thu Jan 6 16:28:13 CET 2011
Hello,
Can the x and y axis limits be specified in a density plot with the
mixtools package for a finite mixture model? Uncommenting the xlim2/
ylim2 lines in the plot command below generates 'not a graphical
parameter' warnings (and does not change the axis settings), and
uncommenting the xlim/ylim lines generates a 'formal argument "ylim"
matched by multiple actual arguments' error. I want to use a
consistent set of axis setting for four different sets of data.
Thanks!
test.data <-
c(0.0289,0.0342,0.0379,0.0405,0.0421,0.0429,0.0430,0.0426,0.0423
,
0.0425,0.0435,0.0451,0.0466,0.0477,0.0480,0.0477,0.0473,0.0473,0.0479
,
0.0492,0.0507,0.0519,0.0526,0.0523,0.0507,0.0482,0.0452,0.0428,0.0414
,
0.0409,0.0404,0.0388,0.0358,0.0319,0.0283,0.0263,0.0269,0.0298,0.0339
,
0.0378,0.0404,0.0417,0.0425,0.0436,0.0457,0.0489,0.0522,0.0544,0.0546
,
0.0529,0.0501,0.0474,0.0457,0.0454,0.0460,0.0467,0.0466,0.0450,0.0423
,
0.0395,0.0378,0.0377,0.0388,0.0401,0.0404,0.0394,0.0378,0.0366,0.0371
,
0.0395,0.0433,0.0474,0.0512,0.0546,0.0581,0.0622,0.0673,0.0729,0.0782
,
0.0824,0.0854,0.0877,0.0902,0.0934,0.0973,0.1009,0.1032,0.1038,0.1029
,
0.1017,0.1017,0.1034,0.1065,0.1099,0.1126,0.1137,0.1133,0.1123,0.1118
,
0.1124,0.1140,0.1159,0.1175,0.1182,0.1179,0.1170,0.1160,0.1153,0.1153
,
0.1159,0.1164,0.1161,0.1146,0.1118,0.1080,0.1038,0.1002,0.0976,0.0961
,
0.0954,0.0948,0.0940,0.0929,0.0920,0.0916,0.0921,0.0934,0.0951,0.0964
,
0.0964,0.0951,0.0925,0.0894,0.0864,0.0841,0.0827,0.0821,0.0819,0.0817
,
0.0814,0.0808,0.0797,0.0783,0.0768,0.0756,0.0749,0.0749,0.0752,0.0752
,
0.0743,0.0724,0.0694,0.0662,0.0635,0.0616,0.0607,0.0603,0.0600,0.0592
,
0.0580,0.0567,0.0553,0.0539,0.0522,0.0499,0.0470,0.0435,0.0394,0.0346
,
0.0290,0.0227,0.0160,0.0098,0.0045,0.0009,-0.0012,-0.0021,-0.0025,-0.0029
,-0.0038,-0.0052,-0.0074,-0.0103,-0.0141,-0.0189,-0.0246,-0.0308,-0.0370
,-0.0432,-0.0495,-0.0561,-0.0627,-0.0681,-0.0716,-0.0732,-0.0736,-0.0740
,-0.0750,-0.0760,-0.0758,-0.0732,-0.0677,-0.0603,-0.0531,-0.0481,-0.0459
,-0.0448,-0.0421,-0.0364,-0.0285,-0.0219,-0.0202,-0.0245,-0.0321,-0.0386
,-0.0399,-0.0352,-0.0272,-0.0206,-0.0187,-0.0220,-0.0280,-0.0330
)
library(mixtools)
fit <- normalmixEM(test.data)
plot(fit
,whichplots=2
# ,xlim2=c(-0.1, 0.15)
# ,ylim2=c(0, 20)
# ,xlim=c(-0.1, 0.15)
# ,ylim=c(0, 20)
)
grid()
More information about the R-help
mailing list