Created
October 17, 2016 20:09
-
-
Save pozitron57/6524c0e18f3c8779ebe1b9b99e3b16d7 to your computer and use it in GitHub Desktop.
gridspec in python matplotlib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
#coding=utf8 | |
from pylab import * | |
from matplotlib import * | |
gs = gridspec.GridSpec(2, 1) #subplots ratio | |
f, (ax1, ax2) = plt.subplots(2, sharex=True) | |
ax1 = plt.subplot(gs[0, 0]) | |
ax2 = plt.subplot(gs[1, 0]) | |
## Sample plot | |
x1=np.linspace(0,10) | |
y1=np.linspace(0,10) | |
x2=np.linspace(0,10) | |
y2=np.linspace(0,10) | |
ax1.plot(x1,y1) | |
ax2.plot(x2,y2**3) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment