gghdr icon indicating copy to clipboard operation
gghdr copied to clipboard

Add conditional density estimation

Open sparce opened this issue 5 years ago • 7 comments

Started in 91eeaf096da884c3167416dea56ea1610f958a65, but needs some testing because I'm sure I've broken something unexpected.

No x

ggplot(faithful, aes(y = waiting)) + 
    geom_hdr_boxplot(fill="steelblue") + 
    theme_minimal()

no_x

Categorical x

ggplot(faithful, aes(x = eruptions > 3, y = waiting)) + 
    geom_hdr_boxplot(fill="steelblue") + 
    theme_minimal()

factor_x

Numeric x

ggplot(faithful, aes(x = eruptions, y = waiting)) + 
    geom_hdr_boxplot(fill="steelblue") + 
    theme_minimal()

numeric_x

with overlaid points for good measure

ggplot(faithful, aes(x = eruptions, y = waiting)) + 
    geom_hdr_boxplot(fill="steelblue") + 
    geom_point(alpha = 0.3) +
    theme_minimal()

numeric_x_with_points

sparce avatar Dec 16 '19 01:12 sparce

These look awesome! 👍

thomas-fung avatar Dec 16 '19 01:12 thomas-fung

Amazing! :bee:

mitchelloharawild avatar Dec 16 '19 01:12 mitchelloharawild

That looks beautiful! What else is missing from @mitchelloharawild original design implementation?

dvanic avatar Dec 16 '19 01:12 dvanic

Good question @dvanic, I can't quite read that whiteboard pic in the other repo 😀 Maybe we should start another issue here for that discussion.

sparce avatar Dec 18 '19 01:12 sparce

Hi @sparce could you push these changes to the repo so that I can test it? Right now with the following code it says - ggplot(faithful, aes(x = eruptions, y = waiting)) + geom_hdr_boxplot(fill="steelblue") + theme_minimal() gives the error message

Warning messages: 1: Continuous x aesthetic -- did you forget aes(group=...)? 2: Computation failed in stat_hdrcde(): Conditional density estimation is not yet supported. Make sure each plot group contains only one x value.

Sayani07 avatar Feb 20 '20 03:02 Sayani07

@Sayani07 are you trying in the cde branch?

sparce avatar Feb 20 '20 04:02 sparce

Oh no! Thank you

Sayani07 avatar Feb 20 '20 04:02 Sayani07