Does Julia support Chinese characters when plotting graph?

Dear all ,

How to dispaly Chinese characters in the graph?

julia> y = rand(10);

julia> t = 1:10;

julia> plot(t, y, xlabel = "时间")
GKS: glyph missing from current font: 26102
GKS: glyph missing from current font: 38388
GKS: glyph missing from current font: 26102
GKS: glyph missing from current font: 38388
GKS: glyph missing from current font: 26102
GKS: glyph missing from current font: 38388
GKS: glyph missing from current font: 26102
GKS: glyph missing from current font: 38388
GKS: glyph missing from current font: 26102
GKS: glyph missing from current font: 38388

xxx

2 Likes

I have solved this problem.

using PlotlyJS
plotlyjs()
plot(rand(10), xlabel = "时间")

3 Likes
ENV["GKS_ENCODING"] = "utf-8"
using Plots
plot(rand(10),title="àçħℏÅÇ图形")

Or due to missing font, specify the font. And make sure you have Chinese font installed.

using Plots
x = 1:10
y = rand(10)

myfont = font(12, "Arial")  # Define a custom font
#OR. fontsize is incorrect.
#Plots.default(fontfamily="Arial", fontsize=12)

plot(x, y,
     title="My Plot", titlefont=myfont,
     xlabel="X-axis", ylabel="Y-axis", guidefont=myfont,
     tickfont=myfont,
     legendfont=myfont)

1 Like