Skip to content

Instantly share code, notes, and snippets.

@fgerick
Created June 22, 2021 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgerick/eadc509047c0abcdc07d90d1274e1ee4 to your computer and use it in GitHub Desktop.
Save fgerick/eadc509047c0abcdc07d90d1274e1ee4 to your computer and use it in GitHub Desktop.
Two subplots with shared colorbar using PyPlot.jl
using PyPlot
f,ax = subplots(2)
y = randn(10,10)
y2 = randn(10,10)/maximum(abs.(y))
c1 = ax[1].pcolor(y)
c2 = ax[2].pcolor(y2)
f.colorbar(c2; ax=ax)
#gives same solution as mentioned in https://stackoverflow.com/questions/13784201/matplotlib-2-subplots-1-colorbar using ax=ax.ravel().tolist()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment