`draw_panel()` vs `draw_group()`

ggplot2

#1

Hi,

I'm developing an extension for ggplot2 and I'm wondering if I can ask a few questions to make sure that I’m doing things in the intended way.

Technically, I'm trying to make a custom geom_point where alongside the point, I'd like to make some specific geom_hline and geom_vline as guides based on my data. So far, I've made a Stat instance, and calculating what's needed and pass it to the corresponding custom Geom.

In the Stat, I make new groups of data like hlines and vlines based on my dataset and pass everything to the Geom and in the draw_group, based on the value of the group I decide what should I plot, either the points or lines. I use an if to check the group, and adjust accordingly.

So, I’m wornding if this is the proper way to do it, or there is any other way that I can approach this problem. I’ve tried to use draw_panel but since at some point I might wanna need facet or group params, I don’t think that’s the best way.

Cheers,
Amir.