/ Python And R Data science skills: 71 Object Oriented plots

Friday 16 February 2018

71 Object Oriented plots

https://vlrtraining.com/courses/python-data-science-beginner-tutorial ------------------------------------------------------- 71 Object Oriented plots
In [14]:
import matplotlib.pyplot as plt
 import numpy as np
x = np.linspace(0, 5, 11)
y = x ** 2 
%matplotlib inline
In [31]:
 import numpy as np
x = np.linspace(0, 5, 11)
y = x ** 2 
In [32]:
%matplotlib inline
In [58]:
# Create Figure (empty canvas)
#fig = plt.figure()

# Add set of axes to figure
#axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)

# Plot on that set of axes
# axes.plot(x, y, 'b')
# axes.set_xlabel('Set X Label') # Notice the use of set_ to begin methods
# axes.set_ylabel('Set y Label')
# axes.set_title('Set Title')
In [66]:
fig1=plt.figure()
axes1=fig1.add_axes([0.1,0.1,0.8,0.8])
axes1.plot(x,y,"r")
axes1.set_xlabel("my x label")
axes1.set_ylabel("my y label")
axes1.set_title("Mydata")
Out[66]:
Text(0.5,1,'Mydata')
In [62]:
fig1=plt.figure()
axes1=fig1.add_axes([0.1,0.1,0.2,0.1])

No comments:

Post a Comment