MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.37k stars 302 forks source link

Can't set `ax.xlabel = L"..."` #1138

Closed jlbosse closed 2 weeks ago

jlbosse commented 3 years ago

First of all, thank you very much for adding LaTeX support in the latest version, it was one of the very few things still keeping me with PyPlot.

It seems, it is not possible to set the axis labels to LaTeXStrings after creating them (and I suspect the same goes for the title). See the following example:

using CairoMakie
fig = Figure()
ax1 = Axis(fig[1,1])
x = 0..10
lines!(ax1, x, cos)
ax1.xlabel = L"\theta"
ax1.ylabel = L"\cos(\theta)"
fig

which produces a nice plot of the cosine with labels "$\theta$" and "$\cos(\theta)$".

jkrumbiegel commented 3 years ago

This is currently expected as after creation with a string, the text object input parameters are String and everything new is converted to that afterwards. We currently can't change the input types of a plot object completely after creation.

jlbosse commented 3 years ago

Okay, I was afraid that something along those lines would be the answer. Feel free to close this then, or if you plan to change this in the future leave it open.

SimonDanisch commented 3 years ago

It should be possible to do this, so I think we'll try to make it work ;)

ffreyer commented 2 weeks ago

Fixed