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

Cannot create colobar for contour/ missing plots entry in contour #4036

Open
3 tasks done
ArneSpang opened this issue Jul 15, 2024 · 1 comment
Open
3 tasks done

Cannot create colobar for contour/ missing plots entry in contour #4036

ArneSpang opened this issue Jul 15, 2024 · 1 comment
Labels
bug colors color, colormap, colorrange, alpha, etc Legend & Colorbar Makie Backend independent issues (Makie core) (tri)contour(f) not 3D contour, that's volume

Comments

@ArneSpang
Copy link

ArneSpang commented Jul 15, 2024

  • are you running newest version (version from docs) ? - yes
  • can you reproduce the bug with a fresh environment ? (]activate --temp; add Makie) - yes
  • What platform + GPU are you on? - Ubuntu 22.04 + NVIDIA RTX A4000

I was trying to put a contour plot over a heatmap (of a different dataset) and have two colorbars. But I cannot create one for the contour plot. After asking about this (https://discourse.julialang.org/t/multiple-colobars/116970/6), @lazarusA noticed that the plots entry is not present in the contour object. MWE and error message below:

using CairoMakie
x   = y = 1:0.2:20
f1(x,y) =    (x + 2y^2) * abs(sin(y) + cos(x))
z1  = [f1(x,y) for x in x, y in y]
fig = Figure(resolution=(350,300), fontsize = 14)
ax1 = Axis(fig, aspect = 1, xlabel = "x", ylabel = "y")
p1  = contour!(ax1, x, y, z1, colormap=:roma)
cb1 = Colorbar(fig, p1, width = 10, height = Relative(0.8), ticklabelsize = 10, tickalign = 1)
ERROR: Multiple colormaps found for plot MakieCore.Text{Tuple{Vector{Point{2, Float32}}}}, please specify which one to use manually. Please overload `Makie.extract_colormap(::MakieCore.Text{Tuple{Vector{Point{2, Float32}}}})` to allow for the automatical creation of a Colorbar.
@ArneSpang ArneSpang added the bug label Jul 15, 2024
@jkrumbiegel
Copy link
Member

The plots entry is there (it's just not an attribute and might be hidden from the tab-completion). The issue is that contour is a composite plot of a lines plus a text plot, and the automatic colormap detection which we added at some point does not pick up the info we want because both lines and text in principle have color information. Although I was also not able to quickly fix it by adding a Contour specific method to extract_colormap which just called that on the lines component, that returned nothing instead of the expected info. Maybe there's something unusual in the structure.

@ffreyer ffreyer added Makie Backend independent issues (Makie core) Legend & Colorbar colors color, colormap, colorrange, alpha, etc (tri)contour(f) not 3D contour, that's volume labels Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug colors color, colormap, colorrange, alpha, etc Legend & Colorbar Makie Backend independent issues (Makie core) (tri)contour(f) not 3D contour, that's volume
Projects
None yet
Development

No branches or pull requests

3 participants