home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 663157223

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/4235#issuecomment-663157223 https://api.github.com/repos/pydata/xarray/issues/4235 663157223 MDEyOklzc3VlQ29tbWVudDY2MzE1NzIyMw== 8419157 2020-07-23T18:15:33Z 2020-07-23T18:18:24Z NONE

To give a bit more context, an example code simulating an experimental measurement. ``` import numpy as np import xarray as xr from scipy.stats import norm from matplotlib import pyplot as plt

nominal x

x = xr.DataArray(np.arange(-10, 10, 0.1), dims='index', name='x')

Shift loc

loc = xr.DataArray(np.arange(-0.5, 1, 0.5), dims='loc', name='loc')

Number of experiments

exp = xr.DataArray(range(3), dims='exp', name='exp')

Add noise to x per experiment

noise = xr.DataArray(np.random.rand(len(x), len(loc)), coords={'loc': loc}, dims=['index', 'loc']) x = x + noise * 0.5

Measure

y = xr.apply_ufunc( norm.pdf, x, x['loc'], 1, input_core_dims=[['index'], [], []], output_core_dims=[['index']], vectorize=True )

Name

x.name = 'x' y.name = 'y'

Merge

data = xr.merge([x, y]) I wish to be able to use this

Plot y against x

data.plot.line(x='x', y='y', hue='loc') However, the closest I could get is with only `y` y.plot.line(x='index', hue='loc') ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  659142025
Powered by Datasette · Queries took 0.814ms · About: xarray-datasette