Title: DOC: Add more explanatory comments to gallery examples · Issue #11654 · matplotlib/matplotlib · GitHub
Open Graph Title: DOC: Add more explanatory comments to gallery examples · Issue #11654 · matplotlib/matplotlib
X Title: DOC: Add more explanatory comments to gallery examples · Issue #11654 · matplotlib/matplotlib
Description: @erinleeryan raised the concern that many of the matplotlib gallery examples have very little to no prose documentation, which can be frustrating for users unfamiliar with matplotlib conventions. For example, in the stem plot example bel...
Open Graph Description: @erinleeryan raised the concern that many of the matplotlib gallery examples have very little to no prose documentation, which can be frustrating for users unfamiliar with matplotlib conventions. F...
X Description: @erinleeryan raised the concern that many of the matplotlib gallery examples have very little to no prose documentation, which can be frustrating for users unfamiliar with matplotlib conventions. F...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/11654
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DOC: Add more explanatory comments to gallery examples","articleBody":" @erinleeryan raised the concern that many of the matplotlib gallery examples have very little to no prose documentation, which can be frustrating for users unfamiliar with matplotlib conventions. \r\nFor example, in the [stem plot example](https://matplotlib.org/gallery/lines_bars_and_markers/stem_plot.html#sphx-glr-gallery-lines-bars-and-markers-stem-plot-py) below it is unclear what markerline, stemlines, and baseline are relative the plot, and why `plt.stem` returns those three objects and what the `plt.setp` function is doing. \r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\n\r\nx = np.linspace(0.1, 2 * np.pi, 10)\r\nmarkerline, stemlines, baseline = plt.stem(x, np.cos(x), '-.')\r\nplt.setp(baseline, color='r', linewidth=2)\r\n\r\nplt.show()\r\n```\r\n\r\nAs suggested by @erinleeryan, it would be a welcome improvement to the docs to add short one line comments explaining what each line is doing, as shown in the [pie chart](https://matplotlib.org/gallery/pie_and_polar_charts/pie_features.html#sphx-glr-gallery-pie-and-polar-charts-pie-features-py) example below:\r\n\r\n```python\r\n# Pie chart, where the slices will be ordered and plotted counter-clockwise:\r\nlabels = 'Frogs', 'Hogs', 'Dogs', 'Logs'\r\nsizes = [15, 30, 45, 10]\r\nexplode = (0, 0.1, 0, 0) # only \"explode\" the 2nd slice (i.e. 'Hogs')\r\n\r\nfig1, ax1 = plt.subplots()\r\nax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',\r\n shadow=True, startangle=90)\r\nax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.\r\n\r\nplt.show()\r\n```\r\n\r\nAs an aside, we probably should also remove \"simple\" and \"basic\" from the titles of examples, as the gallery image will indicate the level of complexity of the example to the user. \r\n\r\n","author":{"url":"https://github.com/story645","@type":"Person","name":"story645"},"datePublished":"2018-07-13T22:54:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/11654/matplotlib/issues/11654"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7cccd07e-a445-6dd8-2a2a-f1afc72bd29f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C93A:16E576:6994F2:8CB11A:6A51D3D5 |
| html-safe-nonce | 22a7deb232d6a5cac311f1b13575117d9715e02ea6afb3da8102dc02d9303b8f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTNBOjE2RTU3Njo2OTk0RjI6OENCMTFBOjZBNTFEM0Q1IiwidmlzaXRvcl9pZCI6IjIwMzc5MTU2NjY4MDg0Mjc0NzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7462dc420d75cd417d550f6c6a237aceedf21842a15ae5f6be85ae3aa9519a14 |
| hovercard-subject-tag | issue:341181370 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/11654/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c0218156b6035fadc3700f82680937dc19f20cd7b6ee76c18ee624dfb7ed0c92/matplotlib/matplotlib/issues/11654 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c0218156b6035fadc3700f82680937dc19f20cd7b6ee76c18ee624dfb7ed0c92/matplotlib/matplotlib/issues/11654 |
| og:image:alt | @erinleeryan raised the concern that many of the matplotlib gallery examples have very little to no prose documentation, which can be frustrating for users unfamiliar with matplotlib conventions. F... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | story645 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width