Re: [Matplotlib-users] hot to draw a line connecting a list of points

2011-07-21 Thread robert rottermann
who ever migth be interested:
I achieved my goal in drawing lines trough a set of points using the path modul.

http://matplotlib.sourceforge.net/users/path_tutorial.html

robert
On 20.07.2011 20:49, robert rottermann wrote:
 hi there,

 I would like to draw a a set of lines on top of an image.
 Somehow I do not get the result I want

 these are the points ((267, 140), (380, 773), (267, 958))

 one of my divers atempts is:

 pic = plt.imread('../hlwd/effizienz_balken_01.jpg')
 pic = np.fliplr(np.rot90(pic, k=2))
 plt.imshow(pic)

 frame1 = plt.gca()

 lx = []
 ly = []
 for pt in ((267, 140), (380, 773), (267, 958)):
   lx.append(pt[0])
   ly.append(pt[1])
 x,y = np.array([lx, ly])
 line = mlines.Line2D(x, y, lw=5., alpha=0.4)

 frame1.add_line(line)

 plt.show()

 which produces on line instad of two.

 thanks for any pointers
 robert


 --
 10 Tips for Better Web Security
 Learn 10 ways to better secure your business today. Topics covered include:
 Web security, SSL, hacker attacks  Denial of Service (DoS), private keys,
 security Microsoft Exchange, secure Instant Messaging, and much more.
 http://www.accelacomm.com/jaw/sfnl/114/51426210/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
5 Ways to Improve  Secure Unified Communications
Unified Communications promises greater efficiencies for business. UC can 
improve internal communications as well as offer faster, more efficient ways
to interact with customers and streamline customer service. Learn more!
http://www.accelacomm.com/jaw/sfnl/114/51426253/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hot to draw a line connecting a list of points

2011-07-21 Thread Paul Ivanov
Hi Robert,

robert rottermann, on 2011-07-21 11:25,  wrote:
 who ever migth be interested:
 I achieved my goal in drawing lines trough a set of points using the path 
 modul.
 
 http://matplotlib.sourceforge.net/users/path_tutorial.html

Unless there were other considerations for getting this plot, it
really didn't have to be this complicated, read on.
 
 On 20.07.2011 20:49, robert rottermann wrote:
  frame1 = plt.gca()
  lx = []
  ly = []
  for pt in ((267, 140), (380, 773), (267, 958)):
lx.append(pt[0])
ly.append(pt[1])
  x,y = np.array([lx, ly])
  line = mlines.Line2D(x, y, lw=5., alpha=0.4)
  frame1.add_line(line)

The above can be done with just two lines:
x,y = zip(*((267, 140), (380, 773), (267, 958)))
1.plot(x,y)

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 


signature.asc
Description: Digital signature
--
5 Ways to Improve  Secure Unified Communications
Unified Communications promises greater efficiencies for business. UC can 
improve internal communications as well as offer faster, more efficient ways
to interact with customers and streamline customer service. Learn more!
http://www.accelacomm.com/jaw/sfnl/114/51426253/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users