Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotly + Julia + Latex

I would like to use latex with the Plotly backend. Look in this example: Even the x-axis and y-axis log scales are not formatted properly! Do you know how to do that?

Best,

v.

using Plots, LaTeXStrings
plotlyjs()
x =  10 .^ LinRange(-5,5,10)

plot(x, 1 ./ x, yaxis=:log, xaxis=:log, m = 2, xlabel="x", label="1/x",ylabel="f(x)")
plot!(x, 10 ./ x, m=2,label="10/x")
plot!(x, 1 ./ (x.^2), m=2, label=L"f(x)=$1/x^2$")
savefig("./test.png")

test

like image 826
varantir Avatar asked Apr 11 '26 09:04

varantir


1 Answers

Seems to work with the gr() backend, so I expect LaTeXString is not supported by the plotlyjs() backend.

enter image description here

like image 119
Rene Avatar answered Apr 14 '26 09:04

Rene



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!