problem using Linecollection

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

problem using Linecollection

A397nn
I'm simply trying to draw a couple of lines using line collection, not sure why it doesn't work

import matplotlib.pyplot as plt
from matplotlib import collections as mc
import numpy as np
import pylab as pl

segments = [ [(1,2),(3,4)],
                                [(5,6),(7,8)] ]
lc = mc.LineCollection(segments, linestyles='solid', pickradius=5, zorder=2)
fig, ax = pl.subplots()

ax.add_collection(lc)
ax.autoscale()
Reply | Threaded
Open this post in threaded view
|

Re: problem using Linecollection

tcaswell
Anni,

Please subscribe to the list so that your emails will post un-moderated (https://mail.python.org/mailman/listinfo/matplotlib-users)

What is not working?

import matplotlib.pyplot as plt
from matplotlib import collections as mc
import numpy as np

segments = [ [(1,2),(3,4)],
             [(5,6),(7,8)] ]
lc = mc.LineCollection(segments, linestyles='solid', pickradius=5, zorder=2)
fig, ax = pl.subplots()

ax.add_collection(lc)
ax.autoscale()

plt.show()  # added this line to get window
fig.save('so.png') # to save as png

gives me the attached figure.

so.pngTom

On Sat, Jan 28, 2017 at 10:59 AM A397nn <[hidden email]> wrote:
I'm simply trying to draw a couple of lines using line collection, not sure
why it doesn't work

import matplotlib.pyplot as plt
from matplotlib import collections as mc
import numpy as np
import pylab as pl

segments = [ [(1,2),(3,4)],
                                [(5,6),(7,8)] ]
lc = mc.LineCollection(segments, linestyles='solid', pickradius=5, zorder=2)
fig, ax = pl.subplots()

ax.add_collection(lc)
ax.autoscale()




--
View this message in context: http://matplotlib.1069221.n5.nabble.com/problem-using-Linecollection-tp47687.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users