linking front thumbnails, updating screenshots + pyplot API page#8581
linking front thumbnails, updating screenshots + pyplot API page#8581QuLogic merged 7 commits intomatplotlib:masterfrom
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! |
| import matplotlib.pyplot as plt | ||
| import numpy as np | ||
|
|
||
| data = np.random.randn(2, 100) |
There was a problem hiding this comment.
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.
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.
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.
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.
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! |
|
|
||
| names = ['group_a', 'group_b', 'group_c'] | ||
| values = [1, 10, 100] | ||
|
|
There was a problem hiding this comment.
this isn't the pyplot interface....
There was a problem hiding this comment.
ah yes - you're right...I never use pyplot so do it without thinking :)
0347764 to
a46410e
Compare
|
latest push uses pyplot interface |
| Simple Plot | ||
| =========== | ||
|
|
||
| Here's a very basic :func:`~matplotlib.pyplot.plot` with text labels: |
There was a problem hiding this comment.
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.
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.
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.
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)
|
|
||
| Barchart Demo | ||
|
|
||
| It's also simple to create stacked bars |
|
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. |
story645
left a comment
There was a problem hiding this comment.
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.
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.
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.
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? |
| # | ||
| # Plotting with categorical variables | ||
| # =================================== | ||
| # |
| ========= | ||
|
|
||
| Here's a very basic :func:`~matplotlib.pyplot.plot` with text labels: | ||
| Here's now to create a line plot with text labels using |
| ========= | ||
|
|
||
| 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.
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. |
|
|
||
| .. autofunction:: plotting | ||
|
|
||
| The Object-Oriented API |
There was a problem hiding this comment.
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.
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.
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.
Just pushed this PR to the live version: http://predictablynoisy.com/matplotlib/api/pyplot_summary.html
There was a problem hiding this comment.
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.rstto a tutorial so continue the consolidation.