Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upinherit mapping in geom_miss_point #137
Comments
|
Using ggplot(mydat) +
geom_point(aes(x=mpg,y=disp, color = ..missing.., fill= cyl),
pch = 21, size = 4, stat = "miss_point")So I made a slight mod to ggplot(mydat) +
geom_point(aes(x=mpg,y=disp, color = ..missing.., fill= cyl),
pch = 21, size = 4, color = "black",stat = "miss_point")The mod I made in data.frame(data,
missing = missing_label)However, I did notice this behavior: # Works using the unmodified `StatMissPoint`
ggplot(mydat, aes(x = mpg, y = disp, fill = factor(cyl)))+
geom_point(pch = 21, size = 4)+
stat_miss_point(pch = 21, size = 4)# Throws the same error in both cases of `StatMissPoint`
ggplot(mydat, aes(x = mpg, y = disp, fill = factor(cyl)))+
geom_point(pch = 21, size = 4)+
geom_miss_point(pch = 21, size = 4)
#> Error in rep(value[[k]], length.out = n) :
#> attempt to replicate an object of type 'symbol'
#> In addition: Warning message:
#> Removed 10 rows containing missing values (geom_point). |
|
Hi! Thanks for filing the complement, and the bug report! Ideally @seasmith - can you point to the changes you made in This should be fixed in the next release. |
Correct 'fill' aesthetic behavior in geom_miss_point() #137
|
Thanks to the kind work of @seasmith I think that this works now: library(ggplot2)
library(naniar)
ggplot(airquality,
aes(x = Ozone,
y = Solar.R,
colour = factor(Month))) +
geom_miss_point()Created on 2018-04-17 by the reprex package (v0.2.0). Let me know how you go, @jminnier ? And thank you so much for filing an issue! |
|
Ah, awesome, thanks so much @seasmith! It works perfectly, now. Keep up the great work, both of you! |




Hey there, I love your package and especially the
geom_miss_pointfunction, but I think I found some unexpected behavior. My issue is that I cannot seem to getgeom_miss_pointto inherit thefillorshapein theaes(). Here's a reprex showing what I mean:Here is a simple missing plot that I'm using as a basis:
Example showing it works for regular
geom_point: fill and color are inherited withgeom_pointjust fine and this is what I'd like to emulate ingeom_miss_point.However, fill is not inherited with geom_miss_point. I'd like to have the missing points filled with their respective values of
cyl:also, trying to inherit size gives an error:
Specifying fill in the function does not work, either
But specifying fill as a constant does work.
I tried forking your repo and playing around with
geom_miss_pointandGeomMissPointbut I couldn't figure out how to fix it. I'm not very experienced with extending ggplot2 and I think this is beyond my knowledge. I also tried updating ggplot2 to the development version but that didn't make a difference. Wish I could have been more helpful in figuring this out! I will keep trying, but perhaps if you get a chance to check it out it will be easy for you to see what's causing this behavior?Thanks for naniar, it truly is absurdly useful!