10000 linking front thumbnails, updating screenshots + pyplot API page by choldgraf · Pull Request #8581 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

linking front thumbnails, updating screenshots + pyplot API page #8581

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 7 commits into from
May 12, 2017

Conversation

choldgraf
Copy link
Contributor

This links the frontpage thumbnails to the sphinx gallery versions so that we don't have to create them manually. Also moves screenshots.rst to a tutorial so continue the consolidation.

@choldgraf choldgraf mentioned this pull request May 6, 2017
11 tasks
@dstansby dstansby added this to the 2.1 (next point release) milestone May 7, 2017
@choldgraf choldgraf force-pushed the front_thumbnails branch from 4beaeec to 65fe2ee Compare May 7, 2017 17:15
@choldgraf choldgraf force-pushed the front_thumbnails branch from 65fe2ee to aa88fae Compare May 7, 2017 17:18
@choldgraf choldgraf changed the title linking front thumbnails and updating screenshots linking front thumbnails, updating screenshots + API pages May 7, 2017
@choldgraf choldgraf changed the title linking front thumbnails, updating screenshots + API pages linking front thumbnails, updating screenshots + pyplot API page May 7, 2017
@story645
Copy link
Member
story645 commented May 7, 2017

:/ categorical doesn't work on numpy < 1.8 (#7988) and I'll go fix that bug now... Nevermind, that's not the bug here...confused then...

@QuLogic
Copy link
Member
QuLogic commented May 7, 2017

Do you have a screenshot of what it looks like? The main reason for the static images is that they don't look very good when scaled down (not that the existing ones are amazing examples in their own right.)

@choldgraf
Copy link
Contributor Author

@QuLogic see the live version here:

http://predictablynoisy.com/matplotlib/

the only difference I can tell is that the images are slightly smaller, but the resolution is actually higher I think.

@story645 it seems like the error is not related to this PR, no?

@story645
Copy link
Member
story645 commented May 8, 2017

Yeah, realized it wasn't and edited my comment as such...though did open #8592 to fix that bug since it was so long overdue.

@choldgraf
Copy link
Contributor Author

woot!


data = np.random.randn(2, 100)
Copy link
Member

Choose a reason for hiding this comment

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

please add seeds to random examples

