开发者

R ggplot2 - no background or grid lines in plot with RGui

开发者 https://www.devze.com 2022-12-17 20:47 出处:网络
I\'m having a strange problem with the output window in RGui (under Win XP). I should see a plot like the one below...

I'm having a strange problem with the output window in RGui (under Win XP). I should see a plot like the one below...

R ggplot2 - no background or grid lines in plot with RGui

... when I run this script:

library(ggplot2)
x <- rnorm(100,0,1)
y <- rnorm(100,0,1)
z <- data.frame(开发者_Go百科x,y) 
g <- ggplot(z, aes(x,y)) + geom_point() + theme_gray()

Instead, in the plot window it shows a white background and white grid lines, like below.

R Plot Window

R ggplot2 - no background or grid lines in plot with RGui

When I export the plot to .png and I "preview" it in windows explorer - it doesn't show a background or grid lines.

Png in Windows

R ggplot2 - no background or grid lines in plot with RGui

Same Png in Gimp

R ggplot2 - no background or grid lines in plot with RGui

Same Png uploaded to image hosting

R ggplot2 - no background or grid lines in plot with RGui

Any ideas about what's going on? How can I get the plot to display correctly in RGui?


Sounds like a problem with the device rather than R, try reinstalling GTK+. If that doesn't work try plotting jpegs instead of png's if you can.

0

精彩评论

暂无评论...
验证码 换一张
取 消