Add legend in the outer margin
position of the legend, using any method
recognized by grDevices::xy.coords()
.
logical indicating whether to apply
graphics::par()
in order to place the legend in
the outer margin. If doPar=FALSE
and if no other
method has been done to update the graphics::par()
settings, the legend will be placed with the same
mechanism used by graphics::legend()
.
character vector, or expression, used to display each legend label.
color used as the background of the legend box.
color used as the frame border color of the legend box.
character
vector of colors used to color each
entry in legend
.
vector of colors used as the background color
when pch
is any value from 21 to 25. When pt.bg=NULL
this value and col
are adjusted so the outline is
darker, via jamba::makeColorDarker()
, with the fill
color pt.bg
using the original col
value.
integer or character vector of point shapes,
as described in graphics::points()
.
integer number of columns to use for legend
entries. By default ncol
is the smaller of
length(legend)
and 5
, which is intended for a legend
placed at the bottom of the visualization.
character expansion multiplier, used to size the legend text overall.
point expansion factor, used to size points
when pch
is not NULL
.
additional arguments are passed to
graphics::legend()
.
This function is intended to place a legend outside the figure
in the outer margin area. The motivating use case is to
display a legend below multi-panel base R graphics plots,
for example when using par("mfrow"=c(2,2))
.
Other jam utility functions:
blockArrowMargin()
,
find_colname()
,
fold_to_log2fold()
,
get_se_assaydata()
,
gradient_rect()
,
handle_highlightPoints()
,
log2fold_to_fold()
,
logAxis()
,
points2polygonHull()
,
update_function_params()
,
update_list_elements()
opar <- par(no.readonly=TRUE);
on.exit(par(opar));
par("mfrow"=c(2,2));
for (i in 1:4) {
jamba::nullPlot(plotAreaTitle=paste("Panel", i));
}
require(jamba);
#> Loading required package: jamba
#>
#> Attaching package: ‘jamba’
#> The following object is masked from ‘package:IRanges’:
#>
#> heads
outer_legend("bottom",
legend=c("one", "two", "three"),
col=colorjam::rainbowJam(3));