Option to add individual color bar for each variable when using the Faceting
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?
I think such feature can be very useful specially when we have different variables (example Normalized Difference Vegetation Index (NDVI) and land surface temperature (LST) which have different values) rather than a common color bar.
%matplotlib inline
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
airtemps = xr.tutorial.open_dataset("air_temperature")
air = airtemps.air - 273.15
air.attrs = airtemps.air.attrs
air.attrs["units"] = "deg C"
aot = xr.concat([air.isel(time=0)* .01, air.isel(time=100)], "time")
# assume this is NDVI
(air.isel(time=0)* .01 ).plot()
# ndvi values cant be visualized when there is a common color bar with Faceting
aot.plot(col = 'time')
Describe the solution you'd like
# manual plot
fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 5))
for i in [0,1]:
aot.isel(time=i).plot(ax = axes[i])
Rather than manual plot to adjust each color bar, it will be more efficient to integrate this option automatically when using Faceting
Describe alternatives you've considered
No response
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 with the faceted plotting entry point shown by aot.plot(col='time') and compare its behavior with the manual matplotlib subplots example. Determine how separate colorbars should be represented and positioned for facets with different value ranges, then add coverage using the differing-scale example and verify each facet has an appropriate colorbar.
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