rmaia / pavo

tools for the analysis of color data in R
http://pavo.colrverse.com
GNU General Public License v2.0
69 stars 17 forks source link

Add interactive shiny interface to procspec() #187

Open Bisaloo opened 4 years ago

Bisaloo commented 4 years ago

I would be great if users could interactively select the bounds for procspec(). It would be especially useful for species that have multiple peaks in various places (hummingbirds, or Devi's beetles).

Should this be in pavo or in an extension package that adds a shiny interface to various pavo functions (or that could join the colrverse)?

I will probably need this soon so assigning to myself.

thomased commented 4 years ago

Hmm. It'd be cool — couple of random thoughts. In principle most of pavo could be shiny'd for R-phobic users, from loading & processing specs to modelling & plotting etc. Raf has that neat tcsplot/model example in a repo somewhere. If you saw it going that direction over whatever timeframe I'd think that'd be worth a package-sized extension (from only limited experience with shiny though).

For the smaller-scale case of an interactive procspec(), I wonder how far you could get with some locator() trickery without the baggage of shiny? I'd have to have a play, not sure if it's up to the task — just a thought.

Bisaloo commented 4 years ago

Some quick answers that we can discuss:

Yes, most of pavo can be shiny'd. I also started a shiny interface around the same time as Raf. The file import and pre-processing were working quite well but I didn't go all the way to vision models and colour spaces IIRC. If we had unlimited time, it would be a cool project (especially since we have two proofs of concepts on different parts that we might be able to merge).

But beyond that, I think there are certain part where a graphical interface would be more useful than just catering to R-phobic users. For example, in the case I'm presenting in this issue, I can't think of a script clever enough to go through all spectra one by one and identify the various peaks. It's possible but definitely not an easy task. So a graphical interface here would be great for everybody, even advanced users.

Regarding locator() vs shiny, yes, it should be possible but not as convenient IMO because it's still less interactive. In shiny, you can have sliders and drag elements with your cursor, which is not possible with locator()

thomased commented 4 years ago

Cool, that all makes sense — sounds worthwhile.

As to whether it's incorporated or sits in its own package, I'm not sure I have a good enough sense of how heavy it all is & what it'd look like to have a strong opinion atm. I'm on board with the lightr-style use of tightly integrated packages if you're leaning that way, and it could make extensibility simpler if we're later inclined to shinify other bits of pavo (or the whole package, given infinite time). But if it's just a matter of a new argument being dropped in procspec() then it may be simplest at this stage to just roll it in. I'm open

Bisaloo commented 4 years ago

This sounds like the right path for this: https://community.rstudio.com/t/sliding-a-point-on-a-plot-rather-than-sliderinput-to-update-plot-in-shiny/16405/8