Skip to content

Allow passing figure handle to FacetGrid #7401

Open
@daliagachc

Description

@daliagachc

Is your feature request related to a problem?

Sometimes i need to combine xarray Facet grids with other ax plots. It would be amazing if I could pass a created figure to the plot function. Event better a subfigure so that the possibilities are infinite!

Describe the solution you'd like

for example:

  da = xr.tutorial.open_dataset("air_temperature")['air']
  f = plt.figure()
  (
      da
      [{'time':[1,2,4]}]
      .plot.contourf(col='time',fig = f)
  )

Describe alternatives you've considered

an alternative is to manually to all plots in a created figure, but this becomes cumbersome.
I quickly checked the source code, and it does not seem very difficult to implement. mostly a modification to the
get_axis function so that it accepts an already created figure. I managed to quickly make it work in seaborn (see image below)

image

Additional context

No response

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