R: Plot Density Graph for data in tables with respect to Labels in tables -
i got data in table form in r:
v1 v2 1 19 -1539 2 7 -1507 3 3 -1446 4 7 -1427 5 8 -1401 6 2 -422 7 22 4178 8 5 4277 9 10 4303 10 18 4431 ....200 million more lines go
i plot density plot value in second column respect label in first column (i.e. each label has on density curve on same graph). don't know how. suggestion?
if understood question correctly, end density heatmap in end. (considering there 200 million observations total , v1 has considerable range of variation)
for try ggplot
, stat_binhex
:
df <- read.table(text="v1 v2 1 19 -1539 2 7 -1507 3 3 -1446 4 7 -1427 5 8 -1401 6 2 -422 7 22 4178 8 5 4277 9 10 4303 10 18 4431") library(ggplot2) ggplot(data=df,aes(v1,v2)) + stat_binhex() + scale_fill_gradient(low="red", high="steelblue") + scale_y_continuous() + theme_bw()
stat_binhex
should work large data , has several parameters presentation (like bins
, binwidth
. see ?stat_binhex
)
Comments
Post a Comment