Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zooming in does not adapt date axis when using Julia's PlotlyJS in VSCode

Tags:

julia

plotly

I am using Plots.plot along with PlotlyJS to display a time-series in the VSCode editor as follows:

using Plots
using PlotlyJS
...
plotlyjs()
plot = Plots.plot(dates, y)
display(plot)

So while the plot is "interactive" the dates do not adapt dynamically to the selected region. Here is a quick video of the issue I'm facing. Ideally I want the dates to display in a nice way every time I am zooming in (or out), and not just being fixed once at initial creation.

How can this be achieved?

like image 786
Muppet Avatar asked Nov 20 '25 19:11

Muppet


1 Answers

Your problem is close to Github issue 1382. The issue was that Plots calculates the ticks before sending it to the backend via plotlyjs(), so the ticks end up "frozen" even if the backend is normally adaptive. They implemented an argument ticks = :native (issue 1395) to fix this, but be aware that it doesn't work well with some arguments, which is why it's not the default (issue 1425, issue 3263).

An example of its usage from issue 1395:

using Plots; plotly()
plot(rand(10), ticks = :native)
like image 55
BatWannaBe Avatar answered Nov 24 '25 22:11

BatWannaBe



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!