8000 DOC: switch to O-O interface in basic examples by phobson · Pull Request #7066 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

DOC: switch to O-O interface in basic examples #7066

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

Merged
merged 4 commits into from
Sep 22, 2016

Conversation

phobson
Copy link
Member
@phobson phobson commented Sep 8, 2016

Small PR to limit the calls to plt in the lines, bars, and markers example.

Took some artistic liberties:

  1. put the grid below the filled area
  2. added a second dashed line to this example where I set the dashes in the call to ax.plot for this example
  3. made the bars green to demonstrate the difference between color and ecolor

I think that about covers it.

for color in ['red', 'green', 'blue']:
n = 750
x, y = rand(2, n)
scale = 200.0 * rand(n)
plt.scatter(x, y, c=color, s=scale, label=color,
ax.scatter(x, y, c=color, s=scale, label=color,
alpha=0.3, edgecolors='none')
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to adjust indent for alpha?

Copy link
Member Author

Choose a reason for hiding this comment

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

@dopplershift Ahh yes. Good catch. I'll wait for the CI to wrap up before pushing again.

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Sep 8, 2016
plt.xlabel('Performance')
plt.title('How fast do you want to go today?')
ax.barh(y_pos, performance, xerr=error, align='center',
color='green', ecolor='black')
Copy link
Member

Choose a reason for hiding this comment

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

There seems to be an indentation problem here.

Copy link
Member

Choose a reason for hiding this comment

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

Or a tab & space problem.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh geez -- that's embarrassing.

@NelleV
Copy link
Member
NelleV commented Sep 8, 2016

Apart from my comments, this looks good!

@phobson phobson force-pushed the oo-interface-basic-examples branch from f8b02f6 to a9fec83 Compare September 8, 2016 23:26
@phobson
Copy link
Member Author
phobson commented Sep 9, 2016

whoops -- had to restore the labels on the barh example, and went ahead with inverting the y-axis to the labels read top-to-bottom in the same order as they are in the tuple

plt.yticks(y_pos, people)
plt.xlabel('Performance')
plt.title('How fast do you want to go today?')
ax.barh(y_pos, performance, xerr=error, align='center',
Copy link
Member

Choose a reason for hiding this comment

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

If we do not want to backport this to v2.x, this can use @story645 's categorical work. ax.barh(people, performance) should 'just work'

Copy link
Member

Choose a reason for hiding this comment

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

I am in favor of merging now and backporting, and create another PR for the categorical bar plot.

@tacaswell tacaswell merged commit f544a83 into matplotlib:master Sep 22, 2016
tacaswell added a commit that referenced this pull request Sep 22, 2016
DOC: switch to O-O interface in basic examples
Conflicts:
	examples/lines_bars_and_markers/barh_demo.py
	  whitespace vs new code
@tacaswell
Copy link
Member

Thanks!

backported to v2.x as 215fbd1

@phobson phobson deleted the oo-interface-basic-examples branch October 14, 2016 17:01
@QuLogic QuLogic modified the milestones: 2.0.1 (next bug fix release), 2.0 (style change major release) Dec 7, 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.

7 participants
0