Articles → MATPLOTLIB → Add an axes dynamically in matplotlib using add_axes function
Add an axes dynamically in matplotlib
using add_axes function
Steps
Example
import matplotlib.pyplot as plt
import array
arr1 = array.array('i', [1, 2, 3])
arr2 = array.array('i', [4, 5, 6])
# Create a figure object
fig = plt.figure()
# add axis
axes = fig.add_axes([.1,.1,.8,.8])
# Plot graph
axes.plot(arr1,arr2)
# Show graph
plt.show()
Output
Click to Enlarge