Reputation: 103
I have a function in Julia that produces a plot using the Plots
package plot()
command. I'd like to set some optional arguments for the plot by passing arguments into my outer function. For example, I'd like to set title and axis labels without needing to program a bunch of if
statements to check what parameters I'm trying to pass in. A MWE of what I'd like to do is as follows:
function outer(data; plot_options...)
x = data.x
y = data.y
plot(x,y, plot_options...)
end
So that if I call something like outer(data, title="My Title", lw=2)
I produce a plot with title set to "My Title" and a linewidth of 2. Trying the naive thing that I programmed above results in an error.
Upvotes: 0
Views: 184
Reputation: 333
function outer(data; plot_options...)
x = data.x
y = data.y
plot(x,y; plot_options...)
end
missed a semicolon?
Upvotes: 1