When I view this bar plot in R Studio, it appears as I intended (this is from a screenshot):
However, when I use the ggsave("filename.png")
function, it appears with light-colored lines overlaid (may have to look closely to see):
I'm using R
version 3.2.3, ggplot2
version 2.00, and R Studio version 0.99.486, on OS X 10.11.3.
Why might this be happening?
You should check out the Cairo
library. I use it for crisp graphics in presentations and reports.
Cairo initializes a new graphics device that uses the cairo graphics library for rendering. The current implementation produces high-quality PNG, JPEG, TIFF bitmap files, high resolution PDF files with embedded fonts, SVG graphics and PostScript files. It also provides X11 and Windows interactive graphics devices. Unlike other devices it supports all graphics features including alpha blending, anti-aliasing etc.
I can't reproduce your example, but here's a similar one.
library("ggplot2")
pl <- ggplot(aggregate(mpg ~ cyl, mtcars, FUN=mean),
aes(x = cyl, y = mpg)) +
geom_bar(stat="identity", fill="red3") +
theme_bw()
library("Cairo")
CairoPNG("CairoCarPlot.png")
pl
dev.off()
Throwing this out there in case it helps anyone else. I had this same issue when the stacked bar chart was made up of multiple values, I fixed it by grouping and then summarizing. I think for your data it would be: df <- dataframe %>% group_by(Weekday) %>% summarize(percent=sum( percentage of tweets
))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.