Skip to content

dc.pl.dotplot: vcenter=0 does not center white color at zero when using RdBu_r colormap #293

@SizhaoLu

Description

@SizhaoLu

Report

When calling dc.pl.dotplot() with vcenter=0 and cmap='RdBu_r', the white color in the colormap is not centered at 0.

To reproduce

import decoupler as dc
import pandas as pd
top_pathways = pd.read_csv('top_pathways.csv')
dc.pl.dotplot(
    df=top_pathways,
    x="score",
    y="variable",
    s="logpval",
    c="score",
    top=len(top_pathways),
    scale=0.6,
    figsize=(3, 4.8),
    vcenter=0,
    cmap='RdBu_r'
)

top_pathways.csv

Example output: 0 and some of the negative values were given red color.
Image

Versions

| Package   | Version |
| --------- | ------- |
| decoupler | 2.1.4   |

| Dependency         | Version                |
| ------------------ | ---------------------- |
| texttable          | 1.7.0                  |
| stack_data         | 0.6.3                  |
| urllib3            | 2.6.3                  |
| seaborn            | 0.13.2                 |
| ipython            | 9.11.0                 |
| pillow             | 12.1.1                 |
| session-info2      | 0.4                    |
| certifi            | 2026.2.25 (2026.02.25) |
| threadpoolctl      | 3.6.0                  |
| platformdirs       | 4.9.4                  |
| six                | 1.17.0                 |
| h5py               | 3.15.1                 |
| google-crc32c      | 1.8.0                  |
| cycler             | 0.12.1                 |
| executing          | 2.2.1                  |
| donfig             | 0.8.1.post1            |
| scikit-learn       | 1.8.0                  |
| marsilea           | 0.5.8                  |
| prompt_toolkit     | 3.0.52                 |
| PyYAML             | 6.0.3                  |
| zarr               | 3.1.5                  |
| pyparsing          | 3.3.2                  |
| requests           | 2.32.5                 |
| xgboost            | 3.2.0                  |
| array-api-compat   | 1.14.0                 |
| asttokens          | 3.0.1                  |
| scanpy             | 1.12                   |
| natsort            | 8.4.0                  |
| adjustText         | 1.3.0                  |
| comm               | 0.2.3                  |
| msgpack            | 1.1.2                  |
| numcodecs          | 0.16.5                 |
| legendkit          | 0.3.4                  |
| charset-normalizer | 3.4.5                  |
| PySocks            | 1.7.1                  |
| patsy              | 1.0.2                  |
| dcor               | 0.7                    |
| python-dateutil    | 2.9.0.post0            |
| tqdm               | 4.67.3                 |
| legacy-api-wrap    | 1.5                    |
| docrep             | 0.3.2                  |
| fast-array-utils   | 1.3.1                  |
| pandas             | 3.0.1                  |
| kiwisolver         | 1.5.0                  |
| Brotli             | 1.2.0                  |
| jedi               | 0.19.2                 |
| packaging          | 26.0                   |
| idna               | 3.11                   |
| decorator          | 5.2.1                  |
| scipy              | 1.17.1                 |
| traitlets          | 5.14.3                 |
| anndata            | 0.12.6                 |
| pure_eval          | 0.2.3                  |
| Pygments           | 2.19.2                 |
| statsmodels        | 0.14.6                 |
| llvmlite           | 0.46.0                 |
| typing_extensions  | 4.15.0                 |
| parso              | 0.8.6                  |
| igraph             | 1.0.0                  |
| numpy              | 2.4.2                  |
| matplotlib         | 3.10.8                 |
| numba              | 0.64.0                 |
| setuptools         | 82.0.1                 |
| joblib             | 1.5.3                  |
| ipywidgets         | 8.1.8                  |
| wcwidth            | 0.6.0                  |

| Component | Info                                                                             |
| --------- | -------------------------------------------------------------------------------- |
| Python    | 3.14.3 | packaged by conda-forge | (main, Feb  9 2026, 22:09:14) [Clang 20.1.8 ] |
| OS        | macOS-26.3-arm64-arm-64bit-Mach-O                                                |
| Updated   | 2026-03-12 21:10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions