scale_fill_cmapmpl ¶
scale_fill_cmapmpl(
cmap: str | Colormap,
*,
name: str | None = None,
breaks: Breaks | None = None,
labels: Labels | None = None,
lablim: int | None = None,
limits: Limits | None = None,
na_value: Color | Number | None = None,
guide: Guide | None = None,
trans: Transform | None = None,
format: str | None = None,
) -> FeatureSpec
Map fill through a matplotlib color map.
Parameters:
-
cmap(str or matplotlib colormap) –A name in
matplotlib.colormaps, or a colormap object. -
name(str, default:None) –The legend title.
-
breaks(list or dict, default:None) –Legend breaks, or a mapping of labels to breaks.
-
labels(list or dict, default:None) –Legend labels.
-
lablim(int, default:None) –Longest label, in characters.
-
limits(list, default:None) –The range of the scale.
-
na_value(str, default:None) –Color of missing values.
-
guide(str or FeatureSpec, default:None) –guide_legend()/guide_colorbar()spec. -
trans(str, default:None) –Transformation of the data:
identity,log10,log2,log,log1p,exp,logit,probit,reciprocal,pseudo_log,symlog,sqrt,reverse, orboxcox_trans(p). -
format(str, default:None) –Label format.
Returns:
-
FeatureSpec–The scale.
Raises:
-
SpecError–If matplotlib is not installed or
cmapis not a known color map.
Examples:
>>> from ggrust import *
>>> data = {"x": [1, 2, 3], "y": [1, 1, 1], "z": [1, 2, 3]}
>>> plot = ggplot(data, aes("x", "y", fill="z")) + geom_tile()
>>> plot = plot + scale_fill_cmapmpl("Dark2")