Reputation: 1801
I'm using Plots with Pluto notebook in Julia, and trying to make a plot with dual y-axis:
begin
plot(randn(100), ylabel="y1", leg=:topright)
plot!(twinx(), randn(100)*10,
c=:red,
ylabel="y2",
leg=:bottomright,
size=(600, 400))
plot!(right_bottom=10mm)
end
However, the result is that both of y-axis are on the same side (left):
I'm not sure how to make one of them on the right side
Upvotes: 0
Views: 263
Reputation: 820
This is an example that works. To get displayed both labels in legends, just run the code twice:
begin
plot(randn(10), label="Primary yaxis", ylabel="y₁")
plot!(twinx(), 3*randn(10),
c=:red, label="Secondary yaxis",
ylabel="y₂",
size=(400, 300))
plot!(framestyle=:box)
end
Upvotes: 1