cubble icon indicating copy to clipboard operation
cubble copied to clipboard

should these functions be options to geom_glyph rather than separate?

Open dicook opened this issue 3 years ago • 2 comments

geom_glyph_box() and geom_glyph_line() both might be better to be optional arguments on the geom_glyph() function, so the user doesn't need to specify the data and aes for each separate line. For example,

ggplot() + geom_polygon(data=sth_america, aes(x=long, y=lat, group=group), fill="grey70") + geom_glyph(data=nasa, aes(x_major = long, x_minor = day, y_major = lat, y_minor = ozone)) + geom_glyph_box(data=nasa, aes(x_major = long, x_minor = day, y_major = lat, y_minor = ozone)) + geom_glyph_line(data=nasa, aes(x_major = long, x_minor = day, y_major = lat, y_minor = ozone)) + coord_map() + theme_map()

dicook avatar Sep 19 '22 02:09 dicook

And then also plotting order would be handled, so data plots show up above lines and boxes.

dicook avatar Sep 19 '22 02:09 dicook

The box should be transparent by default, fill=NA

dicook avatar Sep 19 '22 02:09 dicook

This can be solved by specifying aesthetics in ggplot() and using inherits.aes = FALSE for the map layer:

glyph_dt %>% 
  ggplot(aes(x_major = xxx, x_minor = xxx, y_major = xxx, y_minor = xxx)) + 
  geom_sf(data = map_data, ..., inherit.aes = FALSE) + 
  geom_glyph_box() + 
  geom_glyph()

huizezhang-sherry avatar May 02 '23 22:05 huizezhang-sherry