Title: inconsistent behaviour of the errorevery option in pyplot.errorbar() to the markevery keyword · Issue #4438 · matplotlib/matplotlib · GitHub
Open Graph Title: inconsistent behaviour of the errorevery option in pyplot.errorbar() to the markevery keyword · Issue #4438 · matplotlib/matplotlib
X Title: inconsistent behaviour of the errorevery option in pyplot.errorbar() to the markevery keyword · Issue #4438 · matplotlib/matplotlib
Description: When I set markevery and errorevery keywords together in pyplot.errorbar(), it works only in the case for an integer parameter. However, though the markevery keyword in pyplot.plot() allows more options as an input ([None | int | length-...
Open Graph Description: When I set markevery and errorevery keywords together in pyplot.errorbar(), it works only in the case for an integer parameter. However, though the markevery keyword in pyplot.plot() allows more op...
X Description: When I set markevery and errorevery keywords together in pyplot.errorbar(), it works only in the case for an integer parameter. However, though the markevery keyword in pyplot.plot() allows more op...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/4438
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"inconsistent behaviour of the errorevery option in pyplot.errorbar() to the markevery keyword","articleBody":"When I set `markevery` and `errorevery` keywords together in `pyplot.errorbar()`, it works only in the case for an integer parameter. However, though the `markevery` keyword in `pyplot.plot()` allows more options as an input ([None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]), `errorbar()` cannot handle such options. It would be nice if `errorevery` can accept the same kind of inputs as `markevery`. \n\nHere is a piece of code which demonstrates the issue.\n\n``` python\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n# make data arrays\nndata = 10\nx = np.linspace(0, 1, ndata)\ny = np.linspace(0, 1, ndata)\nyerror = np.ones(x.size)*0.1\n\n# plot\nfig = plt.figure(figsize=(12,12))\nax1 = fig.add_subplot(221)\nax1.errorbar(x, y, yerr=yerror, fmt='o')\nax1.set_title(\"plot all points\")\nax1.set_xlim(-0.1, 1.1)\nax1.set_ylim(-0.1, 1.1)\n\nindex_plot = [1, 2, 8, 9]\n\nax2 = fig.add_subplot(222)\nax2.errorbar(x, y, yerr=yerror, fmt='o', markevery=index_plot)\nax2.set_title(\"set markevery with an array of index\")\nax2.set_xlim(-0.1, 1.1)\nax2.set_ylim(-0.1, 1.1)\n\nax3 = fig.add_subplot(223)\nax3.errorbar(x, y, yerr=yerror, fmt='o', markevery=2, errorevery=2)\nax3.set_title(\"set markevery and errorevery with an integer\")\nax3.set_xlim(-0.1, 1.1)\nax3.set_ylim(-0.1, 1.1)\n\n# the following does not work\nax4 = fig.add_subplot(224)\nax4.errorbar(x, y, yerr=yerror, fmt='o', markevery=index_plot, errorevery=index_plot)\nax4.set_title(\"set markevery and errorevery together with an array\")\nax4.set_xlim(-0.1, 1.1)\nax4.set_ylim(-0.1, 1.1)\n```\n\nI got the following error message. \n\n``` python\n---------------------------------------------------------------------------\nValueError Traceback (most recent call last)\n\u003cipython-input-43-81e2a2ded427\u003e in \u003cmodule\u003e()\n 21 \n 22 ax4 = fig.add_subplot(224)\n---\u003e 23 ax4.errorbar(x, y, yerr=yerror, fmt='o', markevery=index_plot, errorevery=index_plot)\n 24 ax4.set_title(\"set markevery and errorevery together with an array\")\n 25 ax4.set_xlim(-0.1, 1.1)\n\n/usr/local/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in errorbar(self, x, y, yerr, xerr, fmt, ecolor, elinewidth, capsize, barsabove, lolims, uplims, xlolims, xuplims, errorevery, capthick, **kwargs)\n 2713 xuplims = np.asarray(xuplims, bool)\n 2714 \n-\u003e 2715 everymask = np.arange(len(x)) % errorevery == 0\n 2716 \n 2717 def xywhere(xs, ys, mask):\n\nValueError: operands could not be broadcast together with shapes (10,) (4,) \n```\n\nAs a kind of bi-product, I found that a bool array with a length of N is also accepted as a valid input for `markevery`, but it's not documented in the manual (http://matplotlib.org/api/lines_api.html#matplotlib.lines.Line2D.set_markevery). For example, I can use `index_plot=[True, False, False, True, True, True, True, True, False, False]` in the example above. \n\nI'm using matplotlib 1.4.3 with Python 2.7.9.\n","author":{"url":"https://github.com/monodera","@type":"Person","name":"monodera"},"datePublished":"2015-05-17T17:05:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/4438/matplotlib/issues/4438"}
| 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:0c564515-6f1d-fbaf-dc84-ae44288ca536 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C972:14F0B0:17AF871:20259BD:6A535D2D |
| html-safe-nonce | 50255a7f8b764e26dcdd0e2d03648931e2323e0b2796ff6b5fb34cadb15afaf0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTcyOjE0RjBCMDoxN0FGODcxOjIwMjU5QkQ6NkE1MzVEMkQiLCJ2aXNpdG9yX2lkIjoiNTk1ODcxMDk5MTE0MzUyNTY3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 13d1eed8393d799d793e74c4a3370bce7f1eac680fc1c6297dd71d49e6f88892 |
| hovercard-subject-tag | issue:77349608 |
| 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/4438/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e402efe745ee2ad2cd63da8637aab8d9b6bff314450a4ec031f7cb3e8ca0c116/matplotlib/matplotlib/issues/4438 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e402efe745ee2ad2cd63da8637aab8d9b6bff314450a4ec031f7cb3e8ca0c116/matplotlib/matplotlib/issues/4438 |
| og:image:alt | When I set markevery and errorevery keywords together in pyplot.errorbar(), it works only in the case for an integer parameter. However, though the markevery keyword in pyplot.plot() allows more op... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | monodera |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width