Create arcs and wedges
Usage
ob_arc(
center = ob_point(0, 0),
radius = 1,
start = 0,
end = 0,
label = character(0),
start_point = class_missing,
end_point = class_missing,
n = 360,
type = "arc",
alpha = numeric(0),
arrow_head = list(),
arrow_fins = list(),
arrowhead_length = numeric(0),
length_head = numeric(0),
length_fins = numeric(0),
color = character(0),
fill = character(0),
lineend = numeric(0),
linejoin = numeric(0),
linewidth = numeric(0),
linewidth_fins = numeric(0),
linewidth_head = numeric(0),
linetype = numeric(0),
resect = numeric(0),
resect_fins = numeric(0),
resect_head = numeric(0),
stroke_color = character(0),
stroke_width = numeric(0),
style = class_missing,
x0 = numeric(0),
y0 = numeric(0),
...
)
ob_wedge(
center = ob_point(0, 0),
radius = 1,
start = 0,
end = 0,
label = character(0),
start_point = class_missing,
end_point = class_missing,
n = 360,
type = "wedge",
alpha = numeric(0),
arrow_head = list(),
arrow_fins = list(),
arrowhead_length = numeric(0),
length_head = numeric(0),
length_fins = numeric(0),
color = NA,
fill = "black",
lineend = numeric(0),
linejoin = numeric(0),
linewidth = numeric(0),
linewidth_fins = numeric(0),
linewidth_head = numeric(0),
linetype = numeric(0),
resect = numeric(0),
resect_fins = numeric(0),
resect_head = numeric(0),
stroke_color = character(0),
stroke_width = numeric(0),
style = class_missing,
x0 = numeric(0),
y0 = numeric(0),
...
)
ob_circular_segment(
center = ob_point(0, 0),
radius = 1,
start = 0,
end = 0,
label = character(0),
start_point = class_missing,
end_point = class_missing,
n = 360,
type = "segment",
alpha = numeric(0),
arrow_head = list(),
arrow_fins = list(),
arrowhead_length = numeric(0),
length_head = numeric(0),
length_fins = numeric(0),
color = NA,
fill = "black",
lineend = numeric(0),
linejoin = numeric(0),
linewidth = numeric(0),
linewidth_fins = numeric(0),
linewidth_head = numeric(0),
linetype = numeric(0),
resect = numeric(0),
resect_fins = numeric(0),
resect_head = numeric(0),
stroke_color = character(0),
stroke_width = numeric(0),
style = class_missing,
x0 = numeric(0),
y0 = numeric(0),
...
)
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)
- type
Type of object to drawn. Can be "arc", "wedge", or "segment"
- 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
apothem
Distance from center to the chord's midpoint
arc_length
Distance along arc from
start_point
toend_point
auto_label
Places a label at the arc's midpoint
chord
ob_segment
fromstart_point
toend_point
geom
A function that converts the object to a geom. Any additional parameters are passed to
ggarrow::geom_arrow
.hatch
A function that puts hatch (tally) marks on arcs. Often used to indicate which arcs have the same angle. The
k
parameter controls how many hatch marks to display. Theheight
parameter controls how long the hatch mark segment is. Thesep
paramater controls the separation between hatch marks whenk > 2
. Additional parameters sent toob_segment
.length
The number of arcs in the arc object
midpoint
A function that selects 1 or more midpoints of the ob_arc. The
position
argument can be between 0 and 1. Additional arguments are passed toob_point
.point_at
A function that finds a point on the arc at the specified angle.
sagitta
ob_segment
fromchord
midpoint toob_arc
midpointtangent_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
#> <ggdiagram::ob_arc>
#> @ center: <ggdiagram::ob_point>
#> @ x: num 0
#> @ y: num 0
#> @ radius: num 6
#> @ start : <ggdiagram::degree>
#> @ degree: num 0
#> @ end : <ggdiagram::degree>
#> @ degree: num 90
#> @ theta : <ggdiagram::degree>
#> @ degree: num 90
#> Other props: label, type, 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, circle, chord,
#> length, end_point, polygon, start_point, style,
#> tibble, geom, angle_at, autolabel, hatch, midpoint,
#> normal_at, place, point_at, tangent_at, aesthetics
# Plot arc and its center point
ggplot() + coord_equal() + theme_minimal() +
p_center +
a_90