Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd mark_density() #27

Open
earowang opened this issue Jan 28, 2021 · 8 comments
Open

Odd mark_density() #27

earowang opened this issue Jan 28, 2021 · 8 comments

Comments

@earowang
Copy link
Collaborator

penguins %>% 
  vega(enc(x = body_mass_g, colour = species)) %>% 
  mark_density()
@sa-lee
Copy link
Collaborator

sa-lee commented Jan 28, 2021

Yeah this one definitely doesn't work how I expected / is broken try:

penguins %>% 
  vega(enc(x = body_mass_g, colour = species)) %>% 
  mark_density()

@sa-lee
Copy link
Collaborator

sa-lee commented Jan 28, 2021

Missing values causing issues again.
This gives the expected result:

penguins %>% 
    filter(!is.na(body_mass_g)) %>% 
    vega(enc(x = body_mass_g, colour = species)) %>% 
    mark_density()
    
 penguins %>% 
    filter(!is.na(body_mass_g)) %>% 
    vega(enc(x = body_mass_g)) %>% 
    mark_density() 

@earowang
Copy link
Collaborator Author

😢 Now this mtcars not working as expected.

mtcars %>%
  mutate(cyl = factor(cyl)) %>%
  vega(encoding = enc(x = wt, colour = cyl)) %>%
  mark_density()

image

@earowang earowang reopened this Jan 29, 2021
@sa-lee
Copy link
Collaborator

sa-lee commented Jan 29, 2021

it seems like an issue with the stacking again? here's ggplot2 for reference
image

earowang added a commit that referenced this issue Jan 29, 2021
@earowang
Copy link
Collaborator Author

I've removed "stack" = zero". The default in ggplot2 is "identity". In vegalite, stack = zero means stacked density?

image

@earowang
Copy link
Collaborator Author

image

image

Seems not working for mtcars when stacking.
image

@sa-lee
Copy link
Collaborator

sa-lee commented Jan 29, 2021

maybe the default bandwidth is off? maybe this more reason for us to compute these things on the r side haha

@sa-lee
Copy link
Collaborator

sa-lee commented Jan 29, 2021

Should position = "stack" be the default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants