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

Change colorbar args #41

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jeanbournhonesqueMF
Copy link

Currently it is impossible to change shrink and aspect for colorbar through "legend_kwargs" in a style.

If you try it, you get the following error :

File "/home/mprl/bournhonesquej/oper/src/labo/diagnostics/brouillard/visualisation_brouillard.py", line 63, in initialisation_figure
fig_map.legend(style=self.style, location="right")
File "/home/mprl/bournhonesquej/oper/.venv/lib/python3.11/site-packages/earthkit/plots/schemas.py", line 136, in wrapper
return function(*args, **self._update_kwargs(kwargs, keys))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mprl/bournhonesquej/oper/.venv/lib/python3.11/site-packages/earthkit/plots/components/subplots.py", line 882, in legend
legend = layer.style.legend(layer, label=kwargs.pop("label", ""), **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mprl/bournhonesquej/oper/.venv/lib/python3.11/site-packages/earthkit/plots/styles/init.py", line 649, in legend
return method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mprl/bournhonesquej/oper/.venv/lib/python3.11/site-packages/earthkit/plots/styles/init.py", line 657, in colorbar
return styles.legends.colorbar(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mprl/bournhonesquej/oper/.venv/lib/python3.11/site-packages/earthkit/plots/styles/legends.py", line 71, in colorbar
cbar = layer.fig.colorbar(
^^^^^^^^^^^^^^^^^^^
TypeError: matplotlib.figure.FigureBase.colorbar() got multiple values for keyword argument 'shrink'

The goal is to remove shrink and aspect args to be able to change it through the legend_kwargs argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant