Create arcs and wedges
Usage
ob_arc(
center = ob_point(0, 0),
radius = 1,
start = 0,
end = 0,
label = class_missing,
start_point = class_missing,
end_point = class_missing,
n = 360,
wedge = FALSE,
alpha = class_missing,
arrow_head = class_missing,
arrow_fins = class_missing,
arrowhead_length = class_missing,
length_head = class_missing,
length_fins = class_missing,
color = class_missing,
fill = class_missing,
lineend = class_missing,
linejoin = class_missing,
linewidth = class_missing,
linewidth_fins = class_missing,
linewidth_head = class_missing,
linetype = class_missing,
resect = class_missing,
resect_fins = class_missing,
resect_head = class_missing,
stroke_color = class_missing,
stroke_width = class_missing,
style = class_missing,
x0 = class_missing,
y0 = class_missing,
...
)
ob_wedge(
center = ob_point(0, 0),
radius = 1,
start = 0,
end = 0,
label = class_missing,
start_point = class_missing,
end_point = class_missing,
n = 360,
wedge = TRUE,
alpha = class_missing,
arrow_head = class_missing,
arrow_fins = class_missing,
arrowhead_length = class_missing,
length_head = class_missing,
length_fins = class_missing,
color = NA,
fill = "black",
lineend = class_missing,
linejoin = class_missing,
linewidth = class_missing,
linewidth_fins = class_missing,
linewidth_head = class_missing,
linetype = class_missing,
resect = class_missing,
resect_fins = class_missing,
resect_head = class_missing,
stroke_color = class_missing,
stroke_width = class_missing,
style = class_missing,
x0 = class_missing,
y0 = class_missing,
...
)
Arguments
- center
point at center of the arc (default = ob_point(0,0))
- radius
distance between center and edge arc (default = 1)
- start
start angle (default = 0 degrees)
- end
end angle (default = 0 degrees)
- label
A character, angle, or label object
- start_point
Specify where arc starts. Overrides
@center
- end_point
Specify where arc ends Overrides
@center
- n
number of points in arc (default = 360)
- wedge
Draw a wedge instead of an arc when
TRUE
- alpha
numeric value for alpha transparency
- arrow_head
A 2-column matrix of polygon points
- arrow_fins
A 2-column matrix of polygon points
- arrowhead_length
Determines the size of the arrow ornaments. This parameter becomes the
length
parameter in ggarrow functions. Numeric values set the ornament size relative to the linewidth. A unit value sets the ornament size in an absolute manner.- length_head
Determines the size of the arrow head. Numeric values set the ornament size relative to the linewidth. A unit value sets the ornament size in an absolute manner. From ggarrow.
- length_fins
Determines the size of the arrow fins. Numeric values set the ornament size relative to the linewidth. A unit value sets the ornament size in an absolute manner. From ggarrow.
- color
character string for color
- fill
character string for fill color
- lineend
Line end style (round, butt, square).
- linejoin
Line join style (round, mitre, bevel).
- linewidth
Width of lines
- linewidth_fins
Line width for arrow fins
- linewidth_head
Line width for arrow fins
- linetype
type of lines
- resect
A numeric(1) denoting millimeters or
to shorten the arrow head and fins. - resect_fins
A numeric(1) denoting millimeters or
to shorten the arrow fins - resect_head
A numeric(1) denoting millimeters or
to shorten the arrow head. - stroke_color
Color of point border line
- stroke_width
Stroke width in arrows
- style
a style object
- x0
x-coordinate of center point. If specified, overrides x-coordinate of
@center
.- y0
x-coordinate of center point. If specified, overrides y-coordinate of
@center
.- ...
<
dynamic-dots
> arguments passed to style object
Slots
aesthetics
A list of information about the arc's aesthetic properties
angle_at
A function that finds the angle of the specified point in relation to the arc's center
geom
A function that converts the object to a geom. Any additional parameters are passed to
ggarrow::geom_arrow
.length
The number of arcs in the arc object
point_at
A function that finds a point on the arc at the specified angle.
tangent_at
A function that finds the tangent line at the specified angle.
theta
interior angle (end - start)
tibble
Gets a tibble (data.frame) containing parameters and styles used by
ggarrow::geom_arrow
.
Examples
library(ggplot2)
# center point
p_center <- ob_point(0,0)
# 90-degree arc
a_90 <- ob_arc(
center = p_center,
radius = 6,
start = degree(0),
end = degree(90)
)
# Print arc
a_90
#> <ob_arc>
#> @ center: <ob_point>
#> @ x: num 0
#> @ y: num 0
#> @ radius: num 6
#> @ start : <degree>
#> @ degree: num 0
#> @ end : <degree>
#> @ degree: num 90
#> @ theta : <degree>
#> @ degree: num 90
#> Other props: label, wedge, alpha, arrow_head, arrow_fins,
#> arrowhead_length, length_head, length_fins, color,
#> fill, lineend, linejoin, linewidth, linewidth_fins,
#> linewidth_head, linetype, n, resect, resect_fins,
#> resect_head, stroke_color, stroke_width, apothem,
#> arc_length, sagitta, bounding_box, chord, length,
#> polygon, style, tibble, geom, angle_at, autolabel,
#> midpoint, normal_at, place, point_at, tangent_at,
#> aesthetics
# Plot arc and its center point
ggplot() + coord_equal() + theme_minimal() +
p_center +
a_90