Skip to content

colorbars in facet grids #1717

Closed
Closed
@JoyMonteiro

Description

@JoyMonteiro

Hello,

In the 0.9.6 version, it does not appear to be possible to pass any arguments to the colorbar plotting
routine.

func_kwargs.update({'add_colorbar': False, 'add_labels': False})

explicitly sets set_colorbar = False, which makes sense.

However, if we want horizontal colorbars, or any way of adjusting the colorbar plotted (it is huge and unwieldy), it would be good if the plotting routine checks for and passes suitable arguments to

self.add_colorbar()

I tried hacking something together, I can do something like the following now:

import xarray
import matplotlib.pyplot as plt

data = xarray.open_dataset('/data/ERSST/sst.mnmean.old.nc').sst

data = data.loc[dict(time=slice('1999-1', '1999-4'))]
data.plot.contourf(col='time', col_wrap=2, levels=12, cbar_kwargs=dict(orientation='horizontal',
                                                pad=0.1, aspect=30, shrink=0.6, ticks=[0, 10, 20 ,30]))

which produces:

figure_1

Is something like this available in the development version? If not, and it seems like a useful feature, I can create a PR.

Joy

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