Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale bar for depth in SOmap #118

Open
jspmccain opened this issue Dec 6, 2024 · 1 comment
Open

Scale bar for depth in SOmap #118

jspmccain opened this issue Dec 6, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@jspmccain
Copy link

I'd love to be able to include a scale bar that maps the colour scale in SOmap() to a specific depth value, perhaps as a flag in the function SOmap_auto. I'm not sure how to tackle this!

@jspmccain jspmccain added the enhancement New feature or request label Dec 6, 2024
@raymondben
Copy link
Member

raymondben commented Dec 6, 2024

Easiest way might be to convert to ggplot format:

library(SOmap)
library(SOgg)
p <- SOmap_auto() ## replace with whatever your current map is
p <- SOgg(p) ## this is the same map but with the internals using ggplot commands instead of base graphics

## calling `plot(p)` will return a ggplot object, which you can modify like any other ggplot
##   so you can just add a new colour scale to replace the existing one, e.g.
plot(p) + scale_fill_continuous(limits = c(-2000, 0))

## or you can modify p itself. It has different components inside it:
names(p)

## the colour bar is the scale_fill component. You can look at it to see what it contains:
p$scale_fill

## replace it with something customised
## this is equivalent to `plot(p) + scale_fill_continuous(limits = c(-2000, 0))` but neater:
p$scale_fill <- SO_plotter(plotfun = scale_fill_continuous, plotargs = list(limits = c(-2000, 0)))
p

Does that cover what you were hoping for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants