Title: Enhancement Request: grid below and ticks above · Issue #4243 · matplotlib/matplotlib · GitHub
Open Graph Title: Enhancement Request: grid below and ticks above · Issue #4243 · matplotlib/matplotlib
X Title: Enhancement Request: grid below and ticks above · Issue #4243 · matplotlib/matplotlib
Description: Hi matplotlib developers, Currently, it is not possible to have the gridlines drawn below plotlines and simultaneously have ticks drawn above plotlines. With the set_axisbelow method, the gridlines and ticks are both set either above or ...
Open Graph Description: Hi matplotlib developers, Currently, it is not possible to have the gridlines drawn below plotlines and simultaneously have ticks drawn above plotlines. With the set_axisbelow method, the gridlines...
X Description: Hi matplotlib developers, Currently, it is not possible to have the gridlines drawn below plotlines and simultaneously have ticks drawn above plotlines. With the set_axisbelow method, the gridlines...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/4243
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enhancement Request: grid below and ticks above","articleBody":"Hi matplotlib developers,\n\nCurrently, it is not possible to have the gridlines drawn below plotlines and simultaneously have ticks drawn above plotlines. With the `set_axisbelow` method, the gridlines and ticks are both set either above or below any plotlines. Here is a minimal working example:\n\n``` python\nimport numpy as np\nimport matplotlib as mpl\nimport matplotlib.pyplot as plt\n\nmpl.rcParams.update({\n'font.size':16,\n'axes.linewidth':6,\n'xtick.major.width':4,\n'ytick.major.width':4,\n'xtick.major.size':13,\n'ytick.major.size':13,\n'grid.linewidth':4,\n'grid.color':'0.8',\n})\n\nx = np.log(np.linspace(1e-3,1e+3,1e+3))\n\nplt.figure()\n\nax1 = plt.subplot(211)\nax1.plot(x,lw=10)\nax1.set_xlim(-10,1000)\nax1.set_ylim(-8,6.8)\nax1.grid()\nax1.set_axisbelow(False)\n\nax2 = plt.subplot(212)\nax2.plot(x,lw=10)\nax2.set_xlim(-10,1000)\nax2.set_ylim(-8,6.8)\nax2.grid()\nax2.set_axisbelow(True)\n\nplt.show()\n```\n\n\n\nIn the example above, in the top subplot, the `set_axisbelow(False)` method makes the gridlines above the plotline; while in the bottom subplot, the `set_axisbelow(True)` method makes the plotline above the ticks. This is unfortunate because, in my typical use case, I never want the gridlines above the data and I never want the ticks below the data, so I have to \"simulate\" a fake grid by drawing individual lines with `axvline` and `axhline`. This missing functionality was noticed at stackoverflow \nhttp://stackoverflow.com/questions/19677963/matplotlib-keep-grid-lines-behind-the-graph-but-the-y-and-x-axis-above\na while ago, where it was called a \"feature\" by @tacaswell , so I am requesting a new functionality that would allow the gridlines to be set below all other artists without affecting the axis spines or ticks. Perhaps a new axes method named `set_gridbelow` would do the trick, or an optional kwarg to `set_axisbelow`.\n\nIn any case, I can't believe that I am the only person who wants this functionality to be built-in, so I hope that you consider adding this enhancement. Thanks.\n","author":{"url":"https://github.com/u55","@type":"Person","name":"u55"},"datePublished":"2015-03-18T15:21:12.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/4243/matplotlib/issues/4243"}
| 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:5701fcf4-db29-2250-a57e-16ac294e438c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A6B2:2A1560:CAFD34:114263B:6A555C2A |
| html-safe-nonce | c7223b5ef696e0d9a93fbf809efca8bf41ad955e25cf906d57a09bc00e860cd8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkIyOjJBMTU2MDpDQUZEMzQ6MTE0MjYzQjo2QTU1NUMyQSIsInZpc2l0b3JfaWQiOiI2MjQ4NDE1MTgxMDI4MDIzMzM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | be88fc6c39f663a7490b8dbadc036bc72b0ac226ebcabe6bcd8c003098519c06 |
| hovercard-subject-tag | issue:62720127 |
| 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/4243/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2d6f4be140e0b0dd3ef76dbfa246bdc02f47bb9354579224c55e538aac7405b1/matplotlib/matplotlib/issues/4243 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2d6f4be140e0b0dd3ef76dbfa246bdc02f47bb9354579224c55e538aac7405b1/matplotlib/matplotlib/issues/4243 |
| og:image:alt | Hi matplotlib developers, Currently, it is not possible to have the gridlines drawn below plotlines and simultaneously have ticks drawn above plotlines. With the set_axisbelow method, the gridlines... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | u55 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e |
| 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 | 73595e82546ca2415571a2031890ab16ecb3001a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width