"""
import matplotlib.pyplot as plt

names = ['group_a', 'group_b', 'group_c']
Copy link
Member

Choose a reason for hiding this comment

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

I'm in favor of more concrete examples. Here's some I did...and yes should have just added to matplotlib:

data = {'apples':10, 'oranges':15, 'lemons':5, 'limes':20}

Also:

cat = ["bored", "happy", "bored", "bored", "happy", "bored"]
dog = ["happy", "happy", "happy", "happy", "bored", "happy"]
time = ["combing", "drinking","feeding", "napping", "playing", "washing"]

fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot(time, dog, label="dog")
ax.plot(time, cat, label="cat")
ax.legend()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol that's awesome, I'll replace w/ your example here, and maybe leave the tutorial as-is? Or add another example? WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

I think two is good enough since categorical is supported by whatever methods are supported by pyplot and I don't even know that list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cool - in the latest push I just have two little examples in the example script, and didn't change the tutorial

@choldgraf
Copy link
Contributor Author

ok - comments addressed

@choldgraf
Copy link
Contributor Author

and tests passing!

names = ['group_a', 'group_b', 'group_c']
values = [1, 10, 100]

fig, axs = plt.subplots(1, 3, figsize=(9, 3))
Copy link
Member

Choose a reason for hiding this comment

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

this isn't the pyplot interface....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yes - you're right...I never use pyplot so do it without thinking :)

@choldgraf choldgraf force-pushed the front_thumbnails branch from 0347764 to a46410e Compare May 9, 2017 16:04
@choldgraf
Copy link
Contributor Author

latest push uses pyplot interface


Here you'll find a host of example plots with the code that
generated them.

.. _matplotlibscreenshots:

Simple Plot
===========

Here's a very basic :func:`~matplotlib.pyplot.plot` with text labels:
Copy link
Member

Choose a reason for hiding this comment

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

I like to avoid the word basic/simple/etc. in tutorials. What about "This is how to create a line plot with text labels"

@@ -58,8 +59,8 @@
You can add arbitrary paths in matplotlib using the
Copy link
Member

Choose a reason for hiding this comment

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

What are arbitrary paths?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure - I didn't create any of this text I just moved it here :-P I'll call it "other paths" I guess

Copy link
Member

Choose a reason for hiding this comment

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

nah, just leave it as is then and we can make it someone else's problem. I think the arbitrary is important.

@@ -133,17 +134,17 @@
Bar charts are simple to create using the :func:`~matplotlib.pyplot.bar`
Copy link
Member

Choose a reason for hiding this comment

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

Same about removing simple. Use :func:~matplotlib.pyplot.bar command to make bar charts, which including customization: (though won't hold you/hold up the pr to this since you didn't write it in the first place)

.. figure:: ../gallery/pylab_examples/images/sphx_glr_barchart_demo_001.png
:target: ../gallery/pylab_examples/barchart_demo.html
.. figure:: ../../gallery/pylab_examples/images/sphx_glr_barchart_demo_001.png
:target: ../../gallery/pylab_examples/barchart_demo.html
:align: center
:scale: 50

Barchart Demo

It's also simple to create stacked bars
Copy link
Member

Choose a reason for hiding this comment

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

same about simple

@choldgraf
Copy link
Contributor Author

latest push removes the ableist language. The City of Berkeley would be proud of this PR now ;-)

@choldgraf
Copy link
Contributor Author

I think the non-passing-travis build is not related to this PR

@choldgraf
Copy link
Contributor Author
choldgraf commented May 9, 2017

(dunno what's up with the appveyor build...that doesn't build any docs anyway tho I believe)

@choldgraf
Copy link
Contributor Author

can somebody restart those appveyor builds?

@QuLogic
Copy link
Member
QuLogic commented May 10, 2017

Done.

Copy link
Member
@story645 story645 left a comment

Choose a reason for hiding this comment

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

these are all non-blocking nitpicks


Most of these functions also exist as methods in the
:class:`matplotlib.axes.Axes` class. You can use them with the
so-called "Object Oriented" approach to Matplotlib.
Copy link
Member

Choose a reason for hiding this comment

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

don't need so-called (it's redundant)

Many times you want to create a plot that uses categorical variables
in Matplotlib. For example, your data may naturally fall into
several "bins" and you're interested in summarizing the data per
bin. Matplotlib allows you to pass categorical variables directly to
Copy link
Member

Choose a reason for hiding this comment

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

Don't think you need this sentence since this is a histogram:

For example, your data may naturally fall into several "bins" and you're interested in summarizing the data per bin.

@@ -243,8 +245,8 @@
You can plot date data with major and minor ticks and custom tick formatters
Copy link
Member

Choose a reason for hiding this comment

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

You can plot timeseries data ('cause date data is hard to parse)

@choldgraf
Copy link
Contributor Author

ok - I'll hold off to see if anybody else has suggestions, and if not then I'll make @story645 's edits and then merge?

Copy link
Member
@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

LGTM mostly, but some minor stuff you can fix with @story645's stuff.

# Plotting with categorical variables
# ===================================
#
# It is also possible to create a plot using categorical variables
Copy link
Member

Choose a reason for hiding this comment

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

Missing period.


Here's a very basic :func:`~matplotlib.pyplot.plot` with text labels:
Here's now to create a line plot with text labels using
Copy link
Member

Choose a reason for hiding this comment

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

Here's how?

@@ -55,11 +57,11 @@
Path demo
=========

You can add arbitrary paths in matplotlib using the
You can add other paths in matplotlib using the
Copy link
Member

Choose a reason for hiding this comment

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

Matplotlib

Copy link
Member
F987

Choose a reason for hiding this comment

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

Also needs to be arbitrary cause the arbitrary is in reference to the shape of the part (line, circle, curve)

Plotting categorical variables
==============================

How to use categorical variables in matplotlib.
Copy link
Member

Choose a reason for hiding this comment

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

Matplotlib


.. currentmodule:: matplotlib.pyplot

.. autofunction:: plotting

The Object-Oriented API
Copy link
Member
@QuLogic QuLogic May 11, 2017

Choose a reason for hiding this comment

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

Should we put this above the Pyplot API section? It could be formatted as an aside/callout/warning if needed. But I think autofunction generates a big table of functions (your site appears to be rendering a different PR, so I'm not sure), so no-one will ever see this recommendation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack yeah I'm sorry - I've got a buncha PRs open so it's hard to remember which one I've pushed to the website. I imagined just adding the section on OO stuff to the pyplot summary. It felt weird to put it at the beginning because the page is called pyplot. What if we instead called the page plotting API instead of pyplot? Then I could add the OO stuff first.

Copy link
Contributor Author
@choldgraf choldgraf May 11, 2017

Choose a reason for hiding this comment

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

I should note - this is why I put the .. contents:: bit at the top of the page - it'll render a table of contents that will list all the sections. I hoped that would make it easier to find the OO section (and the colormaps section...though TBH I'm still not really sure why that section is on this page ¯\(ツ)/¯ )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just pushed this PR to the live version: http://predictablynoisy.com/matplotlib/api/pyplot_summary.html

Copy link
Member

Choose a reason for hiding this comment

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

We should probably think about this a bit in a later PR.

@choldgraf
Copy link
Contributor Author

ok comments addressed!

@choldgraf
Copy link
Contributor Author

Looks like all tests are passing - the latest commit was just capitalizing one instance of matplotlib that I had missed...

@choldgraf
Copy link
Contributor Author

anything to do here? ready to 🚢 or still need to ⚓️ ? :D

@story645
Copy link
Member
story645 commented May 12, 2017

I'm fine with you merging, but lets try pinging @QuLogic

@QuLogic QuLogic merged commit 9a80cf6 into matplotlib:master May 12, 2017
@choldgraf
Copy link
8F58
Contributor Author

woo! :)

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.

4 participants
0