question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1D line plot with data on the x axis

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
shoyercommented, Sep 15, 2015

I don’t think we have an easy way to do this now.

Seaborn uses the keyword argument orient='h' or orient='v' to control orientation for categorical plots like violinplot. That might be a reasonable API to emulate here.

0reactions
dcheriancommented, Feb 19, 2018

@kuchaale Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

6.4. line plots (1D)
This demo shows how the x-axis of a 1d plot can be a date time. import ... Real data types: One or multiple...
Read more >
Plotting with Matplotlib · python-data
A 1d line plot of the first column of the growth data (~t) vs the signal ... Set the current axes x-tick locations...
Read more >
Plot 1D-data on 2D with discrete X-Axis values as labels in ...
I want to plot each column values vertically. For 15 rows including header = 14 values on one horizontal x value (which is...
Read more >
1D Plot Overview
This page provides an overview of the different 1D plot features. ... Note that all frequency or time dependent plots share a corresponding...
Read more >
1D Plot Group and Polar Plot Group
You can also use 1D plot groups to create cross-section plots for solutions in 2D and 3D models. Normally the plot axes (x-axis...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found