Plot an Array of Plots as Subplots with Plots. Jl
Continuation of This Thread: How to Create an Arbitrary Number of Subplots in Julia Plots When I Tried Using Plots Plot_Array = Any[] for I in 1:5 Push!...
Continuation of this thread: How to create an arbitrary number of subplots in Julia Plots
When I tried
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)
I received Error:
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)
What did I miss?
1 Answer
You need to "splat" the array of subplots in the last plot call using ...:
using Plots
plot_array = []
for i in 1:5
push!(plot_array, plot(rand(10)))
end
plot(plot_array...) # note the "..."
will produce something like