scale_hue ¶
scale_hue(
aesthetic: str | Sequence[str],
*,
h: Sequence[Number] | None = None,
c: Number | None = None,
l: Number | None = None,
h_start: Number | None = None,
direction: int | None = None,
name: str | None = None,
breaks: Breaks | None = None,
labels: Labels | None = None,
lablim: int | None = None,
limits: Limits | None = None,
na_value: Color | None = None,
guide: Guide | None = None,
trans: Transform | None = None,
format: str | None = None,
) -> FeatureSpec
Qualitative colors around the HCL color wheel, for color aesthetics.
Parameters:
-
aesthetic(str or list of str) –The color aesthetic(s), e.g.
"fill"or["color", "fill"]. -
h(list of float, default:[15, 375]) –Range of hues in degrees.
-
c(float, default:100) –Chroma.
-
l(float, default:65) –Luminance.
-
h_start(float, default:0) –Hue offset in degrees.
-
direction((1, -1), default:1) –Direction around the color wheel.
-
name(str, default:None) –Legend title.
-
breaks(list or dict, default:None) –Values that get a legend key (a dict maps labels to breaks).
-
labels(list of str or dict, default:None) –One label per break (a dict maps breaks to labels).
-
lablim(int, default:None) –Maximum label length in characters for discrete data; longer labels are cut.
-
limits(list, default:None) –The categories (and their order), or a
[low, high]data range. -
na_value(str, default:None) –Color drawn for missing data and data outside
limits. -
guide(str or FeatureSpec, default:None) –"legend","colorbar","none", or a guide spec. -
trans(str, default:None) –Transformation of continuous data, e.g.
"log10". -
format(str, default:None) –Label format, e.g.
".1f".labelstake precedence.
Returns:
-
FeatureSpec–The scale, or a
FeatureSpecArrayof one scale per aesthetic for a list.
Raises:
-
UnsupportedValueError–If
aestheticis not a string or a list of strings. -
SpecError–If
aestheticis an empty list.
Examples:
>>> from ggrust import *
>>> data = {"age": [1, 3, 5, 7, 2, 4, 6, 8, 3, 9],
... "weight": [4, 6, 6, 7, 8, 12, 14, 15, 2, 3],
... "pet": ["cat"] * 4 + ["dog"] * 4 + ["rabbit"] * 2}
>>> plot = ggplot(data, aes("age", "weight", color="pet", fill="pet"))
>>> plot = plot + geom_point(shape=21, size=6, alpha=0.5)
>>> plot = plot + scale_hue(["color", "fill"], l=40)