Skip to content

DOC: Change plot style to matplotlib decault from ggplot #17462

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 25, 2017

Conversation

topper-123
Copy link
Contributor

A proposal to change plot style in the docs to seaborn from ggplot.

See also #17423.

@jreback
Copy link
Contributor

jreback commented Sep 7, 2017

can you post a screen shot of the change (just a single page is fine, just something for people to look)

@topper-123
Copy link
Contributor Author

Some plot files:
image

image

image

image

image

image

Setting the plot style
~~~~~~~~~~~~~~~~~~~~~~~~

From version 1.5 and up, matplotlib offers a range of preconfigured plotting style. Setting these
Copy link
Contributor

Choose a reason for hiding this comment

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

can you point to the mpl docs here as well.

these styles can be used to easily give the plots have the general look that you want.
Setting the can style is as easy as calling ``matplotlib.style.use(my_plot_style)`` before
creating your plot.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the examples of plot style are necessary here, again just point to the mpl docs.

@codecov
Copy link

codecov bot commented Sep 7, 2017

Codecov Report

Merging #17462 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17462      +/-   ##
==========================================
- Coverage   91.16%   91.14%   -0.02%     
==========================================
  Files         163      163              
  Lines       49590    49590              
==========================================
- Hits        45209    45200       -9     
- Misses       4381     4390       +9
Flag Coverage Δ
#multiple 88.93% <ø> (ø) ⬆️
#single 40.25% <ø> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.72% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee6185e...6212b79. Read the comment docs.

@codecov
Copy link

codecov bot commented Sep 7, 2017

Codecov Report

Merging #17462 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17462      +/-   ##
==========================================
- Coverage   91.26%   91.24%   -0.02%     
==========================================
  Files         163      163              
  Lines       49806    49806              
==========================================
- Hits        45455    45446       -9     
- Misses       4351     4360       +9
Flag Coverage Δ
#multiple 89.04% <ø> (ø) ⬆️
#single 40.3% <ø> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.73% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6da85b3...2fec328. Read the comment docs.

@topper-123
Copy link
Contributor Author

I couldn't find a suitable page where the built-in styles are demonstarted. But it's easy enough to do yourself, so I just deleted the examples.

@jreback jreback added this to the 0.21.0 milestone Sep 11, 2017
@jreback
Copy link
Contributor

jreback commented Sep 11, 2017

lgtm. @TomAugspurger

@jorisvandenbossche
Copy link
Member

We can use whatever version of matplotlib we want to built the docs, and I suppose we will typically use the latest. Given that, we can actually also use the new improved default matplotlib 2.0 style, instead of taking a custom one.
My personal preference would be to just use the default matplotlib style now it has improved.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

minor language comments.

Setting the plot style
~~~~~~~~~~~~~~~~~~~~~~~~

From version 1.5 and up, matplotlib offers a range of preconfigured plotting style. Setting the
Copy link
Member

Choose a reason for hiding this comment

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

style -> styles

~~~~~~~~~~~~~~~~~~~~~~~~

From version 1.5 and up, matplotlib offers a range of preconfigured plotting style. Setting the
style can be used to easily give the plots the general look that you want.
Copy link
Member

Choose a reason for hiding this comment

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

the plots -> plots

@topper-123
Copy link
Contributor Author

Language changes from @jorisvandenbossche implenented.

@bashtage
Copy link
Contributor

MPL 2 isn't bad but still seaborn is nicer looking.

@jreback
Copy link
Contributor

jreback commented Sep 17, 2017

any objections to this. lgtm.

@topper-123
Copy link
Contributor Author

I propose just merging this in. If anyone got an different view point, it's easy to make a new pull request.

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Sep 19, 2017

Time for a poll!

  1. ggplot (current)
  2. seaborn (this PR)
  3. matplotlib 2.0

Voting closes in 48 hours ;)


I vote for matplotlib 2.0 > seaborn > ggplot (3 > 2 > 1)

@bashtage
Copy link
Contributor

Preferential voting n case of a tie 🥇

2 > 3 > 1

FWIW I think the current is ggplot, and this PR is proposing to use seaborn

@topper-123
Copy link
Contributor Author

2 > 3 > 1.

@jorisvandenbossche
Copy link
Member

3 > 2 > 1

@jorisvandenbossche
Copy link
Member

Any other votes ?

@jreback
Copy link
Contributor

jreback commented Sep 22, 2017

can someone post a comparison on 1, 2, 3 (for a single plot) here.

@jorisvandenbossche
Copy link
Member

First example from the docs:

In [2]: ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))

In [3]: ts = ts.cumsum()

In [4]: ts.plot()
Out[4]: <matplotlib.axes._subplots.AxesSubplot at 0x1359f45f8>
In [11]: for style in ['ggplot', 'seaborn', 'default' ]:
    ...:     with plt.style.context(style):
    ...:         fig, ax = plt.subplots()
    ...:         ts.plot(ax=ax)
    ...:         fig.savefig("test_{}.png".format(style))

test_ggplot
test_seaborn
test_default

@jorisvandenbossche
Copy link
Member

BTW, the reason I vote for 3 (matplotlib default) is not because I find it the nicest style (in that case I would actually vote for ggplot I think), but because I think it is good enough and it is the best option for our docs. When people run examples from the docs, they will most likely see the default style, and by using the default style in our docs, it will most likely match with what they see.

@jreback
Copy link
Contributor

jreback commented Sep 23, 2017

ok i can be on board with

3 > 2 > 1

@topper-123 topper-123 changed the title DOC: Change plot style to seaborn from ggplot DOC: Change plot style to matplotlib decault from ggplot Sep 25, 2017
@topper-123
Copy link
Contributor Author

ok, I've changed it, so the plot style is not, which means default style for mpl > 2. The line is commented out rather than deleted, so its easy to experiment with different styles by doing find/replace.

@jorisvandenbossche jorisvandenbossche merged commit 0e2ce9a into pandas-dev:master Sep 25, 2017
@jorisvandenbossche
Copy link
Member

@topper-123 Merged!
As a follow-up, it would be good to check the dev docs if everything is looking more or less decent (once it is built, you should see the changes here: http://pandas-docs.github.io/pandas-docs-travis/visualization.html)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants