该线程的延续:如何在 Julia Plots 中创建任意数量的子图
当我尝试时
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)
Run Code Online (Sandbox Code Playgroud)
我收到错误:
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)
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
对于固定n,我想创建一个带有n变量的函数
f(x_1, ..., x_n)
Run Code Online (Sandbox Code Playgroud)
例如,如果n=3,我想创建一个算法,使得
f(x_1, x_2, x_3) = x_1 + x_2 + x_3
Run Code Online (Sandbox Code Playgroud)
为每个都有一个算法会非常好n:
f(x_1, ..., x_n) = x_1 + ... + x_n
Run Code Online (Sandbox Code Playgroud)
我不知道如何声明函数以及如何创建n变量。
感谢您的帮助,