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

Plotting Impact Map Returns Array Instead of Axes #810

Open
DanielHerzbergMeteoSwiss opened this issue Nov 22, 2023 · 2 comments
Open

Plotting Impact Map Returns Array Instead of Axes #810

DanielHerzbergMeteoSwiss opened this issue Nov 22, 2023 · 2 comments
Labels
accepting pull request Contribute by raising a pull request to resolve this issue!

Comments

@DanielHerzbergMeteoSwiss

When calling plot_imp_map function of climada.engine.forecast module, it does not return a GeoAxes object as documented (and expected) but an array containing that object.

This happens in _plot_imp_map function with the following code:

    if not isinstance(axis_sub, np.ndarray):
        axis_sub = np.array([[axis_sub]])

The return value of the function should a GeoAxes object analog to the other plotting functions.

@chahank
Copy link
Member

chahank commented Nov 22, 2023

Thanks for noting! Would it be possible for you to make a pull request with a bugfix?

@peanutfun
Copy link
Member

@DanielHerzbergMeteoSwiss Thanks for the report! I think the idea of the code was to return what plt.subplots returns. But the implementation does not really hit the mark. plt.subplots returns a squeezed numpy array of the plots, e.g. an array [[ax1, ax2], [ax3, ax4]] for two rows and columns, and array [ax1, ax2] for one row, two columns, and ax (no numpy array) for a single row and column. A suggestion for improvement would be very welcome!

@peanutfun peanutfun added the accepting pull request Contribute by raising a pull request to resolve this issue! label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting pull request Contribute by raising a pull request to resolve this issue!
Projects
None yet
Development

No branches or pull requests

3 participants