Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make interactive plot in Julia

I am trying to plot timeseries data on an interactive plot, such that i can zoom in the data for detailed observations. My main code for basic plot is,

using IterableTables, DataFrames, CSV, Dates, TimeSeries, Plots

myfile="test2.csv"
dmft = dateformat"d/m/yyyy HH:MM:SS"
println(dmft)
df = DataFrame(CSV.File(joinpath(@__DIR__,myfile); dateformat=dmft))
df2 = filter(row -> row[:Date] <= Dates.DateTime("2020-10-15T00:06:00"), df)

x = convert(Matrix, df[:, [:Date]])
y = convert(Matrix, df[:, [:Col3]])

#I placed usual plot function which I have removed for this block`

Please someone suggest how can I plot these two columns on an interactive plot?

Thank you in advance.

like image 872
Mohammad Saad Avatar asked Oct 22 '25 09:10

Mohammad Saad


1 Answers

The plotlyjs backend of Plots.jl allows interactive zooming, etc. The code should be (I cannot test it now):

using Plots
plotlyjs()
plot(x, y)

I use this often in a Pluto notebook, where you can e.g. add PlutoUI elements (like sliders, selection boxes) for interactive filtering / data exploration.

like image 94
lungben Avatar answered Oct 25 '25 10:10

lungben



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!