Skip to content

Set matplotlib version restrictions for conda releases #227

Closed

Description

@Ockenfuss

In the current ultraplot version, I get an attribute error when adding a colorbar:
"AttributeError: 'Colorbar' object has no attribute '_long_axis'"

Example:

import numpy as np
import ultraplot as uplt

lons = np.array([7.0, 9.0, 11.0, 13.0])
lats = np.array([48.0, 50.0, 52.0, 54.0])
colors = np.array([100, 300, 600, 900])

fig = uplt.figure(refwidth=4)
ax=fig.add_subplot(111)
im = ax.scatter(lons, lats, c=colors, cmap='plasma', vmin=0, vmax=1000)
ax.colorbar(im, label='Example Value')

Is this just me?

Traceback:

  File "ultraplot_colorbar_bug.py", line 14, in <module>
    ax.colorbar(im, label='Example Value')
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "virtual_environments/mamba_envs/ultraplot/lib/python3.13/site-packages/ultraplot/axes/base.py", line 3263, in colorbar
    return self._add_colorbar(mappable, values, loc=loc, align=align, **kwargs)
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "virtual_environments/mamba_envs/ultraplot/lib/python3.13/site-packages/ultraplot/internals/warnings.py", line 118, in _deprecate_kwargs_wrapper
    return func_orig(*args, **kwargs)
  File "virtual_environments/mamba_envs/ultraplot/lib/python3.13/site-packages/ultraplot/axes/base.py", line 1353, in _add_colorbar
    for label in obj._long_axis().get_ticklabels():
                 ^^^^^^^^^^^^^^
AttributeError: 'Colorbar' object has no attribute '_long_axis'. Did you mean: 'long_axis'?

Activity

  1. cvanelteren commented on May 21, 2025

    @cvanelteren
    Collaborator

    You are using matplotlib 3.10 or above which is currently not supported.
    For context we are waiting for basemap to update before we can update because basemap is not supporting the latest versions of numpy at the moment.

  2. cvanelteren commented on May 21, 2025

    @cvanelteren
    Collaborator

    Downgrading will fix your problem ;-)

  3. Ockenfuss commented on May 21, 2025

    @Ockenfuss
    Author

    I see, thanks (as always!) for the quick answer! In this case, maybe the requirement for matplotlib<3.10 should also be included in the conda recipe for the time being? I originally checked my issue above with a fresh conda environment. It seems, currently this is not reflected in conda, see https://github.com/conda-forge/ultraplot-feedstock/blob/main/recipe/meta.yaml

  4. cvanelteren commented on May 21, 2025

    @cvanelteren
    Collaborator

    @beckermr can you address this^

  5. changed the title [-]Colorbars are broken in ultraplot 1.50.2?[/-] [+]Set matplotlib version restrictions for conda releases[/+] on May 21, 2025
  6. beckermr commented on May 21, 2025

    @beckermr
    Collaborator

    Yes I can fix this today. I thought we had solved MPL 3.10 compat in this PR: #33

    I guess since it is not in our test matrix, we are not keeping up to date.

  7. beckermr commented on May 21, 2025

    @beckermr
    Collaborator

    PR here: conda-forge/conda-forge-repodata-patches-feedstock#1029

    Plus I adjusted the feedstock

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions