home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 912724289

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/pull/5763#issuecomment-912724289 https://api.github.com/repos/pydata/xarray/issues/5763 912724289 IC_kwDOAMm_X842ZxFB 14371165 2021-09-03T18:19:02Z 2021-09-03T18:19:02Z MEMBER

What would you expect the plot to look like if you input a complex number or a multiindex along the x-axis? I think I would expect it to be shown like a flattened array. And you can kind of get away with that if you cast the arrays to string before hand.

```python x = 1j * np.arange(0, 5) y = np.arange(5, 10) plt.plot(x, y) ComplexWarning: Casting complex values to real discards the imaginary part return np.asarray(x, float) ``` ![image](https://user-images.githubusercontent.com/14371165/132037646-8ade69af-9201-4218-a2d2-1cb1c6954328.png) ```python x = 1j * np.arange(0, 5) y = np.arange(5, 10) plt.plot(np.vectorize(str)(x), y) ``` ![image](https://user-images.githubusercontent.com/14371165/132037845-cf04623e-5f36-4d65-b5b4-b2433366fe14.png) ```python x = 1j + np.arange(0, 5) y = np.arange(5, 10) plt.plot(np.vectorize(str)(x), y) ``` ![image](https://user-images.githubusercontent.com/14371165/132039166-720de3f9-ef16-419b-aaf6-68f9dac6c59f.png) ```python import pandas as pd arrays = [[1, 1, 2, 2], ['red', 'blue', 'red', 'blue']] a = pd.MultiIndex.from_arrays(arrays, names=('number', 'color')).to_numpy() b = np.arange(4, 8) plt.plot(np.vectorize(str)(a), b) ``` ![image](https://user-images.githubusercontent.com/14371165/132048322-fb83cdbf-9720-4ed4-b75e-52bb7a41055f.png)
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  987559143
Powered by Datasette · Queries took 0.576ms · About: xarray-datasette