geom_curve ¶
geom_curve(
mapping: FeatureSpec | None = None,
*,
data: PlotData | None = None,
stat: str | None = None,
position: Position | None = None,
show_legend: bool | None = None,
inherit_aes: bool | None = None,
manual_key: ManualKey | None = None,
sampling: Sampling | None = None,
tooltips: Tooltips | None = None,
arrow: FeatureSpec | None = None,
curvature: float | None = None,
angle: float | None = None,
ncp: int | None = None,
spacer: float | None = None,
color_by: str | None = None,
na_rm: bool | None = None,
**other_args: Any,
) -> LayerSpec
Curved lines from (x, y) to (xend, yend), optionally with arrows.
Parameters:
-
mapping(FeatureSpec, default:None) –Aesthetic mapping from
aes(). -
data(DataFrame or dict, default:None) –Layer data; inherits the plot data when None.
-
stat(str, default:None) –Statistical transformation, by name.
-
position(str or FeatureSpec, default:None) –Position adjustment: a name such as
"dodge"or aposition_*()spec. -
show_legend(bool, default:None) –False hides this layer from the legend.
-
inherit_aes(bool, default:None) –False ignores the plot's default mapping for this layer.
-
manual_key(str or FeatureSpec, default:None) –This layer's key in a manual legend: a label, or
layer_key(). -
sampling(str or FeatureSpec, default:None) –lets_plot sampling; accepted and ignored, as ggrust draws every row.
-
tooltips(FeatureSpec or list of str, default:None) –Tooltip content:
layer_tooltips(), a list of column names, or"none"to disable tooltips (HTML output). -
arrow(FeatureSpec, default:None) –Arrow spec from
arrow(). -
curvature(float, default:0.5) –Amount of curvature: negative values bend left, positive values bend right, zero draws a straight line.
-
angle(float, default:90) –Skew of the control points, in degrees: below 90 towards the start point, above 90 towards the end point.
-
ncp(int, default:5) –Number of control points; more give a smoother curve.
-
spacer(float, default:0.0) –Pixels to cut off both ends, leaving gaps at the start and end points.
-
color_by(str, default:None) –Aesthetic the
colorscale applies to ("color"or"fill"). -
na_rm(bool, default:None) –True removes rows with missing values silently; otherwise they are removed with a warning.
-
**other_args(Any) –Constant aesthetics such as
color="red"orsize=2, and the geom's options. As in lets_plot; options ggrust does not read yet are reported as not supported.
Returns:
-
LayerSpec–The layer.
Examples:
>>> from ggrust import *
>>> plot = ggplot() + geom_curve(
... x=0, y=0, xend=1, yend=1, curvature=-0.3, arrow=arrow(type="closed")
... )