add_PieLegend {CCAMLRGIS} | R Documentation |
Add a legend to Pies
Description
Adds a legend to pies created using create_Pies.
Usage
add_PieLegend(
Pies = NULL,
bb = NULL,
PosX = 0,
PosY = 0,
Size = 25,
lwd = 1,
Boxexp = c(0.2, 0.2, 0.12, 0.3),
Boxbd = "white",
Boxlwd = 1,
Labexp = 0.3,
fontsize = 1,
LegSp = 0.5,
Horiz = TRUE,
PieTitle = "Pie chart",
SizeTitle = "Size chart",
PieTitleVadj = 0.5,
SizeTitleVadj = 0.3,
nSizes = 3,
SizeClasses = NULL
)
Arguments
Pies |
Spatial object created using create_Pies. |
bb |
Spatial object, sf bounding box created with |
PosX |
numeric, horizontal adjustment of legend. |
PosY |
numeric, vertical adjustment of legend. |
Size |
numeric, controls the size of pies. |
lwd |
numeric, line thickness of pies. |
Boxexp |
numeric, vector of length 4 controls the expansion of the legend box, given
as |
Boxbd |
character, color of the background of the legend box. |
Boxlwd |
numeric, line thickness of the legend box. Set to zero if no box is desired. |
Labexp |
numeric, controls the distance of the pie labels to the center of the pie. |
fontsize |
numeric, size of the legend font. |
LegSp |
numeric, spacing between the pie and the size chart (only used if |
Horiz |
logical. Set to FALSE for vertical layout (only used if |
PieTitle |
character, title of the pie chart. |
SizeTitle |
character, title of the size chart (only used if |
PieTitleVadj |
numeric, vertical adjustment of the title of the pie chart. |
SizeTitleVadj |
numeric, vertical adjustment of the title of the size chart (only used if |
nSizes |
integer, number of size classes to display in the size chart. Minimum and maximum sizes are
displayed by default. (only used if |
SizeClasses |
numeric, vector (e.g. c(1,10,100)) of size classes to display in the size chart
(only used if |
Value
Adds a legend to a pre-existing pie plot.
See Also
create_Pies
, PieData
, PieData2
.
Examples
# For more examples, see:
# https://github.com/ccamlr/CCAMLRGIS#23-create-pies
#Pies of constant size, all classes displayed:
#Create pies
MyPies=create_Pies(Input=PieData,
NamesIn=c("Lat","Lon","Sp","N"),
Size=50
)
#Plot Pies
plot(st_geometry(MyPies),col=MyPies$col)
#Add Pies legend
add_PieLegend(Pies=MyPies,PosX=-0.1,PosY=-1,Boxexp=c(0.5,0.45,0.12,0.45),
PieTitle="Species")