-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Allow to set hatches in 'area' plots #12354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@wavexx can you show an example of the matplotlib code needed to get the hatching on an area plot? |
I didn't check how area plots are made internally. It varies a bit depending on which call you're using, but most filling functions in mpl support the hatch or http://matplotlib.org/examples/pylab_examples/contourf_hatching.html It's also supported by fill_between ( https://stackoverflow.com/questions/18386106/matplotlib-hatched-fill-between-without-edges I tried to set a cycler('hatch') as my default axes.prop_cycle, but it tries to set the hatch style for the lines as well (and this obviously fails). |
@wavexx I am right that it currently is not possible at all to set hatches to area plots - not just using a cycler? I am thinking that is the case because I tried the following without success:
Thanks for any info |
As I wrote, you have to be careful to apply the style only to areas, but otherwise it will work:
Unfortunately this method is not scalable to anything but the simplest plot. |
Ok. Thanks for the confirmation. Will try |
@wavexx Sorry to be a pain but your one liner does not get hatches in jupyter notebook on OSX python 3.6.1 with the below packages. Any ideas?
|
On Fri, Jun 30 2017, Daniel Schien wrote:
@wavexx Sorry to be a pain but your one liner does not get hatches in
python 3.6.1
I'm still on MPL 2.0.0 (python 3.5) if that makes a difference.
Do you get an error, or you just don't get hatches?
|
Indeed on 3.5.1 with MPL 2.0.0 I do get hatches. It turns out the problem is MPL. |
On Fri, Jun 30 2017, Daniel Schien wrote:
Indeed on 3.5.1 with MPL 2.0.0 I do get hatches. It turns out the problem is MPL.
I also get hatches on python 3.6.1 with MPL 2.0.0. However, on 3.6.1 with MPL 2.0.2 no
hatches. No error. Just no hatches.
It might be that the returned collection just has a different order and
the hatches are set on something which is not the main area.
I'm pretty sure setting hatches directly as a kwarg in any MPL plot
commands works fine also in 2.0.2. The thing here is that there's no
correct way from the collection to get back to the series you're
plotting.
|
Alright. So setting hatches directly on the area plot fails. |
On Fri, Jun 30 2017, Daniel Schien wrote:
pd.DataFrame([1,2,3]).plot(kind='area', hatches=['.', '/', '\\'])
I get: AttributeError: Unknown property hatches
Indeed, this is what this report is about ;)
We need to relay hatches and handle the cycler properly.
|
Hi, I have the same problem and it seems like it would make sense for pd.DataFrame.plot() to take the option keyed argument hatch = [] like it does for colors, marker, etc. It has been two years since this was first reported and I have seen several hacks o how to get around this on GitHub but is anyone working on this. |
I'd like to be able to set the hatch styles (using a cycler) in plot(kind='area').
This would allow me to produce black&white plots correctly with more than two categories.
The text was updated successfully, but these errors were encountered: