[Matplotlib-users] Problems using triplot from file

2010-09-27 Thread radfahrer

Hi everybody,
I am trying to plot a triangular grid from a textfile using triplot, but all
I get is some wired straight line

code:

import numpy as np
import matplotlib.pyplot as plt

x, y = np.loadtxt('points.dat', unpack=True)
triangles = np.loadtxt('triangles.dat', dtype=np.int32)

plt.triplot(x, y, triangles, 'go-')

Thanks


http://old.nabble.com/file/p29815755/points.dat points.dat 
http://old.nabble.com/file/p29815755/triangles.dat triangles.dat 


-- 
View this message in context: 
http://old.nabble.com/Problems-using-triplot-from-file-tp29815755p29815755.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems using triplot from file

2010-09-27 Thread Ian Thomas
On 27 September 2010 15:37, radfahrer clem...@m-info.de wrote:

 I am trying to plot a triangular grid from a textfile using triplot, but
 all
 I get is some wired straight line


Your triangulation consists of just two triangles, the first with vertices
(0, 0) (0.1, 0.1) (0.1, 0.1) and the second (0, 0), (0.1, 0.1), (0, 0).
Each of these triangles has duplicate vertices and is therefore a straight
line.

In fact you only have three distinct points in your points.dat file, at (0,
0), (0.05, 0.05), and (0.1, 0.1).  You can never construct a triangle which
isn't a straight line with these points.  Perhaps you intended your
points.dat file to be something like

0  0
0  0.05
0  0.1
0.05 0
0.05  0.05
0.05  0.1
0.1  0
0.1  0.05
0.1  0.1

Ian
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users