Reputation: 31
using Plots
plot(0:10,sin);
plot!(0:10,sin,seriestype = :scatter)
In this example, the output are actually two plots. How can I save them in one file?
I searched and tried some method, but they only support one single plot and I haven't found any functions for multiple plots.
Upvotes: 3
Views: 93
Reputation: 13800
This is just one figure - plot!
(with a bang) mutates the figure object created in the first plot
call.
Saving this is as simple as savefig("my_output.svg")
- if this does not work as expected please provide more details.
Not directly related, but seeing that you are overlaying a scatter plot onto a line plot you might be interested in the linetype
kwarg:
plot(0:10, sin, linetype = :scatterpath)
plot(0:10, sin, lt = :scatterpath) # short form alias
will both produce a line and scatter at the same time (with a single label and single colour).
Upvotes: 3