Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Plotting quantile lines in a scatter plot

$
0
0

@shashwat.2014 wrote:

I am currently doing a course on data exploration. In that course, I had to draw quantile lines in a scatter plot, joining the points in the scatter plot that denoted a percentage of 'friend_count' (say 10%) for different 'ages'.

For calculating the line joining the means,
ggplot(pf,aes(x=age,y=friend_count))+geom_point(alpha=1/20,position=position_jitter(h=0), color='yellow')+xlim(13,90)+coord_trans(y='sqrt')+
+ geom_line(stat = 'summary', fun.y=mean)

this worked perfectly. But for 20% quantile lines, according to the course the code is :
ggplot(pf,aes(x=age,y=friend_count))+geom_point(alpha=1/20,position=position_jitter(h=0), color='yellow')+xlim(13,90)+coord_trans(y='sqrt')+
+ geom_line(stat = 'summary', fun.y=mean)+geom_line(stat='summary', fun.y=quantile(pf$friend_count,probs=0.2) )

However, it shows error message, 'unknown parameter :probs'

Please try it and tell if I have made any mistake. I checked the documentation of quantile, and probs is a valid parameter.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles