Reputation: 2005
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.
Upvotes: 4
Views: 7716
Reputation: 1158
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.
Upvotes: 9
Reputation: 175
For interactive behavior similar to Matlab on Plots.jl, run default(show=true)
. Alternatively, you could switch to PyPlot which has the same features in a more intuitive manner. If you need something further (ie manipulation of parameters), see Iteract.jl
Upvotes: 0