Title: Remember metadata when passing mappables to colorbar() · Issue #81 · proplot-dev/proplot · GitHub
Open Graph Title: Remember metadata when passing mappables to colorbar() · Issue #81 · proplot-dev/proplot
X Title: Remember metadata when passing mappables to colorbar() · Issue #81 · proplot-dev/proplot
Description: I have another suggestion of enhancement regarding what Cartopy does. By default, ProPlot uses the long_name attribute of a DataArray as a title of the figure, but not the units attribute. Here is the default behavior of Cartopy when doi...
Open Graph Description: I have another suggestion of enhancement regarding what Cartopy does. By default, ProPlot uses the long_name attribute of a DataArray as a title of the figure, but not the units attribute. Here is ...
X Description: I have another suggestion of enhancement regarding what Cartopy does. By default, ProPlot uses the long_name attribute of a DataArray as a title of the figure, but not the units attribute. Here is ...
Opengraph URL: https://github.com/proplot-dev/proplot/issues/81
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Remember metadata when passing mappables to colorbar()","articleBody":"I have another suggestion of enhancement regarding what **Cartopy** does. By default, **ProPlot** uses the `long_name` attribute of a DataArray as a `title` of the figure, but not the `units` attribute. Here is the default behavior of **Cartopy** when doing a plot (data: [ens_avg_snow_cyclic.zip](https://github.com/lukelbd/proplot/files/3922734/ens_avg_snow_cyclic.zip)):\r\n\r\n```python\r\nimport xarray as xr\r\nimport proplot as plot\r\n\r\nens_avg_snow_cyclic = xr.open_dataarray('ens_avg_snow_cyclic.nc')\r\nens_avg_snow_cyclic.plot()\r\n```\r\n\r\n\r\nIt automatically puts the `long_name` and `units` attribute of the DataArray beside the color bar. In addition, it writes as a title the coordinates left (I didn't do any projection, the goal is only to show the labels here).\r\n\r\nIt would be nice to at least have the `units` after the title in **ProPlot** too, in addition to the actual default behavior shown here:\r\n```python\r\nf, axs = plot.subplots(proj='cyl', width=8)\r\n\r\nm = axs[0].contourf(ens_avg_snow_cyclic, cmap='BuRd')\r\n\r\nf.colorbar(m)\r\n\r\naxs.format(\r\n geogridlinewidth=0.5, geogridcolor='gray8', geogridalpha=0.5, labels=True, \r\n coast=True, ocean=True, oceancolor='gray3', latlim=(20,90),\r\n suptitle=str(ens_avg_snow_cyclic.season.values) + ' climatology'\r\n)\r\n```\r\n\r\n\r\nLike for example (here are 3 different possibilies I am thinking):\r\n\r\n\r\n\r\n\r\nOr having the same behavior as **Cartopy** like the 2nd example and putting as a title the left coordinates as `coord_name = values`. Here it is the season, but usually, if we select a date, it shows `time = ...`. After it doesn't have to be like Cartopy, in my opinion adding at least the units would be already nice :)\r\n","author":{"url":"https://github.com/mickaellalande","@type":"Person","name":"mickaellalande"},"datePublished":"2019-12-04T16:07:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/81/proplot/issues/81"}
| 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:c84f795a-b421-ef22-6c91-37c9b197dc81 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A6A6:2B91BA:AE5DE5:EA3308:697D01F7 |
| html-safe-nonce | eeaae0d98634a30eaefeb8d2b59014f2ac71a3845c91decb77636147ef95330c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkE2OjJCOTFCQTpBRTVERTU6RUEzMzA4OjY5N0QwMUY3IiwidmlzaXRvcl9pZCI6IjY2ODMwNzUwMzI1MzQyODY4MzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e2878ec48fcea5504e93a792e2e210296677d083dfbed83ffb8626b9acc2eb47 |
| hovercard-subject-tag | issue:532783026 |
| 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/81/issue_layout |
| twitter:image | https://opengraph.githubassets.com/120911cafdd3404a4f7b9a595ed3375da12824c0022d581a5d4b0a7714a77f49/proplot-dev/proplot/issues/81 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/120911cafdd3404a4f7b9a595ed3375da12824c0022d581a5d4b0a7714a77f49/proplot-dev/proplot/issues/81 |
| og:image:alt | I have another suggestion of enhancement regarding what Cartopy does. By default, ProPlot uses the long_name attribute of a DataArray as a title of the figure, but not the units attribute. Here is ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mickaellalande |
| hostname | github.com |
| expected-hostname | github.com |
| None | 82ab524089fe277c33d771c5733c7383effee10e1f09eea2fd04108f9f36da11 |
| 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 | a48e5723889d629602a0b34d159dcd5fd1651351 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width