help with matplotlib.path class

Hello list,

I have generated the following tuples:

(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2)
((39525.540000000001, 144.91), (39525.540000000001, 161.352),
(39874.5, 149.5), (39874.5, 166.142), (40205.0, 150.41), (40205.0,
167.05199999999999), (40518.449999999997, 149.36000000000001),
(40518.449999999997, 166.00200000000001), (40828.0,
148.50999999999999), (40828.0, 165.15199999999999),
(41173.239999999998, 151.16), (41173.239999999998, 167.602), (41510.0,
150.09), (41510.0, 166.732), (41858.0, 146.25), (41858.0, 162.892),
(42158.0, 152.63999999999999), (42158.0, 169.28199999999998),
(42486.889999999999, 155.22999999999999), (42486.889999999999,
171.672))

How do I use the Matplotlib.path class to draw a set of disconnected
vertical lines?

Thanks in advance,
AMaity.

If your first tuple is "codes", and second is "vertices",

You can do:

from matplotlib import path
from matplotlib import patches
from matplotlib import pyplot as plt

patch = patches.PathPatch(path.Path(vertices, codes))
plt.gca().add_patch(patch)
plt.show()

However... rather than going through all that, have you considered using vlines? That will save you the trouble of generating all the data in that format yourself.

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.vlines

Cheers,
Mike

Amitava Maity wrote:

···

  Hello list,

I have generated the following tuples:

(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2)
((39525.540000000001, 144.91), (39525.540000000001, 161.352),
(39874.5, 149.5), (39874.5, 166.142), (40205.0, 150.41), (40205.0,
167.05199999999999), (40518.449999999997, 149.36000000000001),
(40518.449999999997, 166.00200000000001), (40828.0,
148.50999999999999), (40828.0, 165.15199999999999),
(41173.239999999998, 151.16), (41173.239999999998, 167.602), (41510.0,
150.09), (41510.0, 166.732), (41858.0, 146.25), (41858.0, 162.892),
(42158.0, 152.63999999999999), (42158.0, 169.28199999999998),
(42486.889999999999, 155.22999999999999), (42486.889999999999,
171.672))

How do I use the Matplotlib.path class to draw a set of disconnected
vertical lines?

Thanks in advance,
AMaity.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA