In [1]:
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.lines as mlines
%matplotlib inline
Rectangle
In [2]:
rectangle_pos =(0.1, 0.1)
rectangle_width = 0.4
rectangle_height = 0.2
rectangle = mpatches.Rectangle(rectangle_pos, rectangle_width, rectangle_height, edgecolor='k', facecolor='blue', linewidth=1.0)
Circle
In [3]:
circle_pos = (0.8, 0.8)
circle_radius = 0.1
circle = mpatches.Circle(circle_pos, circle_radius, facecolor='C1')
Ellipse
In [4]:
ellipse_pos = (0.3, 0.8)
ellipse_width = 0.3
ellipse_height = 0.1
ellipse = mpatches.Ellipse(ellipse_pos, ellipse_width, ellipse_height, facecolor='C2')
Line
In [5]:
line_x = [0.6, 0.9]
line_y = [0.1, 0.4]
line = mlines.Line2D(line_x, line_y, linestyle="-", color='C3')
In [6]:
f,a = plt.subplots(figsize=(8.0,8.0))
a.add_artist(rectangle)
a.add_artist(circle)
a.add_artist(ellipse)
a.add_artist(line)
Out[6]: