-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Conversation
4beaeec
to
65fe2ee
Compare
65fe2ee
to
aa88fae
Compare
:/ 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... |
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.) |
@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? |
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. |
woot! |
|
||
data = np.random.randn(2, 100) |
There was a problem hiding this comment.
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'] |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
ok - comments addressed |
and tests passing! |
tutorials/01_introductory/pyplot.py
Outdated
names = ['group_a', 'group_b', 'group_c'] | ||
values = [1, 10, 100] | ||
|
||
fig, axs = plt.subplots(1, 3, figsize=(9, 3)) |
There was a problem hiding this comment.
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....
There was a problem hiding this comment.
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 :)
0347764
to
a46410e
Compare
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: |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are arbitrary paths?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same about simple
latest push removes the ableist language. The City of Berkeley would be proud of this PR now ;-) |
I think the non-passing-travis build is not related to this PR |
(dunno what's up with the appveyor build...that doesn't build any docs anyway tho I believe) |
can somebody restart those appveyor builds? |
Done. |
There was a problem hiding this 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
doc/api/pyplot_summary.rst
Outdated
|
||
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
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? |
There was a problem hiding this 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.
tutorials/01_introductory/pyplot.py
Outdated
# Plotting with categorical variables | ||
# =================================== | ||
# | ||
# It is also possible to create a plot using categorical variables |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matplotlib
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ¯\(ツ)/¯ )
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
ok comments addressed! |
Looks like all tests are passing - the latest commit was just capitalizing one instance of |
anything to do here? ready to 🚢 or still need to ⚓️ ? :D |
I'm fine with you merging, but lets try pinging @QuLogic |
woo! :) |
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.