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

Shared colorbar across several topoplots #324

Closed
vladdez opened this issue Feb 13, 2025 · 4 comments · May be fixed by #325
Closed

Shared colorbar across several topoplots #324

vladdez opened this issue Feb 13, 2025 · 4 comments · May be fixed by #325
Labels
bug Something isn't working

Comments

@vladdez
Copy link
Collaborator

vladdez commented Feb 13, 2025

Describe the bug

  • we tried using the colorbar parameter (commented out, in the screenshot) - the individual topoplot colorbars did not change. But the colours in the plots themselves have changed.
  • Within colorbar, changing limits to colorrange shows an error message asking us to use only one of these two since they are aliases - but we are using only one or the other..
  • Setting a Colorbar outside of all of these doesn't affect the plots

For now, we use the hacky solution

  • remove the colorbars of all topoplots
  • add an additional colorbar
  • adapt its colorrange to the same values as with the topoplots
  • adapt the colormap accordingly.

For now it's fine but I think in general it's rather error-prone because colorbar and plot are not connected at all.

Expected behavior
When setting a colorrange for the topoplots, I would have expected that the topoplot's colorbar is adjusted to this colorrange but it seems to be independent of it.

In general, I would like to have a solution to have a shared colorbar for several (topo) plots but I'm not sure whether that is easily possible in Makie.

Screenshots
Image

Versions:

  • Julia v1.11.2
  • UnfoldMakie v0.5.13-4
@vladdez vladdez added the bug Something isn't working label Feb 13, 2025
@jschepers
Copy link
Collaborator

Minimal working example: (I copied the code over from a Pluto notebook)

using UnfoldMakie
using CairoMakie
using TopoPlots

data_1, positions = TopoPlots.example_data()
data_2 = data_1 .* 100

let
	f = Figure()
	plot_topoplot!(f[1,1], data_1[:,5,1], positions=positions)
	plot_topoplot!(f[1,2], data_2[:,5,1], positions=positions)
	current_figure()
end

min, max = minimum(data_2[:,5,1]), maximum(data_2[:,5,1])

let
	f = Figure()
	plot_topoplot!(f[1,1], data_1[:,5,1], positions=positions, visual=(; colorrange=(min,max)))
	plot_topoplot!(f[1,2], data_2[:,5,1], positions=positions, visual=(; colorrange=(min,max)))
	current_figure()
end

The corresponding plots are:

  • First figure:
    Image

  • Second figure:
    Image

Versions:

  • Julia: v"1.11.2"
  • UnfoldMakie: v0.5.14

@jschepers jschepers removed their assignment Feb 14, 2025
@maanikmarathe
Copy link

For the initial example: Julia v1.11.2 , UnfoldMakie v0.5.13

@vladdez
Copy link
Collaborator Author

vladdez commented Feb 14, 2025

@jschepers but why don't you use just conditional topoplot series? Just combine two datasets adn add column condition for data1 and data2
Upd. Although, yes it is a bug: user editing config.visual.limits was not supported. Fixed. Will be in next version.

@vladdez vladdez mentioned this issue Feb 14, 2025
@jschepers
Copy link
Collaborator

This could also be an option.
Thank you for fixing the bug in plot_topoplot!

@vladdez vladdez closed this as completed Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants