Jupyter Notebook Viewer-Plotlib4
Jupyter Notebook Viewer-Plotlib4
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
In [5]:
http://nbviewer.jupyter.org/gist/manujeevanprakash/7d8a9860f8e43f6237cc 1/6
9/8/2018 Jupyter Notebook Viewer
In [7]:
In [12]:
X = np.linspace(-6, 6, 1024)
Y1, Y2 = np.sinc(X), np.cos(X)
plt.figure(figsize=(10.24, 2.56)) #sets size of the figure
plt.plot(X, Y1, c='r', lw = 3.)
plt.plot(X, Y2, c='.75', lw = 3.)
plt.show()
http://nbviewer.jupyter.org/gist/manujeevanprakash/7d8a9860f8e43f6237cc 2/6
9/8/2018 Jupyter Notebook Viewer
In [8]:
X = np.linspace(-6, 6, 1024)
plt.ylim(-.5, 1.5)
plt.plot(X, np.sinc(X), c = 'k')
plt.show()
In [16]:
X = np.linspace(-6, 6, 1024)
Y = np.sinc(X)
X_sub = np.linspace(-3, 3, 1024)#coordinates of subplot
Y_sub = np.sinc(X_sub) # coordinates of sub plot
plt.plot(X, Y, c = 'b')
sub_axes = plt.axes([.6, .6, .25, .25])# coordinates, length and width of the subplot f
sub_axes.plot(X_detail, Y_detail, c = 'r')
plt.show()
Log Scale
http://nbviewer.jupyter.org/gist/manujeevanprakash/7d8a9860f8e43f6237cc 3/6
9/8/2018 Jupyter Notebook Viewer
In [20]:
#The logarithm base is 10 by default, but it can be changed with the optional paramete
Polar Coordinates
In [23]:
http://nbviewer.jupyter.org/gist/manujeevanprakash/7d8a9860f8e43f6237cc 4/6
9/8/2018 Jupyter Notebook Viewer
In [25]:
In [2]:
x = np.linspace(-6,6,1024)
y= np.sin(x)
plt.plot(x,y)
plt.savefig('bigdata.png', c= 'y', transparent = True) #savefig function writes that d
# will create a file named bigdata.png. Its resolution will be 800 x 600 pixels, in 8-
http://nbviewer.jupyter.org/gist/manujeevanprakash/7d8a9860f8e43f6237cc 5/6
9/8/2018 Jupyter Notebook Viewer
In [3]:
http://nbviewer.jupyter.org/gist/manujeevanprakash/7d8a9860f8e43f6237cc 6/6