Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 208511

change of histogram to line plot by ggplot

$
0
0

I need to plot the geom_histogram but as the plots overlap, I want to plot it linear instead of bars, i.e, the x=hp, y=count (percent). Can anybody please help me find how to do it.

library(ggplot2)
library(scales)

ggplot(mtcars, aes(x=hp)) + 
  geom_histogram(binwidth=5)

I have done it by qplot but I need to do it in ggplot and the percent.

  qplot(hp, data = mtcars, geom = "freqpoly", binwidth = 10)

Thanks


Viewing all articles
Browse latest Browse all 208511

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>