xyz
1
Hello,
I would like to draw the following triangle:
A
/ \
5 / \ 5
/ \
/ \
B--------C
4
How is it possible to draw the above triangle with Matplotlib and are there any examples?
Than you in advance.
How about:
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
pts = np.array([[0,0], [4,0], [2,np.sqrt(52 - 22)]])
p = Polygon(pts, closed=True)
ax = plt.gca()
ax.add_patch(p)
ax.set_xlim(0,4)
ax.set_ylim(0,5)
plt.show()
I looked at the example here: http://matplotlib.sourceforge.net/examples/api/bbox_intersect.html,
found through the gallery here:http://matplotlib.sourceforge.net/gallery.html for inspiration.
Angus.
···
On 27 August 2010 09:35, xyz <mitlox@…269…> wrote:
Hello,
I would like to draw the following triangle:
A
/ \
5 / \ 5
/ \
/ \
B--------C
4
How is it possible to draw the above triangle with Matplotlib and are
there any examples?
–
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh