Skip to content

Misleading warning that length of ticks and ticklabels do not match #33

@AnnikaLau

Description

@AnnikaLau

Code Sample, a copy-pastable example if possible

import iconarray
import numpy as np
import psyplot.project as psy
ds = psy.open_dataset("cosmo_pollen.nc")
ds["ALNU"].values = np.digitize(ds["ALNU"].values, bins=[1, 10, 70, 250])
pollen_plot = ds.psy.plot.mapplot(
    name="ALNU",
    title="Alder Pollen in the Alpine Region on 2020-02-15 20h",
    titlesize=15,
    lakes=True,
    borders=True,
    rivers=True,
    grid_color="white",
    cticksize=8,
    clabel="Health Impact Categories",
    grid_labelsize=8,
    projection="robin",
    cmap="viridis")
colorbar_ticks = [0.5, 1.5, 2.5, 3.5, 4.5]
colorbar_bounds = list(range(0, 6, 1))
colorbar_tickslabel = ["nothing", "weak", "medium", "strong", "very strong"]
pollen_plot.update(bounds=colorbar_bounds, cticks=colorbar_ticks, cticklabels=colorbar_tickslabel)

Problem description

When running the above code, I get the warning [cticklabels] - Length of ticks (6) and ticklabels (5)do not match. However, the length of the ticks is 5. This warning is confusing as it implies the user did something wrong even though it was correct (also the plot is correct).

Expected Output

No warning

Output of psyplot -aV

Details psy_maps.plugin: requirements: cartopy: 0.21.1 version: 1.4.2 psy_reg.plugin: requirements: scipy: 1.10.0 statsmodels: 0.13.5 version: 1.4.0 psy_simple.plugin: version: 1.4.1 psy_transect.plugin: version: 0.0.1.dev0 psyplot: requirements: matplotlib: 3.4.3 numpy: 1.23.5 pandas: 1.5.3 python: 3.9.14 | packaged by conda-forge | (main, Nov 21 2022, 13:23:30) [Clang 14.0.6 ] xarray: 2022.3.0 version: 1.4.3 psyplot_gui: requirements: pyqt: 5.15.7 qt: 5.15.6 qtconsole: 5.4.0 version: 1.4.0

NOTE

Contact me, in case the data file is needed.

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