Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latin letter stand-ins should be typeset as their Greek counterparts in plots #238

Closed
ekatko1 opened this issue Apr 16, 2020 · 6 comments
Closed

Comments

@ekatko1
Copy link

ekatko1 commented Apr 16, 2020

In the current implementation units such as micrometers are displayed in Latin: um instead of the Greek [mu]m when plotting. I have not tested other symbols with Greek letters but I assume that the problem is more general.

library(units)
library(ggplot2)
library(ggforce)

df = cars
df$Distance = set_units(df$dist, ft)/1000
df$Speed = set_units(df$speed, mph)

qplot(x=Speed, y=Distance, data=df) +
  scale_y_unit(unit = "um") 
# The Y-axis labels uses the latin u instead of the Greek mu
@ekatko1 ekatko1 changed the title Latin letter-stand ins should be typeset as their Greek counterparts in plots Latin letter stand-ins should be typeset as their Greek counterparts in plots Apr 16, 2020
@edzer
Copy link
Member

edzer commented Apr 16, 2020

What is wrong with

qplot(x=Speed, y=Distance, data=df) +
   scale_y_unit(unit = "μm") 

@ekatko1
Copy link
Author

ekatko1 commented Apr 16, 2020

It doesn't seem to work for me:

Error: In ‘µm’, ‘µm’ is not recognized by udunits.
See a table of valid unit symbols and names with valid_udunits().
Add custom user-defined units with install_symbolic_unit().

@edzer
Copy link
Member

edzer commented Apr 16, 2020

what is your sessionInfo()?

@ekatko1
Copy link
Author

ekatko1 commented Apr 16, 2020

R version 3.5.1 (2018-07-02)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252   
[3] LC_MONETARY=English_Canada.1252 LC_NUMERIC=C                   
[5] LC_TIME=English_Canada.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] ggforce_0.3.1 ggplot2_3.1.0 units_0.6-2  

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2       rstudioapi_0.8   magrittr_1.5    
 [4] MASS_7.3-51.4    tidyselect_0.2.5 munsell_0.5.0   
 [7] colorspace_1.3-2 R6_2.3.0         rlang_0.4.0     
[10] plyr_1.8.4       dplyr_0.8.3      tools_3.5.1     
[13] grid_3.5.1       packrat_0.5.0    gtable_0.2.0    
[16] withr_2.1.2      lazyeval_0.2.1   assertthat_0.2.0
[19] tibble_2.1.3     crayon_1.3.4     farver_2.0.1    
[22] tweenr_1.0.1     purrr_0.2.5      glue_1.3.0      
[25] labeling_0.3     polyclip_1.10-0  compiler_3.5.1  
[28] pillar_1.3.1     scales_1.0.0     pkgconfig_2.0.2 

@edzer
Copy link
Member

edzer commented Apr 16, 2020

Wow. Have you tried with a more recent release of R?

@ekatko1
Copy link
Author

ekatko1 commented Apr 16, 2020

Awesome, it works!! I wonder which R version started supporting the larger character set.

@ekatko1 ekatko1 closed this as completed Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants