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

Option to add individual color bar for each variable when using the Faceting #7369

Open
WalidGharianiEAGLE opened this issue Dec 8, 2022 · 1 comment

Comments

@WalidGharianiEAGLE
Copy link

WalidGharianiEAGLE commented Dec 8, 2022

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

@WalidGharianiEAGLE WalidGharianiEAGLE changed the title Option to add indivual barplots for each variable when using the Faceting Option to add indivual color bar for each variable when using the Faceting Dec 8, 2022
@headtr1ck
Copy link
Collaborator

Duplicate of #7342 (but not your fault, the title is misleading).

@WalidGharianiEAGLE WalidGharianiEAGLE changed the title Option to add indivual color bar for each variable when using the Faceting Option to add individual color bar for each variable when using the Faceting Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants