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
I decided to create this issue since I would like to ask a question (and probably request a new feature). I noticed that after #164 we can use units objects to define the x and y axis in a ggplot2 thanks to the implementation of scale_x_units and scale_y_units. For example:
library(ggplot2)
library(units)
#> udunits database from C:/Users/user/AppData/Local/R/win-library/4.3/units/share/udunits/udunits2.xmldat<-data.frame(
x= set_units(1, m),
y= set_units(1, m),
z=1
)
ggplot(dat) +
geom_point(aes(x, y, col=z))
However, as soon as I specify that the variable z is recorded with a given unit of measurement, the same code fails
dat$z<- set_units(dat$z, "m")
ggplot(dat) +
geom_point(aes(x, y, col=z))
#> Error in Ops.units(x, range[1]): both operands of the expression should be "units" objects
The problem is that something like scale_colour_units is missing, right? Are there any particular difficulties in implementing it? I'm not really familiar with the ggplot2 internals but, if that's the case, I can try creating a PR sometimes during summer.
Dear all,
I decided to create this issue since I would like to ask a question (and probably request a new feature). I noticed that after #164 we can use
units
objects to define thex
andy
axis in a ggplot2 thanks to the implementation ofscale_x_units
andscale_y_units
. For example:However, as soon as I specify that the variable z is recorded with a given unit of measurement, the same code fails
Created on 2024-05-25 with reprex v2.0.2
The problem is that something like
scale_colour_units
is missing, right? Are there any particular difficulties in implementing it? I'm not really familiar with the ggplot2 internals but, if that's the case, I can try creating a PR sometimes during summer.Session info
The text was updated successfully, but these errors were encountered: