View source: R/plot_region_flag.R
| plot_Macao_SAR_flag | R Documentation |
Constructs the flag of the Macao Special Administrative Region of the People's Republic of China entirely from analytic geometry and renders it as a ggplot2 object. The emblem is assembled from three components, each derived from the specification by computing every construction point (circle intersections, line intersections, and rotation angles): a white lotus flower of three petals, a cluster of five yellow five-pointed stars, and a stylised white bridge with water below. The central petal is constructed explicitly and the two lateral petals follow by mirroring across the vertical axis; the star cluster is positioned by rotating a base location about the lotus anchor point.
plot_Macao_SAR_flag(label = TRUE)
label |
Logical scalar. If |
The geometry follows the Chinese national standard GB 17654-1999. The lotus
is bounded by a sequence of circular arcs drawn on numerous distinct
construction circles (centres O2-O12, radii such as 649/2,
260/2, and 763/2); each arc is sampled into a dense polyline (400 points by
default) so that geom_polygon can fill the enclosed
region. At this sampling density the chordal deviation from the true arc is
several orders of magnitude below any practical display or print resolution.
The five stars comprise one larger central star flanked by two pairs of
smaller stars, all seated on an arc of fixed radius about the emblem anchor
O1 at angular offsets of \pm 35^{\circ} and
\pm 65^{\circ}. The bridge and water are rendered as five white bands
beneath the lotus, each band bounded above and below by arcs of the field's
large construction circles and mirrored across the vertical axis.
All construction is performed in a local coordinate system anchored near the
emblem base (O1 centred at (0, 38)). The green field is a fixed
rectangle spanning \pm 1440 horizontally and \pm 960 vertically,
giving a 3:2 width-to-height ratio. The field colour is derived from the spot
colour Pantone 355 C (hex #007A4D); the lotus and bridge are white and
the stars are yellow (#ffff00). The function is self-contained: it
defines its own geometric helpers internally and depends only on
ggplot2 for rendering and showtext for CJK glyph support.
A ggplot object. The object can be printed, further modified
with additional ggplot2 layers, or written to disk with
ggsave.
Correct display of the Chinese title and caption requires a font providing
CJK glyphs. The function calls showtext_auto, but the
user must register a suitable font beforehand, for example via
font_add or font_add_google.
Without a registered CJK font the non-ASCII labels may render as blank boxes.
The plot uses coord_fixed to enforce a 1:1 aspect
ratio; altering the coordinate system will distort the circular arcs.
GB 17654-1999. Regional flag of the Macao Special Administrative Region of the People's Republic of China. Standardization Administration of China.
ggplot, ggsave,
plot_HK_SAR_flag
# Register a CJK font before plotting annotated output
if (requireNamespace("sysfonts", quietly = TRUE)) {
sysfonts::font_add_google("Noto Sans SC", "notosans")
showtext::showtext_auto()
}
# Annotated flag
plot_Macao_SAR_flag()
# Bare flag, no text
plot_Macao_SAR_flag(label = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.