Skip to content

Instantly share code, notes, and snippets.

@antholzer
Created April 6, 2022 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antholzer/4095cff82bf2755ebe8ea39bfb8ab792 to your computer and use it in GitHub Desktop.
Save antholzer/4095cff82bf2755ebe8ea39bfb8ab792 to your computer and use it in GitHub Desktop.
using Plots
using Dates, Random, Test
function main()
P = [plot(title="$k") for k=1:3]
times_datetime = Dates.unix2datetime.(0:100:10000-1)
n = length(times_datetime)
alpha = 0.1
col = Plots.palette(:glasbey_category10_n256)
customdata = []
for i=1:10
lab = string(i)
for k=1:3
hover = repeat(["$i-$k",], inner=n)
y = rand(n)
scatter!(P[k], times_datetime, y, label=lab, legend=true, markersize=3, markershape=:circle, color=col[i], xrotation=45, hover=hover)
push!(customdata, hover)
series_length = length(P[k].series_list)
plot!(P[k], times_datetime, y, linestyle=:dash, lw=1, label=lab, legend=false, color=col[i], linealpha=0.75, hover=false)
append!(customdata, [missing for _=1:(length(P[k].series_list) - series_length)])
series_length = length(P[k].series_list)
# quantile plot
if rand() < 0.5
m = 0.01*randn(n)
q1 = m .+ alpha
q2 = m .- alpha
plot!(P[k], times_datetime, m, color=col[i], alpha=0.8, label=lab, hover=false)
plot!(P[k], times_datetime, q1, fill=q2, color=col[i], fillalpha=0.5, w=0, label=lab, hover=false)
append!(customdata, [missing for _=1:(length(P[k].series_list) - series_length)])
end
end
end
series_length = sum([length(P[k].series_list) for k=1:3])
plt = plot(P..., size=(700, 800), legend=:outertopright, layout=(3, 1), link=:both, render_mode="webgl")
append!(customdata, [missing for _=1:(length(plt.series_list) - series_length)])
@test_broken length(Plots.plotly_series(plt)) == length(customdata)
return plt, customdata
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment