I believe my dataframe is okay and my code is okay. In fact, I have eliminated parts of the dataframe and most of the graphing code to make things as basic as possible. But still, I get:
Error in .Call.graphics(C_palette2, .Call(C_palette2, NULL)) :
invalid graphics state
What is wrong here?Here is the data:
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
When I work with this data, I specify dates like this:
df<-df[order(as.Date(df$date,format="%d/%m/%Y")),,drop=FALSE]
and here I want to make a scatterplot:
ggplot(data = df,aes(x = date,y = val)) + geom_point(aes(group = trt))
I ran into this same error and solved it by running:
dev.off()
and then running the plot again. I think the graphics device was messed up earlier somehow by exporting some graphics and it didn’t get reset. This worked for me and it’s simpler than reinstalling ggplot2.
\
Read More:
- R ggplot Error in .Call.graphics(C_palette2, .Call(C_palette2, NULL)): invalid graphics state
- R language – error analysis – error in Call.graphics (C_ palette2, .Call(C_ palette2, NULL)) : invalid graphics state
- OpenGL basic graphics programming – OpenGL and 3D graphics world
- [solution] the system is running in low graphics mode
- Solve the problem that the header file of “graphics. H” cannot be loaded in vs2015
- 076_ OpenGL graphics program development practice
- C language string processing error warning, c4996, sprintf, predicted, c4996, strcpy, c4996, strcat
- Runtime error 5 Invalid procedure call or argument
- Graphics rendering pipeline diagram of OpenGL
- [181124] VC + + use OpenGL to draw 3D graphics example source code
- XNA 4 project running error: no suitable graphics card found
- 2016.11.1 OpenGL learning, black screen does not display graphics
- Solution to the problem of no C / C + + option in the new project of eclipse
- linux/tensorflow: failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE
- MPI cannot be found in C / C + +
- Solution to x service error when installing NVIDIA graphics driver under Ubuntu
- “The CC version check failed” is reported when Ubuntu installs NVIDIA graphics card driver
- Solve the problem of error: cannot pass objects of non trivially copyable type ‘STD:: String’ in C / C + +
- Configure Nvidia graphics card on ubuntu18.04 xrandr Failed to get size of gamma for output default