home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 664067837

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
664067837 MDU6SXNzdWU2NjQwNjc4Mzc= 4255 line labels for 1D plotting 23484003 closed 0     2 2020-07-22T21:41:52Z 2020-07-22T21:47:42Z 2020-07-22T21:47:42Z NONE      

Is your feature request related to a problem? Please describe. I find myself wanting to compare multiple 1D line plots. d1 = xr.DataArray(np.ones((3,100)),dims=('channel','time'),coords={'channel':np.array(['a','b','c'])}) d1.sel(channel='a').plot() d1.sel(channel='b').plot() d1.sel(channel='c').plot() The auto-magic labeling that happens when _labels=True (the default) is to place the title as channel='a' using the function _title_for_slice(). This works fine when I only want to plot one line, but if I plot sequential lines, then the title gets over-written. So, I end up doing:

d1.sel(channel='a').plot(label='channel=a') d1.sel(channel='b').plot(label='channel=c') d1.sel(channel='c').plot(label='channel=b') which is more boiler-plate than I'd like, and prone to errors (kudos if you noticed the one I made intentionally there).

Describe the solution you'd like Basically, I'd just like to have these two lines added to the body of xarray.plot.line right around line 101:

if _labels and not "label" in kwargs: kwargs["label"] = darray._title_for_slice()

This would automatically add the title as a label. This would not change the way the plot looks in the original case, and if the caller of plot supplies a label, that will over-ride this default.

Describe alternatives you've considered Another alternative is to make a switch in plot that would allow 2D arrays to be plotted as a series of 1D line plots like this, rather than as 2D heatmaps. It would be necessary to supply an indication of which of the two axes should be used as the x-axis of the plot, and which one would supply the line labels.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4255/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 2.905ms · About: xarray-datasette