xticks labels don't get displayed in Julia Plots (with pyplot backend)

Viewed 631

I am basically trying to use this feature described in the Julia plots documentation

plot!(xticks = ([0:π:3*π;], ["0", "\\pi", "2\\pi"]))

My example looks like this:

using Plots
dat = rand(60*60*50)
pyplot()
plot(
    dat,
    xticks = ([0:10*60*50:60*60*50;], ["0", "10", "20", "30", "40", "50", "60"]),
    xlabel = "time [min]"
    )

The code creates the ticks, but does not label them:

Output

This code worked before the latest update. Did anyone experience this problem as well (and has a solution)?

1 Answers

Use xformatter option to display tick values.

This produces the result you have in mind.

Plots.plot(
     dat,
     xticks=0:30000:180000,
     xformatter = ((x) -> "\$$(round(Int,x/(60*50)))\$"),
     xlabel = "time [min]")

Plots.jl using xformatter

Related