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

ggplot2's Chinese axis label display #6058

Closed
trafficfan opened this issue Aug 26, 2024 · 2 comments
Closed

ggplot2's Chinese axis label display #6058

trafficfan opened this issue Aug 26, 2024 · 2 comments

Comments

@trafficfan
Copy link

trafficfan commented Aug 26, 2024

I found a problem with ggplot2 Chinese axis label display, the vertical axis of the Chinese axis label font is always larger than the horizontal axis, the following code in the vertical axis and the horizontal axis of the label are ‘测试中文’, please observe the size of the X Y axis label

I expected These two axis labels are displayed the same large

Here is the code to reproduce the bug:

``` r
library(mlr3verse)
#> Loading required package: mlr3
task = tsk("german_credit")
learner = lrn("classif.ranger", predict_type = 'prob')
split = partition(task)
learner$train(task,row_ids = split$train)
pred = learner$predict(task, row_ids = split$test)
measure = msr("classif.auc")
pred$score(measure)
#> classif.auc 
#>    0.810617
library(ggplot2)
autoplot(pred,type = "roc") +
  labs(x = "测试中文", y = "测试中文") 

Created on 2024-08-26 with reprex v2.1.1


@clauswilke
Copy link
Member

Minimal reprex:

library(ggplot2)

ggplot() +
  labs(x = "测试中文", y = "测试中文") 
Screenshot 2024-08-25 at 9 57 29 PM

I don't see the issue. Probably a bad graphics device. Or, alternatively, bad theme settings in autoplot().

@teunbrand
Copy link
Collaborator

I also can't discern what is wrong here, neither in the original example or Claus' reprex.
If there is something wrong with the rendering of Chinese characters, it might be the font itself or the graphics device that render incorrectly.

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

3 participants