0

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.

1 Answer 1

1
function outer(data; plot_options...)
   x = data.x
   y = data.y
   plot(x,y; plot_options...)
end

missed a semicolon?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.