Closed kaizadp closed 1 year ago
Let's come back to this after #36 is merged.
@kaizadp You're specifying (because the function needs) an absolute LABEL POSITION
, but this needs to be group- (facet-) dependent. I would suggest changing LABEL_POSITION
to nudge_y
(following ggplot's geom_label parameter names). Then we can add that value to the max (e.g.) of each group. Hmm.
Another option would be to change this function to geom_spectra
so that users can do something like
ggplot(dat, aes(x, y, label = lab)) +
geom_spectra(binset = Clemente, stagger = 0.5, nudge_y = 2) +
facet_wrap(~treatment)
Ooh, I like the idea of a geom_spectra
. Don’t know how complicated that would be though.
I think we're thinking different things here. If we add facets, I'm ok keeping the label position an absolute value on the y-axis. My bigger concern is making sure the staggered spectra start at 0 for each facet.
I'm picturing something like this (I did this using patchwork
, not facets).
Oh. I see. But does that have anything to do with nmr_plot_spectra
? Aren't those intensity values assigned elsewhere?
@bpbond
In the
gg_spectra()
function, we have an argument to stagger the spectra, so we can see multiple spectra at once. Works fine when we have just a single panel in the graph. But when I usefacet_wrap
, the staggering is weird (see pics). Is there a way we can "reset" the staggering, so it starts at 0 for each facet?... or is this asking for too much from our package? It would be a cool feature, but we also don't want to break/bog down the functions with too many customizations.
https://github.com/bpbond/nmrrr/blob/7c19c171deba6c697ccd32d02edaf76cf943181f/scratchpad.R#L32-L49