Plots: Labeling

question

#1

In old Plots I could use sth like:
xlabel="\u3b7"
which doesnt work anymore now.
Also is it possible to increase the legend size and text?!?


#2

I don’t know, which backend you are using. With GR, you can use escape characters (e.g. \\eta):

using Plots
gr()
plot(randn(2),randn(2),xlabel="\\eta")

… or with plain GR:

using GR
plot(randn(2),randn(2),xlabel="\\eta")

#3

Sorry PyPlot is my backend…


#4

So unicode is not supported anymore?
What about legend size? (or label size in general)


#5

So nobody here who can help me ?
PS: Ok I found the font stuff again.
So whats only left is the unicode issue…


#6

Unic[quote=“Diger, post:4, topic:1309, full:true”]
So unicode is not supported anymore?What about legend size? (or label size in general)
[/quote]

Unicode support depends on Matplotlib and the fonts. Matplotlib supports Unicode labels but its default font may or may not support the symbols you want. An alternative is to use LaTeX for math symbols in the labels.

For legend size, google legend size in Matplotlib and several answers turn up. It is straightforward to translate this to PyPlot:

using PyPlot
plot(rand(10))
legend(["random numbers"], prop=Dict("size"=>20))

#7

The Matplotlib code works in PyPlot, but not in Plots when using PyPlot as a backend. The Plots syntax for doing this is

using Plots; pyplot()
plot(rand(10), label = "random", legendfont = font(10))

A good trick is to do a page search for “legend” on this page: https://juliaplots.github.io/attributes/


#8

Hey, yes thx. I was using unicode since plots with pyplot as backend originally supported only unicode I think. (correct me if im wrong)
If there is a way to use latex symbols in Plots that would help as well.


#9

There is, just using LaTeXStrings, then specify strings with Latex using L, i.e. L"..."


#10

maybe stupid question, but what does:
julia> using latexstrings
WARNING: replacing module LaTeXStrings.
WARNING: replacing module LaTeXStrings.
WARNING: replacing module LaTeXStrings.
WARNING: replacing module LaTeXStrings.
WARNING: replacing module LaTeXStrings.
WARNING: requiring “latexstrings” in module “Main” did not define a corresponding module.
mean
It seems to recognize it though LaTeXStrings is really necessary? Either I would expect it not to work at all or it does, or not?


#11

The module name is case sensitive. You need using LaTeXStrings. (Tab-completion can help you to type this.)

(Are you using Julia 0.4? Julia 0.5 should be better about giving a sensible error message for mis-capitalized module names on case-insensitive filesystems like Mac and Windows: https://github.com/JuliaLang/julia/pull/13542)


#12

So this is because I’m using windows that I don’t get a “proper” error?
julia v0.5 on this pc.