Skip to content

backticks on non-ascii labels #3017

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

Closed
gagnagaman opened this issue Nov 27, 2018 · 2 comments
Closed

backticks on non-ascii labels #3017

gagnagaman opened this issue Nov 27, 2018 · 2 comments

Comments

@gagnagaman
Copy link

Upgrading to version 3.10 of ggplot2 I encountered a strange behaviour
with regards to non-ascii (utf-8) characters in labels.
In some cases ggplot will wrap the labels with backticks. In other cases
(with the same character) it will not. I have been examining this and it
seems that the strange behaviour only occurs when the non-ascii character
isn't the first one in the string. Thus in the example below when mán is the variable on
the x axis it gets wrapped but ár does not.

# pseudo data with the same non-ascii letter in two different locations.
> df=data.framer=rep(1991:2000,each=12),mán=rep(1:12,10))
> df$hiti=with(dfr/2000 + 10* sin(mán/12*2*pi) + rnorm(120))
> library(ggplot2)
> ggplot(data=df,aes(mán,hiti)) + geom_point()
> ggplot(data=df,aes(ár,hiti)) + geom_point()
@yutannihilation
Copy link
Member

Thanks for reporting, this is already fixed in the dev version by #2981. You can try the dev version by devtools::install_github("tidyverse/ggplot2"), or set labels manually (e.g. xlab()).

ggplot(data=df,aes(mán,hiti)) + geom_point() + xlab("mán")

(By the way, it's curious why expr_text() adds backticks to mán, which seems to ok to use without backticks...)

library(rlang)

expr_text(sym("mán"))
#> [1] "`mán`"
expr_text(sym("ár"))
#> [1] "ár"

mán <- 1
mán
#> [1] 1

Created on 2018-11-27 by the reprex package (v0.2.1)

@lock
Copy link

lock bot commented May 26, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators May 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants