X Tutup
Skip to content

API: change default 'align' for bar and barh#7172

Merged
efiring merged 3 commits intomatplotlib:v2.xfrom
tacaswell:api_bar_where
Sep 25, 2016
Merged

API: change default 'align' for bar and barh#7172
efiring merged 3 commits intomatplotlib:v2.xfrom
tacaswell:api_bar_where

Conversation

@tacaswell
Copy link
Copy Markdown
Member

Change from 'edge' to 'center'

so

@tacaswell tacaswell added this to the 2.0 (style change major release) milestone Sep 24, 2016
Copy link
Copy Markdown
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good after tiny tweaks.


def demo(bar_func, bar_kwargs):
return bar_func([1, 2, 3], [1, 2, 3], tick_label=['a', 'b', 'c'],
,**bar_kwargs)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete comma.

demo(ax4.barh, {'align': 'edge'})


To restore the previous default explicitly pass a value for ``align='edge'`` to the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"a value for" -> "the kwarg"


The default value of the ``align`` kwarg for both
`~matplotlib.Axes.bar` and `~matplotlib.Axes.barh` is changed to
``'center'`` from ``'edge'``.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this would read more smoothly with the reversed order, "from center to edge".

@efiring
Copy link
Copy Markdown
Member

efiring commented Sep 25, 2016

Travis docbuild also caught the extraneous comma.

Change from 'edge' to 'center'
@tacaswell
Copy link
Copy Markdown
Member Author

@efiring fixed and force-pushed

import matplotlib.pyplot as plt
import numpy as np

fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(5, 5))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why put this before the function?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason. A bunch of the example on this page page this ordering.

demo(ax4.barh, {'align': 'edge'})


To restore the previous default explicitly pass a the kwarg
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a the?

And I would spell out the whole words.

ax1.plot(np.arange(10), np.arange(10), 'x',
np.arange(10) + 1, np.arange(10), 'o')
ax2.bar(np.arange(10), np.arange(10))
ax2.bar(np.arange(10), np.arange(10), align='edge')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not quite "default" edges now... Not strictly necessary to update, though.

@efiring efiring merged commit 422e78a into matplotlib:v2.x Sep 25, 2016
@tacaswell tacaswell deleted the api_bar_where branch September 25, 2016 20:01
@tacaswell tacaswell mentioned this pull request Dec 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup