I'm trying to remember how to use multiple axes. I found this example in the doc:
plot(Vector[randn(100),randn(100) * 100],axis=[:l :r],ylabel="LEFT",yrightlabel="RIGHT")
but that results in
LoadError: Unknown key: axis
while loading In[54], in expression starting on line 1
in default at C:\Users\cbinz\.julia\v0.4\Plots\src\args.jl:468
in warnOnUnsupported_args at C:\Users\cbinz\.julia\v0.4\Plots\src\args.jl:760
in _apply_series_recipe at C:\Users\cbinz\.julia\v0.4\Plots\src\plot.jl:218
in _plot! at C:\Users\cbinz\.julia\v0.4\Plots\src\plot.jl:538
It does in fact work with the UnicodePlots backend, but not with PyPlot or GR. I have not tried others.
Sorry to say, but that functionality has been temporarily removed. There is no axis = :right anymore. I want to generalize so you can put axes anywhere and overlay as many as you want. I'm open to api suggestions of what that should look like.
That's too bad. The simple right/left was sufficient to cover all of my use cases, and I don't really have any suggestions for how a more general version should look.
I agree... I wish it was more straightforward to keep, but this is one feature that requires a lot of effort in each backend the way I was doing it, and it can be replaced pretty generically. I just have to do it.
Now that axis is a reserved keyword for defining attributes for each axis, we need an alternative method of specifying the "twin axes" or "right and left axes" that we previously had.
Really what I want is a simple way to make one subplot an inset with the other plot as its parent, and also allow for putting the tick labels on the right/left/top/bottom of any subplot. Then we can just draw 2 subplots over each other and get the same functionality. API bikeshedding please.
related: #337
Just to confirm - there is no way to do yaxis=:right right now? (maybe it is possible to work around it with recipes somehow?)
Is it possible to embed a pyplot figure as a part of multi-part Plots.jl figure?
What's really missing is a nice way to put the ticks on the opposite side. I'll take a look and see if there's a quick answer for that. Then it's just a Plots trick to overlay 2 subplots and link the x axis.
My request is still open though... what should the API look like? How would you like to tell plots that you want a "twin axis"?

I'll push it up soon, and I'll post an example of how to hack twin axes with it.
using Plots
gr()
plot(rand(10,2), right_margin=30px)
scatter!(rand(10), ymirror=true, xlink=1, inset=(1,bbox(0,0,1,1)), bg_inside=RGBA(0,0,0,0), subplot=2)

So there were a few steps to this hack:
Great, thanks! I'll try it tomorrow.
Re API: mirror seems fine. What was the issue with specifying yaxis=:left/:right? It seems like it can be generalized to xaxis=:top/:bottom as well.
I put the hack into a method twinx. It works similar to the same method in matplotlib. It takes one param: the parent subplot, and adds a new subplot with the same result as the hack above, returning the new Subplot object. (if you didn't know you can plot directly to a Subplot: plot!(sp, rand(10))) There's also the backup:
twinx(plt::Plot = current()) = twinx(plt[1])
Here's a full example (works on PyPlot and GR if you check out dev):
using Plots; gr()
plot(rand(10))
scatter!(twinx(), 5:14, randn(10))

When we eventually have legends and colorbars that can be shared across subplots then this should be a complete solution.
Twinx works almost perfectly! A small nitpick:
There is a weird interplay between twinx, ylabel and xticks:

Note that there is no ylabel on the right axis. To get it back I can:
xt = (at, map(string, at)) into xt = (a, map(string, a)) (e.g. do a continuous axis instead of the skipping one over)As a sidenote, I'm messing with xticks because Plots.jl is deciding to interpolate x values even when they are integers (which makes them look weird as they are just years, 2007.5 is not a year). Is this an expected behaviour?
None of this is expected... first.. can you add extra margin and see if the guide shows up?
Yes, I can confirm that adding right_margin to the first plot call makes the label appear again!
ok so i just need to improve the margin calc. It's clear this is a hack :)
Any thoughts about the sidenote in my previous comment? Do you think adding a recipe that would force arrays of integers not to interpolate would make sense?
Thats beyond a recipe. Opening an issue is the best next step
Does this still work ?
I tried the following on pyplot, gr and pgfplots and got an error:
Plots.scatter(dvs,AllowableRends,m=(0.5),yticks=AllowableRends, xlab="Delta-V Per Rendezvous (arrival + departure, km/s)", ylab="Number of Rendezvous")
Plots.scatter!(twinx(),dvs,Imass,yticks=Imass,ylab="Initial S/C mass (kg)")
ERROR: LoadError: MethodError: no method matching getindex(::Plots.Series, ::Int64)
I used following definition for twinx
twinx(plt = Plots.current()) = twinx(plt[1])
Sorry to say, but that functionality has been temporarily removed. There is no
axis = :rightanymore. I want to generalize so you can put axes anywhere and overlay as many as you want. I'm open to api suggestions of what that should look like.
Is there a method for creating more than two y axes? When I try to use twinx() twice, I get overlapping ticks on the second y axis. Would be neat if something like this would be possible: Link (last image of the page)
Most helpful comment
I agree... I wish it was more straightforward to keep, but this is one feature that requires a lot of effort in each backend the way I was doing it, and it can be replaced pretty generically. I just have to do it.