使用 Plots.jl 对多个图进行着色
Shading with multiple plots using Plots.jl
但是,我有两个问题
- 我不知道如何给某个时期的图画阴影
- 我想画多个图作为例子
我该怎么做?
也许这可以帮助您入门:
using Plots
subplots = 3
time = 250
shade_xlims = [125,140]
data_matrix = Plots.fakedata(time, subplots)
p = plot(data_matrix, layout=(subplots,1), xlabel = "time");
for i in 1:subplots
ymin,ymax = extrema(data_matrix[:,i]) # determine ylims for shade
plot!(p[i], # apply shade to each subplot
shade_xlims, # xlims for shade
[0,0], # dummy y coordinates
fillrange = (ymin,ymax), # apply ylims
fillalpha = 0.5, # set transparency
fillcolor=:gray, # set shade color
label = "") # avoid shade labels
end
p # show the final graph
干杯!
但是,我有两个问题
- 我不知道如何给某个时期的图画阴影
- 我想画多个图作为例子
我该怎么做?
也许这可以帮助您入门:
using Plots
subplots = 3
time = 250
shade_xlims = [125,140]
data_matrix = Plots.fakedata(time, subplots)
p = plot(data_matrix, layout=(subplots,1), xlabel = "time");
for i in 1:subplots
ymin,ymax = extrema(data_matrix[:,i]) # determine ylims for shade
plot!(p[i], # apply shade to each subplot
shade_xlims, # xlims for shade
[0,0], # dummy y coordinates
fillrange = (ymin,ymax), # apply ylims
fillalpha = 0.5, # set transparency
fillcolor=:gray, # set shade color
label = "") # avoid shade labels
end
p # show the final graph
干杯!