Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73462
| References | <ae0491e6-70de-4cc3-aea4-8922f72e17b8@googlegroups.com> <mailman.11167.1403272031.18130.python-list@python.org> <83defcb1-70ef-437f-87df-9f8c8164fa92@googlegroups.com> |
|---|---|
| Date | 2014-06-20 10:52 -0400 |
| Subject | Re: Matplotlib Colouring outline of histogram |
| From | Jason Swails <jason.swails@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11169.1403276280.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On Fri, Jun 20, 2014 at 10:27 AM, Jamie Mitchell < jamiemitchell1604@gmail.com> wrote: > > That's great Jason thanks for the detailed response, I went with the > easier option 1! > > I am also trying to put hatches on my histograms like so: > > plt.hist(dataset,bins=10,hatch=['*']) > > When it comes to plt.show() I get the following error message: > [snip] > > File > "/usr/local/sci/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/path.py", > line 888, in hatch > hatch_path = cls._hatch_dict.get((hatchpattern, density)) > TypeError: unhashable type: 'list' > > Do you have any idea why this is happening? > lists are mutable types, so they are not hashable (and therefore cannot be used as dictionary keywords). You need an immutable type (which _is_ hashable) to act as a dictionary key. Like strings, tuples, and basic number types (int, float, etc.). The hatch should be a string (allowable symbols are given in the API documentation). So try plt.hist(dataset, bins, hatch='*') HTH, Jason -- Jason M. Swails BioMaPS, Rutgers University Postdoctoral Researcher
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Matplotlib Colouring outline of histogram Jamie Mitchell <jamiemitchell1604@gmail.com> - 2014-06-20 01:10 -0700
Re: Matplotlib Colouring outline of histogram Jason Swails <jason.swails@gmail.com> - 2014-06-20 09:47 -0400
Re: Matplotlib Colouring outline of histogram Jamie Mitchell <jamiemitchell1604@gmail.com> - 2014-06-20 07:27 -0700
Re: Matplotlib Colouring outline of histogram Jason Swails <jason.swails@gmail.com> - 2014-06-20 10:52 -0400
Re: Matplotlib Colouring outline of histogram Jamie Mitchell <jamiemitchell1604@gmail.com> - 2014-06-20 08:10 -0700
csiph-web