When I use geom_segment it's pixelized compared to a geom_abline. When I export to pdf with ggsave it's not vectorized.
geom_abline :
geom_segment :
Any idea how to solve this ?
Thanks
When I use geom_segment it's pixelized compared to a geom_abline. When I export to pdf with ggsave it's not vectorized.
geom_abline :
geom_segment :
Any idea how to solve this ?
Thanks
Copyright © 2021 Jogjafile Inc.
Yes, short answer: use
annotate()
instead ofgeom_segment()
.Long(er) answer, whever you use
geom_segment()
, you are mapping every row in your data to the aesthetics (in this case coordinates) of the geom. Hence, they PDF from thegeom_segment()
containsnrow(your_data)
lines on top of each other, giving that pixelated impression.You can see this happening if you inspect the layer data of plots. Note especially the layer data of the second plot.
Created on 2020-10-01 by the reprex package (v0.3.0)