Allow passing figure handle to FacetGrid
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
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)
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the plotting source around get_axis, which the issue identifies as the likely entry point for accepting an existing figure. Check how FacetGrid contourf plotting currently creates axes, then define completion as allowing a created figure—and potentially a subfigure—to be passed while still supporting combination with other plots.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matplotlib, python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100