Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to define default plots for xarrays/ xarray dataarrays? #84

Closed
cwerner opened this issue Oct 14, 2020 · 11 comments
Closed

Comments

@cwerner
Copy link

cwerner commented Oct 14, 2020

Hi.

I'd like to specify one or two default visualizations for an intake_xarray set. However, I cannot find any info how to specify:

  • a z-dimension I need to select
  • a datavariable

Is this possible?

Currently, I use this:

    metadata:
      plots:
        a_plot_name:
          kind: 'image'
          x: 'lon'
          y: 'lat'
          rasterize: True
@martindurant
Copy link
Member

Yes, I believe you can do exactly what you would like. The set of parameters to put in the plotting block would be the same as whatever you pass to source.plot (or .hvplot), so I would start by looking at the hvplot gallery for things that are similar for what you are after.

@cwerner
Copy link
Author

cwerner commented Oct 14, 2020

Thanks.

I‘m just puzzled how I’d specify a certain data array and select a certain level (a dimension) from the dataset to be plotted? Basically, how to specify a set of xarray sel statements before plotting...

@martindurant
Copy link
Member

@philippjfr would know which parameters to pass.

@philippjfr
Copy link

a z-dimension I need to select

I don't think you can currently select on a z-dimension (or any other dimensions), but we should definitely allow that so an issue would be appreciated. Currently you'll just get a widget to select along that dimensions.

a datavariable

To select a data variable you specify a z value.

@cwerner
Copy link
Author

cwerner commented Oct 14, 2020

Thanks @philippjfr . I’ll experiment a bit more. In my case I do have geographic soil data that also has a layer dimension and about 20 data variables. I want to plot one datavariable and the top layer to give users an impression what’s contained in the resource...

C

@aaronspring
Copy link
Collaborator

@cwerner
Copy link
Author

cwerner commented Oct 21, 2020

Hi @aaronspring

Thanks for the reference. I currently have this working like in your example, but my original idea seems not possible. Originally, I wanted to plot a simple 2d plot without selectors...

Consider this xarray dims: (lev, lat, lon) and say 2 data variables TOTC, TOTN that follow these dims. How do I define a plot for TOTC and the surface soil layer (lev=1)? I'd have to perform a select over lev in the plot definition but don't see how?

Cheers,
C

@aaronspring
Copy link
Collaborator

No idea. I would also like to know this. This is the question of subselecting the data before plotting.

@aaronspring
Copy link
Collaborator

you could try groupby: lev and then lev can be selected by hand, likely lev=1 is the default

@philippjfr
Copy link

I'm not opposed to adding sel and isel options to hvplot at least when loading from a yaml spec but these options are definitely not exposed right now.

@martindurant
Copy link
Member

See also holoviz/hvplot#505 (comment) and discussion around it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants