Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def plot(self):
- import numpy as np
- from matplotlib import pyplot as plt
- fig = plt.figure()
- ax = fig.add_subplot(111)
- # plot triangle
- ax.plot(np.hstack((self.v[:, 0], self.v[0, 0])),
- np.hstack((self.v[:, 1], self.v[0, 1])),
- 'k-', label='Triangle')
- ax.axis('equal')
- ax.grid(ls='--', lw=0.6)
- ax.legend()
- return ax
- def plot(self):
- from matplotlib import pyplot as plt
- import numpy as np
- alpha = np.linspace(0, 2 * np.pi, 1000)
- self.x = self.center[0] + self.radius * np.cos(alpha)
- self.y = self.center[1] + self.radius * np.sin(alpha)
- fig = plt.figure()
- ax = fig.add_subplot(111)
- # plot circle
- ax.plot(self.x, self.y, 'r-', label='Circle')
- ax.axis('equal')
- ax.grid(ls='--', lw=0.6)
- ax.legend()
- return ax
- def plotintrianglecircle(self):
- from matplotlib import pyplot as plt
- c = Circle(self.center, self.radius)
- fig1 = c.plot()
- fig2 = self.plot()
- plt.plot(fig1)
- plt.hold(True)
- plt.plot(fig2)
- return
Add Comment
Please, Sign In to add comment