# Accents and greek letters

**URL:** <https://discourse.julialang.org/t/accents-and-greek-letters/37954>\
**Category:** New to Julia\
**Created:** [April 21, 2020, 10:28am UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954 "2020-04-21T10:28:01Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![aquarelle332](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquarelle332/32/20816_2.png) [@aquarelle332](https://discourse.julialang.org/u/aquarelle332)\
**Post date:** [April 21, 2020, 10:28am UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/1 "2020-04-21T10:28:01Z")

</div>

Julia version: 1.4.1  
Kubuntu: 18.04 LTS

Hello,

As a french-speaking person, I often use accentuated characters e.g., é (e-accute). When I run a simple code like this one:

```julia
using Plots

t(x) = cos(x)
u(x) = -sin(x)

plot(-π:0.01:π, [t,u],
		 linewidth = 2.0,
		 framestyle = :box, grid = :yes,
		 title="cos(x) et sa dérivée",
		 xlabel="x", 
		 ylabel="Valeurs",
		 lab=["f(x)" "f'(x)"])
		 
plot!(size=(600, 400))

savefig("figure_cosinus_et_derivee_1.png")

```

I obtain an error and in the graph, each é is replaced by an empty rectangle:

```julia
GKS: character ignored due to unicode error

```

In the same vein, greek letters are replace by ?

Do you know how to circumvent this(these) problem(s) by using Plots?  
Thank you in advance,  
Thierry

---

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [April 21, 2020, 10:36am UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/2 "2020-04-21T10:36:30Z")

</div>

Perhaps this is solved, [Unicode Support in Julia 1.0 · Issue #143 · jheinen/GR.jl · GitHub](https://github.com/jheinen/GR.jl/issues/143) suggests that you can enable unicode like so:

```julia
ENV["GKS_ENCODING"]="utf-8"
using Plots
gr()
plot(1:10; xlabel="ε")

```

---

<div class="post-metadata">

**Author:** ![aquarelle332](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquarelle332/32/20816_2.png) [@aquarelle332](https://discourse.julialang.org/u/aquarelle332)\
**Post date:** [April 21, 2020, 11:04am UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/3 "2020-04-21T11:04:56Z")

</div>

Thank you very much, macabbott. This works fine. 👍  
As suggested in the [link](https://github.com/jheinen/GR.jl/issues/143) you sent me, I inserted

```julia
ENV["GKS_ENCODING"]="utf-8" 

```

in startup.jl

---

<div class="post-metadata">

**Author:** ![aquarelle332](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquarelle332/32/20816_2.png) [@aquarelle332](https://discourse.julialang.org/u/aquarelle332)\
**Post date:** [April 21, 2020, 3:36pm UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/4 "2020-04-21T15:36:40Z")

</div>

In the same simple code as described above, how can I obtain -π, -π/2, etc., on the X-axis instead of -3.14, -1.57, etc?

And how to represent for example units in the form of ms-² instead of ms^-2 on a given axis typically?

---

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [April 21, 2020, 4:40pm UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/5 "2020-04-21T16:40:14Z")

</div>

One way to give labels for ticks is like so: `plot(rand(5), xaxis=("ex", (0,7), ([1,2,3,4], ["one", "II", "3/\\(1\\)", "\\ 4^(1)"]) ))`. GR has a mode in which it displays fractions & exponents, which I though giving `\\alpha` etc. would activate, but a quoted space like `\\ ` seems to work too… perhaps there is a more official way.

---

<div class="post-metadata">

**Author:** ![aquarelle332](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquarelle332/32/20816_2.png) [@aquarelle332](https://discourse.julialang.org/u/aquarelle332)\
**Post date:** [April 21, 2020, 8:33pm UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/6 "2020-04-21T20:33:31Z")

</div>

Thank you very much macabbott. 👍  
I am working on your solution in order to adapt it.

However I though that:

- some kind of “formatter” could be a solution ([Axis Attributes · Plots](https://docs.juliaplots.org/latest/generated/attributes_axis/)) or,
- something like “curve.relabel” (holoview in Python) could be found in Plots.

Kind regards,  
Thierry

---

<div class="post-metadata">

**Author:** ![aquarelle332](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquarelle332/32/20816_2.png) [@aquarelle332](https://discourse.julialang.org/u/aquarelle332)\
**Post date:** [April 22, 2020, 1:06am UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/7 "2020-04-22T01:06:00Z")

</div>

I tried your command and it works. 😉 Many thanks.

However, I turned towards GnuPlot and its Julia interface, i.e., [Gaston](https://mbaz.github.io/Gaston.jl/v0.10.0/) in order to use “gpcom” commands of GnuPlot which make the code easy to read (IMHO). Here is an example of a very elementary code which works even though I am sure that it is not very instructive for Julia geeks as you. [The xlabel is just for fun (a trial to obtain upperscript in units)]. More interesting is the fact that this code is much more rapid (~10 times) than its Plots equivalent.

```julia
using Gaston

t = 0.0:0.01:2π

plot(t, cos.(t),
        xrange="[0.0:*]",
        yrange="[-1.2:1.2]",
        title="Circular function", 
        grid="on", 
        xlabel="Frequency (s^⁻^1)", 
        ylabel="Amplitude",
        keyoptions="box top right", 
        legend="cos(t)",
        linecolor="red",
        gpcom="set xtics pi; set format x '%.0Pπ'" # GnuPlot command
    )

printfigure(term="png", font="Times,16", size="1000,650",
            linewidth="1", background="white",
            outputfile="cosinus.png")

```

Kind regards,  
Thierry

---

<div class="post-metadata">

**Author:** ![lwhitefox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lwhitefox/32/4363_2.png) [@lwhitefox](https://discourse.julialang.org/u/lwhitefox)\
**Post date:** [May 29, 2020, 10:41pm UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/8 "2020-05-29T22:41:30Z")

</div>

> [@aquarelle332](#):
>
> ```julia
> GKS: character ignored due to unicode error
> 
> ```

I’ve started getting this error when generating plots where tick mark labels are of the form `3X10^4` : the X doesn’t appear and the labels are distorted as shown in the attached figure. This must be associated with some recent change, I think, since I didn’t used to have the problem. I have inserted `ENV["GKS_ENCODING"]="utf-8"` before plotting, but that doesn’t fix the error.

Any tips?

![image](https://global.discourse-cdn.com/julialang/original/3X/1/e/1eac2d0b3e7546fa86e4eaf8152c3bc99916b995.png)

---

<div class="post-metadata">

**Author:** ![aquarelle332](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquarelle332/32/20816_2.png) [@aquarelle332](https://discourse.julialang.org/u/aquarelle332)\
**Post date:** [May 30, 2020, 11:59am UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/9 "2020-05-30T11:59:52Z")

</div>

Hello lwhitefox,  
Is ENV[“GKS\_ENCODING”]=“utf-8” inserted in startup.jl?  
What is your julia version?  
Are you dealing with using Plots?

---

<div class="post-metadata">

**Author:** ![lwhitefox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lwhitefox/32/4363_2.png) [@lwhitefox](https://discourse.julialang.org/u/lwhitefox)\
**Post date:** [May 30, 2020, 1:55pm UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/10 "2020-05-30T13:55:07Z")

</div>

> [@aquarelle332](#):
>
> ENV[“GKS\_ENCODING”]=“utf-8”

I put this right before generating the plots not in startup.jl (yes, with the Plots package.

This is with Julia 1.4.1 ; I ran update in pkg mode a few days ago so Plots should be current - in fact it was after updating that the problem started

---

<div class="post-metadata">

**Author:** ![aquarelle332](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquarelle332/32/20816_2.png) [@aquarelle332](https://discourse.julialang.org/u/aquarelle332)\
**Post date:** [May 30, 2020, 2:11pm UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/11 "2020-05-30T14:11:52Z")

</div>

Maybe a problem of fonts?

---

<div class="post-metadata">

**Author:** ![lwhitefox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lwhitefox/32/4363_2.png) [@lwhitefox](https://discourse.julialang.org/u/lwhitefox)\
**Post date:** [May 30, 2020, 2:20pm UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/12 "2020-05-30T14:20:34Z")

</div>

Is there an easy way to specify a font family?

Again this is weird (To me) because it is a new problem.

---

<div class="post-metadata">

**Author:** ![aquarelle332](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquarelle332/32/20816_2.png) [@aquarelle332](https://discourse.julialang.org/u/aquarelle332)\
**Post date:** [May 30, 2020, 3:16pm UTC](https://discourse.julialang.org/t/accents-and-greek-letters/37954/13 "2020-05-30T15:16:06Z")

</div>

I think that this thread could help you: [Changing fonts in pyplot · Issue #482 · JuliaPlots/Plots.jl · GitHub](https://github.com/JuliaPlots/Plots.jl/issues/482)
