Reputation: 23
I want to make a simple dot plot with solid circles using ggplot2 geom_point(). Interestingly, however, they are not 'perfect' circles when I copy-pasted the plot in a PDF software and scaled-up the image. It's done in Rstudio using export menu "copy to clipboard..." as metafile.
Of the pch values 16, 19, and 20 for solid circles, 16 makes circles with pixelated rough surface; 19 and 20 seem to make circles with off-centered circle fill.
Unfortunately, it looks like I am not allowed to upload images yet as a new user. But I had the same/similar result with the simple script below. currently, I'm using R version 3.6.1 (build 18362) and ggplot2_3.2.1
Am I the only one having this issue with ggplot2?
# made an example data frame
plot_test <- data.frame(x = c(1:5), y = c(2:6))
# plot the data frame using ggplot2
require(ggplot2)
ggplot(plot_test, aes(x = x, y = y)) +
geom_point(shape = 19, aes(size = x)) # 16, 19, or 20 for solid circle
Upvotes: 2
Views: 1968
Reputation: 6106
Save the plot to svg to create "perfect" infinitely zoom-able circle.
library(svglite)
p <- ggplot(plot_test, aes(x = x, y = y)) +
geom_point(shape = 19, aes(size = x))
ggsave(file="test.svg", plot=p)
Upvotes: 4