Support material for the blog post "Two-dimensional plots on Python [Part III]", on Programming Science.
Support material: http://www.github.com/programmingscience/code
In order to cite this material, please use the reference below (this is a Chicago-like style):
de Siqueira, Alexandre Fioravante. "Two-dimensional plots on Python [Part III]". Programming Science. 2015, Jan 11. Available at
http://www.programmingscience.org/?p=42.
Access date: (please put your access date here).
Copyright (C) Alexandre Fioravante de Siqueira
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
In [1]:
from pylab import *
t = arange(0.0,2.0,0.01)
y1 = sin(2*pi*t)
y2 = cos(2*pi*t)
fig, ax = subplots(2, sharex=True)
ax[0].plot(t, y1, color='green', linestyle='-.', linewidth=3)
ax[1].plot(t, y2, color='red', linestyle=':', linewidth=3)
show()
In [2]:
from pylab import *
t = arange(0.0,2.0,0.01)
y1 = sin(2*pi*t)
y2 = cos(2*pi*t)
fig, ax = subplots(1, 2, sharex=True)
ax[0].plot(t, y1, color='green', linestyle='-.', linewidth=3)
ax[1].plot(t, y2, color='red', linestyle=':', linewidth=3)
show()
In [3]:
# fig, ax = subplots(5, sharex=True)
subplot(): plots in 3 rows, and 2 columns.
In [4]:
# fig, ax = subplots(3, 2, sharex=True)
In [5]:
from pylab import *
t = arange(0.0,2.0,0.01)
fig, ax = subplots(3, 2, sharex=True)
ax[0, 0].plot(t, sin(pi/8*t), color='green', linestyle='-', linewidth=3)
ax[0, 1].plot(t, cos(pi/8*t), color='red', linestyle='--', linewidth=3)
ax[1, 0].plot(t, tan(pi/8*t), color='cyan', linestyle='-.', linewidth=3)
ax[1, 1].plot(t, 1/cos(pi/8*t), color='magenta', linestyle=':', linewidth=3)
ax[2, 0].plot(t, 1/sin(pi/8*t), color='yellow', linestyle='--', linewidth=3)
ax[2, 1].plot(t, 1/tan(pi/8*t), color='black', linestyle=':', linewidth=3)
show()
In [ ]: