Repository navigation
Expand file tree
/
Copy pathmf_text.Rd
More file actions
194 lines (172 loc) · 4.25 KB
/
Copy pathmf_text.Rd
File metadata and controls
194 lines (172 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mf_text.R
\name{mf_text}
\alias{mf_text}
\title{Plot a text}
\usage{
mf_text(
x,
txt = "Text",
cex = 0.8,
col_txt,
pos = "center",
offset = 0,
align = "center",
font = 1,
family = "sans",
halo = FALSE,
col_halo,
cex_halo = cex,
box = FALSE,
col_box,
col_box_border,
lwd_box = 2,
line = 0,
clockwise = TRUE,
lwd = 2,
col_line,
arrow = TRUE,
cex_arrow = 1,
adj = c(0, 0)
)
}
\arguments{
\item{x}{an sf object (the first row is used),
a couple of coordinates (c(x, y)),
a position (one of 'topleft', 'top','topright', 'right', 'bottomright',
'bottom', 'bottomleft', 'left'),
or "interactive" for interactive placement.}
\item{txt}{text to display}
\item{cex}{text size}
\item{col_txt}{text color, hex code or color name given by \link{colors}.
The default color is the highlight color (see \link{mf_theme}).}
\item{pos}{position of the text relative to \code{x} (one of 'center',
'topleft', 'top', 'topright', 'right', 'bottomright', 'bottom',
'bottomleft', 'left').
Ignored if \code{x} is a position.}
\item{offset}{offset between the text and \code{x}. Ignored if \code{x} is a position.}
\item{align}{text alignement, one of "left", "right" or "center"}
\item{font}{text font}
\item{family}{text family}
\item{halo}{add a halo around the text}
\item{col_halo}{halo color, hex code or color name given by \link{colors}.
The default color is the background color (see \link{mf_theme}).}
\item{cex_halo}{halo width}
\item{box}{add a box around the text}
\item{col_box}{box color, hex code or color name given by \link{colors}.
The default color is the background color (see \link{mf_theme}).}
\item{col_box_border}{box border color, hex code or color name given by
\link{colors}.
The default color is the highlight color (see \link{mf_theme}).}
\item{lwd_box}{line width of the box border}
\item{line}{type of the line drawn between the text and \code{x}.
0 for no line, 1 for a straight line, 2 for a line with an angle,
3 for a curved line. Ignored if \code{x} is a position.}
\item{clockwise}{direction of the curve for types 2 and 3}
\item{lwd}{line width}
\item{col_line}{line color, hex code or color name given by \link{colors}.
The default color is the highlight color (see \link{mf_theme}).}
\item{arrow}{add an arrow to the line}
\item{cex_arrow}{arrow size}
\item{adj}{adjust the text position in x and y directions}
}
\value{
No return value, an text is displayed.
}
\description{
Plot a text on the map.
}
\examples{
library(mapsf)
mf_theme("base")
mtq <- mf_get_mtq()
mtq_p <- mf_get_mtq("points")
mf_map(mtq, expandBB = c(0, .1, 0, .3))
mf_map(mtq_p[c(2, 3, 17, 28), ],
pch = 4, lwd = 1.5, cex = .5, col = "red",
add = TRUE
)
mf_title("Title of the map", banner = TRUE)
mf_frame()
mf_text(x = "topright", txt = "x = 'topright'")
mf_text(
x = "bottomleft",
txt = "x = 'bottomleft'\nadj = c(4,4)\nalign = 'left'",
adj = c(4, 4),
align = "left"
)
mf_text(
x = c(728000, 1625500),
txt = "x = c(X, Y)",
pos = "right",
line = 2,
offset = 5
)
mf_text(
mtq[3, ],
txt = "pos = 'top'\nhalo = TRUE",
pos = "top",
align = "center",
halo = TRUE
)
mf_text(
mtq[3, ],
txt = "pos = 'bottomleft'\nhalo = TRUE\nalign = 'right'",
pos = "bottomleft",
align = "right",
halo = TRUE
)
mf_text(
x = mtq[17, ],
txt = "pos = 'bottomright'\nline = 1\nbox = TRUE",
pos = "bottomright",
offset = 10,
line = 1,
box = TRUE
)
mf_text(
x = mtq[17, ],
txt = "pos = 'topright'\nline = 1\nalign = 'left'",
pos = "topright",
offset = 15,
align = "left",
line = 1
)
mf_text(
x = mtq[2, ],
txt = "pos = 'topleft'\nline = 2\nbox = TRUE\nclockwise = TRUE",
pos = "topleft",
offset = 8,
clockwise = TRUE,
line = 2,
box = TRUE
)
mf_text(
x = mtq[2, ],
txt = "pos = 'bottomleft'\nline = 2\nclockwise = FALSE",
pos = "bottomleft",
offset = 6,
clockwise = FALSE,
line = 2,
box = FALSE
)
mf_text(
x = mtq[28, ],
txt = "pos = 'topright'\nline = 3\nclockwise = FALSE",
pos = "topright",
offset = 10,
clockwise = FALSE,
line = 3,
halo = TRUE,
align = "left"
)
mf_text(
x = mtq[28, ],
txt = "pos = 'right'\nline = 3\nbox = TRUE\nclockwise = TRUE",
pos = "right",
offset = 10,
clockwise = TRUE,
line = 3,
box = TRUE
)
}