. Advertisement .
..3..
. Advertisement .
..4..
I’m trying to run a new project. I do a couple of things like this:
date trt var val
1/8/2008 cc sw5 0.2684138
1/8/2008 cc sw15 0.2897586
1/8/2008 cc sw5 0.2822414
2/8/2008 cc sw5 0.2494583
2/8/2008 cc sw5 0.2692917
2/8/2008 cc sw15 0.2619167
2/8/2008 cc sw5 0.204375
3/8/2008 cc sw5 0.2430625
3/8/2008 cc sw5 0.2654375
3/8/2008 cc sw5 0.2509583
3/8/2008 cc sw5 0.2055625
1/8/2008 ccw sw15 0.2212414
1/8/2008 ccw sw5 0.3613448
1/8/2008 ccw sw5 0.2607586
2/8/2008 ccw sw5 0.2087917
2/8/2008 ccw sw15 0.3390417
2/8/2008 ccw sw5 0.2436458
2/8/2008 ccw sw5 0.290875
3/8/2008 ccw sw5 0.20175
3/8/2008 ccw sw15 0.328875
3/8/2008 ccw sw5 0.2328958
3/8/2008 ccw sw5 0.2868958
df<-df[order(as.Date(df$date,format="%d/%m/%Y")),,drop=FALSE]
ggplot(data = df,aes(x = date,y = val)) +
geom_point(aes(group = trt))
But in my program, I am getting the warning:
Error in .Call.graphics(C_palette2, .Call(C_palette2, NULL)) :
invalid graphics state
Can someone explain why the “error in .call.graphics(c_palette2, .call(c_palette2, null)): invalid graphics state” issue happened? Where have I gone wrong? Thank you!
The cause: The error invalid graphics state occurs as the present plot window is too small to satisfy the requirements of the displayed plot.
Solution: You should expand the plot window by deleting all the plots in the console to create a large plot area. Then, the graphics state will not be reported error anymore.
This happens when you combine ggplot and plot charts within the same session. Paul suggested a solution: “dev.off”.