Reputation: 306
I recently tried to reproduce the Crime in Downtown Houston, Texas made by David Kahle, in order to reproduce it for another analysis later on.
Everything works well, and I can generate map as I want... However, there is an issue I cannot explain.
When I try to save the file at a larger format (let's say, 4500x1546 instead of the normal 1266x435), the size of the points, axis, title, legend etc. do not automatically adjust : they become way too small. To illustrate this:
First image= 1200x435 (normal format), second image= 4500x1546 (adjusted format),
I observe the same effect with a geom_density plot..
I guess the solution is really trivial, but I didn't find it...
Upvotes: 0
Views: 208
Reputation: 60964
If you want to create a higher resolution png there are two approaches:
You chose the second solution, this makes all the elements smaller, which is expected behavior. If you want to increase the resolution without changing the elements, increase the dpi. This can easily be done using ggsave
:
g = ggplot(...)
# low res png
ggsave("lowres.png", width = 6, height = 6, dpi = 50)
# high res png
ggsave("hires.png", width = 6, height = 6, dpi = 600)
In this way there is no need to work with base_size
.
Upvotes: 1