Open naikymen opened 2 years ago
Just in case you want to know one way NOT to solve this problem:
mystring <- "# /tmp/rcell.test.dir/parameters_53216ffa8960.txt\nmax_split_over_minor 0.8\nmax_dist_over_waist 4\nmax_pixels_per_cell 3000\nmin_pixels_per_cell 50\nbackground_reject_factor 0.4\ntracking_comparison 0.2\nimage_type brightfield\nbf_fl_mapping list\n"
st <- strsplit(mystring, "\\n")[[1]]
mx <- max(nchar(st))
library(stringr)
my.string.padded <- str_pad(st, width = mx, side = "right")
my.string.padded <- paste(my.string.padded, collapse = "\n")
image_blank(width = 500, height = 500, color = "black") %>%
image_annotate(my.string.padded, boxcolor = "white", color = "black", size = 10)
Thanks a lot dcaud, I'll stick to your idea for now.
Using a monospace font (Hack) makes it pretty too.
I'm happy but I'll let someone else close this when it's fixed.
Best!
@naikymen Nice hack on top of my hack. I too look forward to a better fix.
Description
Hi! I am trying to annotate some images with a string that has newline characters, and
boxcolor = "white"
.But something seems off: while the annotation renders, the box seems to be offset from the text (see pic below).
On the other hand, single line text renders fine.
Is there a way to prevent this? Thank you for all your work so far :)
I am using:
Code
Multiline
Output:
Single line
Output: