How to use geom_freqpoly in R for a frequency distribution?

322 Views Asked by At

I have a large dataframe with polygons (>40 000 records) called data. Each polygon has a certain area with values between 1000 m² and 1096345 m². The smallest polygons are the most frequent. I want to show the frequency distribution in a line plot, instead of a histogram. So the x-axis should be the area in logarithmic scale - so from 1000 to 1100000 and then you have the y-axis. I don't think it's needed to make that axis logarithmic.

So far this is my code:

ggplot(data, aes(x = area)) +
  geom_freqpoly()+
  scale_x_log10() +
  theme_minimal()

And then the plot looks like this: enter image description here

But I don't know whether this is correct. I think the code isn't complete. When I add the binwidth, it shows weird plots. How can I complete the code, or are there better solutions then using geom_freqpoly?

0

There are 0 best solutions below