Skip to content

1D line plot with data on the x axis #575

Description

@rabernat

Consider the following Dataset, representing a function f = cos(z)

z = np.arange(10)
ds = xray.Dataset( {'f': ('z', np.cos(z))}, coords={'z': z})

If I call

ds.f.plot()

xray naturally puts "z" on the x-axis.

However, since z represents the vertical dimension, it would be more natural do put it on the y-axis, i.e.

plt.plot(ds.f, ds.z)

This is conventional in atmospheric science and oceanography for buoy data or balloon data.

Is there an easy way to do this with xray's plotting functions? I scanned the code and didn't see an obvious solution, but maybe I missed it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions