I have an ggplot2 point chart created like this
qplot(Index, Popularity ,data = data.slopeone.agg)
now I would like to add a vertical line at the half of all data points. In other words, where the integral is 0.5. I want add this line to see wich part of the data makes 50%.
How can I achieve this in R? I know about geom_vline but don’t know how to determine the positon of the vline.
The data is structured like this:
Each row has an ItemId the popularity of this item and an index for my chart to display the values sorted by popularity.
head(data.slopeone.agg)
Item Popularity Index
184 258 0.07695880 1
29 50 0.07294129 2
121 181 0.07162558 3
203 286 0.07030986 4
225 313 0.06500478 5
65 100 0.06366796 6
my chart looks like this: http://img838.imageshack.us/img838/3194/popt.png
I now found out how to solve my problem. Maybe it’s not the most elegant way:
define a function to get the 50% of popularity data vertical line position
If somebody knows a more elegant way, feel free to post it. But maybe my question is now more understandable 😉