plotnine.guide_colorbar

guide_colorbar(
    title=None,
    theme=Theme(),
    position=None,
    direction=None,
    reverse=False,
    order=0,
    nbin=None,
    display="gradient",
    alpha=None,
    draw_ulim=True,
    draw_llim=True
)

Guide colorbar

Parameter Attributes

title: Optional[str] = None

Title of the guide. Default is the name of the aesthetic or the name specified using lab

theme: Theme = field(default_factory=Theme)

A theme to style the guide. If None, the plots theme is used.

position: Optional[LegendPosition] = None

Where to place the guide relative to the panels.

direction: Optional[Orientation] = None

Direction of the guide. The default is depends on legend_position.

reverse: bool = False

Whether to reverse the order of the legend keys.

order: int = 0

Order of this guide among multiple guides.

nbin: Optional[int] = None

Number of bins for drawing a colorbar. A larger value yields a smoother colorbar

display: Literal["gradient", "rectangles", "raster"] = "gradient"

How to render the colorbar.

alpha: Optional[float] = None

Opacity (in the range [0, 1]) of the colorbar. The defualt None, is to use the opacity of the plot.

draw_ulim: bool = True

Whether to show the upper limit tick marks.

draw_llim: bool = True

Whether to show the lower limit tick marks.

Notes

To correctly place a rasterized colorbar when saving the plot as an svg or pdf, you should set the dpi to 72 i.e. theme(dpi=72).