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

hidedecorations!() and backgroundcolor not supported for ::GeoAxis #209

Open
Zetison opened this issue Mar 9, 2024 · 8 comments
Open

hidedecorations!() and backgroundcolor not supported for ::GeoAxis #209

Zetison opened this issue Mar 9, 2024 · 8 comments

Comments

@Zetison
Copy link

Zetison commented Mar 9, 2024

It seems to me that hidedecorations! and backgroundcolor is not provided for ::GeoAxis?

This example then fails.

@asinghvi17
Copy link
Member

Hidedecorations will be supported by #207, backgroundcolor can be added after that though it's a bit more difficult.

@Zetison
Copy link
Author

Zetison commented Jun 22, 2024

Does it exist a workaround for the backgroundcolor?

@asinghvi17
Copy link
Member

You could set ga.scene.backgroundcolor, but that would cover the area of the scene, not just the geoaxis. If your entire figure has the same background color then it might be worth it though.

@Zetison
Copy link
Author

Zetison commented Jun 23, 2024

I suspect not, but it does not work with the following example (where I want the ocean to be colored :lightblue1)?

using GLMakie, GeoMakie
fig = Figure(; size=(1920, 1080))

gridlayout1 = fig[1, 1:2] = GridLayout()
gridlayout2 = fig[2:4, 1] = GridLayout()
gridlayout3 = fig[2, 2] = GridLayout()
gridlayout4 = fig[3, 2] = GridLayout()
gridlayout5 = fig[4, 2] = GridLayout()

rowsize!(fig.layout, 3, Relative(0.55))
source = "+proj=merc +lon_0=0 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m +no_defs"
dest = "+proj=merc +lon_0=0 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m +no_defs"
ax1 = GeoMakie.GeoAxis(gridlayout2[1, 1]; source=source, dest=dest)
land = GeoMakie.land();
coastlns = poly!(
    ax1,
    land;
    color=:honeydew,
    colormap=:dense,
    strokecolor=:gray50,
    strokewidth=0.5,
    inspectable=false,
)
ax2 = Axis(gridlayout3[1, 1]; alignmode=Outside(), tellheight=false, tellwidth=false)
ax3 = Axis(gridlayout4[1, 1]; alignmode=Outside(), tellheight=false, tellwidth=false)

x = range(0, 1, 100)
lines!(ax2, x, sin.(2x))
lines!(ax3, x, sin.(3x))
ax1.scene.backgroundcolor = parse(Colorant, :lightblue1)

@filchristou
Copy link

for me it worked to pass the backgroundcolor to the Figure initialization. Not the best solution but I think it will do what you want.

@filchristou
Copy link

Also related to #193

@Zetison
Copy link
Author

Zetison commented Jul 22, 2024

for me it worked to pass the backgroundcolor to the Figure initialization. Not the best solution but I think it will do what you want.

This sets the background color for the entire figure blue (also around the ax2 and ax3 axis), and I only want it for the ax1 object (such that I get a map with a nice blue ocean).

@Zetison
Copy link
Author

Zetison commented Aug 29, 2024

An ugly fix could be to implement the backgroundcolor option as

ocean_coords = [(180, -90), (-180, -90), (-180, 90), (180, 90)]
ocean = poly!(ax, ocean_coords, color = :lightblue1, strokewidth=0.5, strokecolor=:gray50)
Makie.translate!(ocean, 0, 0, -100)

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

No branches or pull requests

3 participants