ax.bar edgecolor fails for scalar color?

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

ax.bar edgecolor fails for scalar color?

Andrew H. Jaffe
Hi,

I've been working through Ben Root's excellent Anatomy of Matplotlib
tutorial at https://github.com/matplotlib/AnatomyOfMatplotlib/.

In the course of this (exercise 2.1 in particular), I've noticed that
the `edgecolor` argument to `ax.bar(...)` doesn't work as advertised:

 > edgecolor : scalar or array-like, optional
 >    the colors of the bar edges

However, it doesn't seem to work as a scalar: in that case it only
applies to the first bar; instead you need to supply `(color,)*len(x)`
or similar.

It fails the same way whether or not we use something like
`plt.style.use('classic')` or `mpl.rcParams['patch.force_edgecolor'] = True`

Is this a bug, something weird in my setup, or am I missing something?

Andrew

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: ax.bar edgecolor fails for scalar color?

Benjamin Root
Yeah, I think we ran into that during the live tutorial. IIRC, the `color` keyword argument was overriding the `edgecolor` keyword argument.

On Tue, Oct 10, 2017 at 10:40 AM, Andrew Jaffe <[hidden email]> wrote:
Hi,

I've been working through Ben Root's excellent Anatomy of Matplotlib tutorial at https://github.com/matplotlib/AnatomyOfMatplotlib/.

In the course of this (exercise 2.1 in particular), I've noticed that the `edgecolor` argument to `ax.bar(...)` doesn't work as advertised:

> edgecolor : scalar or array-like, optional
>    the colors of the bar edges

However, it doesn't seem to work as a scalar: in that case it only applies to the first bar; instead you need to supply `(color,)*len(x)` or similar.

It fails the same way whether or not we use something like `plt.style.use('classic')` or `mpl.rcParams['patch.force_edgecolor'] = True`

Is this a bug, something weird in my setup, or am I missing something?

Andrew

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: ax.bar edgecolor fails for scalar color?

Benjamin Root
Actually, to be honest, I can't remember what the solution was.  CC'ing Thomas because I think he figured it out later on during the tutorial.

Ben

On Tue, Oct 10, 2017 at 10:50 AM, Benjamin Root <[hidden email]> wrote:
Yeah, I think we ran into that during the live tutorial. IIRC, the `color` keyword argument was overriding the `edgecolor` keyword argument.

On Tue, Oct 10, 2017 at 10:40 AM, Andrew Jaffe <[hidden email]> wrote:
Hi,

I've been working through Ben Root's excellent Anatomy of Matplotlib tutorial at https://github.com/matplotlib/AnatomyOfMatplotlib/.

In the course of this (exercise 2.1 in particular), I've noticed that the `edgecolor` argument to `ax.bar(...)` doesn't work as advertised:

> edgecolor : scalar or array-like, optional
>    the colors of the bar edges

However, it doesn't seem to work as a scalar: in that case it only applies to the first bar; instead you need to supply `(color,)*len(x)` or similar.

It fails the same way whether or not we use something like `plt.style.use('classic')` or `mpl.rcParams['patch.force_edgecolor'] = True`

Is this a bug, something weird in my setup, or am I missing something?

Andrew

_______________________________________________
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