使用 Plots.jl 将一组图绘制为子图

Plot an array of plots as subplots with Plots.jl

此线程的延续:

当我尝试时

using Plots
plot_array = Any[] 
for i in 1:5
    push!(plot_array, plot(rand(10))) # make a plot and add it to the plot_array
end
plot(plot_array)

我收到错误:

MethodError: no method matching Plots.Plot{Plots.PlotlyBackend}(::Char, ::Char, ::Char, ::Char, ...) 
Closest candidates are: Plots.Plot{Plots.PlotlyBackend}(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any)

我错过了什么?

您需要使用 ...:

在上次 plot 调用中“展开”子图数组
using Plots
plot_array = [] 
for i in 1:5
    push!(plot_array, plot(rand(10)))
end
plot(plot_array...) # note the "..." 

会产生类似

的东西