Title: can not draw barplot with x datetime axis. · Issue #130 · proplot-dev/proplot · GitHub
Open Graph Title: can not draw barplot with x datetime axis. · Issue #130 · proplot-dev/proplot
X Title: can not draw barplot with x datetime axis. · Issue #130 · proplot-dev/proplot
Description: Hi: Proplot is vary great package and hope to update continuously. I want to draw barplot, like the code: import pandas as pd import proplot as plot df = pd.DataFrame({'a': [0,1], 'date':[pd.to_datetime('2017-04-01'), pd.to_datetime('201...
Open Graph Description: Hi: Proplot is vary great package and hope to update continuously. I want to draw barplot, like the code: import pandas as pd import proplot as plot df = pd.DataFrame({'a': [0,1], 'date':[pd.to_dat...
X Description: Hi: Proplot is vary great package and hope to update continuously. I want to draw barplot, like the code: import pandas as pd import proplot as plot df = pd.DataFrame({'a': [0,1], 'date...
Opengraph URL: https://github.com/proplot-dev/proplot/issues/130
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"can not draw barplot with x datetime axis.","articleBody":"Hi:\r\n Proplot is vary great package and hope to update continuously. I want to draw barplot, like the code:\r\n\r\n```\r\nimport pandas as pd\r\nimport proplot as plot\r\ndf = pd.DataFrame({'a': [0,1], 'date':[pd.to_datetime('2017-04-01'), pd.to_datetime('2017-04-02')]})\r\nf, axs = plot.subplots(ncols=1, figsize=(12, 6))\r\naxs[0].bar(df['date'], df['a'])\r\naxs.format(title=\"TEST\", xlabel='x axis', ylabel='y axis',\r\n large=20, small=10, xlocator='year', xminorlocator='month', xformatter='%Y')\r\n```\r\n\r\nbut I get the fellowing error. So did i do anything wrong. Thanks very much.\r\n\r\n```\r\n---------------------------------------------------------------------------\r\nTypeError Traceback (most recent call last)\r\n\u003cipython-input-83-7ba278c889ae\u003e in \u003cmodule\u003e\r\n 2 df = pd.DataFrame({'a': [0,1], 'date':[pd.to_datetime('2017-04-01'), pd.to_datetime('2017-04-02')]})\r\n 3 f, axs = plot.subplots(ncols=1, figsize=(12, 6))\r\n----\u003e 4 axs[0].bar(df['date'], df['a'])\r\n 5 axs.format(title=\"TEST\", xlabel='x axis', ylabel='y axis',\r\n 6 large=20, small=10, xlocator='year', xminorlocator='month', xformatter='%Y')\r\n\r\n~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in _wrapper(self, *args, **kwargs)\r\n 3081 @functools.wraps(func)\r\n 3082 def _wrapper(self, *args, **kwargs):\r\n-\u003e 3083 return driver(self, func, *args, **kwargs)\r\n 3084 name = func.__name__\r\n 3085 if name not in proplot_methods:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in bar_wrapper(self, func, x, height, width, bottom, left, vert, orientation, stacked, lw, linewidth, edgecolor, **kwargs)\r\n 1166 linewidth=lw, edgecolor=edgecolor,\r\n 1167 stacked=stacked, orientation=orientation,\r\n-\u003e 1168 **kwargs\r\n 1169 )\r\n 1170 \r\n\r\n~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in _wrapper(self, *args, **kwargs)\r\n 3081 @functools.wraps(func)\r\n 3082 def _wrapper(self, *args, **kwargs):\r\n-\u003e 3083 return driver(self, func, *args, **kwargs)\r\n 3084 name = func.__name__\r\n 3085 if name not in proplot_methods:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in standardize_1d(self, func, *args, **kwargs)\r\n 328 # WARNING: For some functions, e.g. boxplot and violinplot, we *require*\r\n 329 # cycle_changer is also applied so it can strip 'x' input.\r\n--\u003e 330 return func(self, x, *ys, *args, **kwargs)\r\n 331 \r\n 332 \r\n\r\n~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in _wrapper(self, *args, **kwargs)\r\n 3081 @functools.wraps(func)\r\n 3082 def _wrapper(self, *args, **kwargs):\r\n-\u003e 3083 return driver(self, func, *args, **kwargs)\r\n 3084 name = func.__name__\r\n 3085 if name not in proplot_methods:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in add_errorbars(self, func, medians, means, boxes, bars, boxdata, bardata, boxstd, barstd, boxmarker, boxmarkercolor, boxrange, barrange, boxcolor, barcolor, boxlw, barlw, capsize, boxzorder, barzorder, *args, **kwargs)\r\n 822 else:\r\n 823 xy = (x, iy) # just the stats\r\n--\u003e 824 obj = func(self, *xy, *args, **kwargs)\r\n 825 if not boxes and not bars:\r\n 826 return obj\r\n\r\n~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in _wrapper(self, *args, **kwargs)\r\n 3081 @functools.wraps(func)\r\n 3082 def _wrapper(self, *args, **kwargs):\r\n-\u003e 3083 return driver(self, func, *args, **kwargs)\r\n 3084 name = func.__name__\r\n 3085 if name not in proplot_methods:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in cycle_changer(self, func, cycle, cycle_kw, label, labels, values, legend, legend_kw, colorbar, colorbar_kw, *args, **kwargs)\r\n 1662 if name in ('bar',): # adjust\r\n 1663 if not stacked:\r\n-\u003e 1664 ix = x + (i - ncols / 2 + 0.5) * width / ncols\r\n 1665 elif stacked and not is1d:\r\n 1666 key = 'x' if barh else 'bottom'\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/ops/common.py in new_method(self, other)\r\n 62 other = item_from_zerodim(other)\r\n 63 \r\n---\u003e 64 return method(self, other)\r\n 65 \r\n 66 return new_method\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/ops/__init__.py in wrapper(left, right)\r\n 498 lvalues = extract_array(left, extract_numpy=True)\r\n 499 rvalues = extract_array(right, extract_numpy=True)\r\n--\u003e 500 result = arithmetic_op(lvalues, rvalues, op, str_rep)\r\n 501 \r\n 502 return _construct_result(left, result, index=left.index, name=res_name)\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/ops/array_ops.py in arithmetic_op(left, right, op, str_rep)\r\n 191 # by dispatch_to_extension_op.\r\n 192 # Timedelta is included because numexpr will fail on it, see GH#31457\r\n--\u003e 193 res_values = dispatch_to_extension_op(op, lvalues, rvalues)\r\n 194 \r\n 195 else:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/pandas/core/ops/dispatch.py in dispatch_to_extension_op(op, left, right)\r\n 123 # The op calls will raise TypeError if the op is not defined\r\n 124 # on the ExtensionArray\r\n--\u003e 125 res_values = op(left, right)\r\n 126 return res_values\r\n\r\nTypeError: unsupported operand type(s) for +: 'DatetimeArray' and 'float'\r\n```","author":{"url":"https://github.com/NMC-DAVE","@type":"Person","name":"NMC-DAVE"},"datePublished":"2020-03-10T01:54:07.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/130/proplot/issues/130"}
| 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:26361920-f4fe-ab65-066f-e79f9641d0ed |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E31E:B88B4:94C525:C065A5:697E5B5D |
| html-safe-nonce | c378c82d3221cf53d6cce8da226c29711cf047ac7b42adbbf77509edd0169684 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzFFOkI4OEI0Ojk0QzUyNTpDMDY1QTU6Njk3RTVCNUQiLCJ2aXNpdG9yX2lkIjoiNTQ1NjM5MDM3NjYwNjU1NDk3MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 83b1b42097deae1207c64f2fd2c25a13920bb9762d1f9e9b902659d9c4ee7ddf |
| hovercard-subject-tag | issue:578286319 |
| 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/proplot-dev/proplot/130/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fe197f2c621743794ac12d20c837c730dd68c2eb891ff5e9d866655ee0dc771c/proplot-dev/proplot/issues/130 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fe197f2c621743794ac12d20c837c730dd68c2eb891ff5e9d866655ee0dc771c/proplot-dev/proplot/issues/130 |
| og:image:alt | Hi: Proplot is vary great package and hope to update continuously. I want to draw barplot, like the code: import pandas as pd import proplot as plot df = pd.DataFrame({'a': [0,1], 'date':[pd.to_dat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NMC-DAVE |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/proplot-dev/proplot git https://github.com/proplot-dev/proplot.git |
| octolytics-dimension-user_id | 108025793 |
| octolytics-dimension-user_login | proplot-dev |
| octolytics-dimension-repository_id | 113293661 |
| octolytics-dimension-repository_nwo | proplot-dev/proplot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 113293661 |
| octolytics-dimension-repository_network_root_nwo | proplot-dev/proplot |
| 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 | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width