You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
layer_data() provides useful information for people with and without visual impairments to better understand current ggplot object in a table form.
However, this data does not contain x/y labels so it is challenging to associate each x/y values with their corresponding labels.
For example, in the following bar plot, the x labels ("2seater", "compact", "midsize", "minivan", "pickup", "subcompact", "suv") are not contained in layer_data() data frame.
Of course, it is possible to retrieve them by defining a custom function just like what {BrailleR} does like below; however, being able to see all the labels along with their corresponding values in one data frame would not only be more desirable, but also be more stable and consistent.
Reprex
library(ggplot2)
g<- ggplot(mpg, aes(class)) + geom_bar()
g
layer_data() has always ever been intended for testing purposes and I'm a bit apprehensive about tacking on more information than the actual layer data for fear that it turns into some sort of catch-all function.
However, I do think we should think about providing a suite of functions that can extract relevant information about the final state of a plot for use with textual descriptions etc. We will soon have some more ressources for this so hopefully we can begin to build this out in the release following the one I'm currently preparing.
I think it might be useful to build something like layer_data(), but for guide breaks, positions and labels. I've noticed people trying to access these values (i.e. #5029, #5063), and I think accessor functions, as mentioned here, are a great idea that leaves maintainers free to change internal structures as long as the accessors continue to work. The current internal structure for guides are poised to change again.
layer_data()
provides useful information for people with and without visual impairments to better understand current ggplot object in a table form.However, this data does not contain x/y labels so it is challenging to associate each x/y values with their corresponding labels.
For example, in the following bar plot, the x labels ("2seater", "compact", "midsize", "minivan", "pickup", "subcompact", "suv") are not contained in
layer_data()
data frame.Reprex
Created on 2022-10-02 with reprex v2.0.2
Session info
The text was updated successfully, but these errors were encountered: