Skip to content

Labeling dims with units #6594

Answered by andersy005
ercius asked this question in Q&A
May 11, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

The X and Y labels should have a similar [meters] or [Angstroms] in the plot.

@ercius, have you tried the following???

In [5]: dd.X.attrs['units'] = 'm'

In [6]: dd.Y.attrs['units'] = 'm'

In [8]: dd.Y
Out[8]: 
<xarray.DataArray 'Y' (Y: 10)>
array([0.      , 0.111111, 0.222222, 0.333333, 0.444444, 0.555556, 0.666667,
       0.777778, 0.888889, 1.      ])
Coordinates:
  * Y        (Y) float64 0.0 0.1111 0.2222 0.3333 ... 0.6667 0.7778 0.8889 1.0
Attributes:
    units:    m

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ercius
Comment options

Answer selected by ercius
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants