Zheng Liu
Zheng Liu

Reputation: 302

"vars" argument in plot function in Julia?

I'm looking at the Julia package "DifferentialEquations.jl", a differential equation solver package in Julia. In the tutorial page , there is an example solving the Lorenz equations and plotting the Lorenz butterfly. To plot the Lorenz butterfly, the command used is

plot(sol, vars=(1,2,3))

I understand roughly that the "vars" specifies the data used as the 3 axes. However, I never found this "vars" in the documentation of "plot", or of "DifferentialEquations.jl". What is it logically? Seems the function "plot" has many keys but "vars" is not one of them.

Any idea where I could find it?

For example, if I try:

t=[0.0:0.1:2*pi;]
points = [sin(t), cos(t)]
plot(points, vars=(1,2))

it doesn't work.

Upvotes: 1

Views: 809

Answers (1)

Michael K. Borregaard
Michael K. Borregaard

Reputation: 8044

It is defined in DifferentialEquations.jl - the package has used what we call a "recipe" to overload Plots' plot function to take a new keyword if the object passed to plot is a Solution. You can find the DiffEq-specific plot keywords documented here: https://diffeq.sciml.ai/stable/basics/plot/

Upvotes: 6

Related Questions