Skip to content

Commit

Permalink
Position plot header with 'adj'
Browse files Browse the repository at this point in the history
The use of 'pos' and 'offset' can cause the top of the header to be
clipped off and not visible if the plot space is not large enough
vertically. This can happen when the device is resized, or if multiple
plots are rendered on one device using layout().

Thanks to Dirk Eddelbuettel for the report.

Fixes #412.
  • Loading branch information
joshuaulrich committed Jan 26, 2024
1 parent feff449 commit 9f13600
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -1077,23 +1077,19 @@ new.replot_xts <- function(panel=1,asp=1,xlim=c(1,10),ylim=list(structure(c(1,10
Env$main_header_expr <- expression({
local({
text(x = xlim[1],
y = 0.98,
y = 1.0,
labels = main,
adj = NULL,
pos = 4,
offset = 0,
adj = c(0, 1),
cex = 1.1,
col = theme$labels,
font = 2)

if (main.timespan) {
text(x = xlim[2],
y = 0.98,
y = 1.0,
labels = paste(start(xdata[xsubset]),
end(xdata[xsubset]), sep = " / "),
adj = c(0, 0),
pos = 2,
offset = 0.5,
adj = c(1, 1),
cex = 1,
col = theme$labels,
font = NULL)
Expand Down

0 comments on commit 9f13600

Please sign in to comment.