Add scalebar to the graph
Hi, thank you for providing the opportunity to explore the mouse brain ISH atlas with coding!
I am wondering whether there is a way to add the scale bar into the graph?
Thanks!
Just added a rudimentary function to add a scale bar. The information you need is available through getSectionImage and getAtlasImage which include the resolution information in pixels for the images. This can then be fed to add_scale to add a scale bar
downsample = 2
image_res = getSectionImage(69177654)$resolution
downloadImage(imageID = 69177654,
view = 'projection',
downsample = downsample) %>%
add_scale(image_res,downsample)
Also works for cropped images
downloadImage(imageID = 69177654,
view = 'projection',
downsample = downsample) %>%
centerImage(x = 6382,
y= 2744,
xProportions = c(.1,.1),
yProportions =c(.1,.1),
downsample = downsample) %>%
add_scale(image_res,downsample)
Thank you for the quick response, somehow I got an error from add_scale
Error in magick::image_read(system.file("black.png", package = "allenBrain")) : path must be URL, filename or raw vector
Just forgot to push the all important black pixel. Should be fine now
- [ ] a parameter to draw a scalebar for x microns
- Gravity options shouldn't be essential since all margins are in ratios instead of pixels.
- [ ] Transparency to the scalebar background
- [ ] End and breaklines for the bar