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

improve colorbar errors for plots that don't use a colormap #3090

Merged
merged 30 commits into from
Sep 12, 2023
Merged
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d66b8b0
improve colorbar errors for plots that don't use a colormap
SimonDanisch Jul 24, 2023
fc513b4
don't mess with existing is_atomic_plot
SimonDanisch Jul 24, 2023
e3f3ca5
improve errors
SimonDanisch Jul 25, 2023
1432fa9
add tests
SimonDanisch Jul 25, 2023
f778e42
fix error
SimonDanisch Jul 26, 2023
631669c
Merge branch 'master' into sd/improve-colorbar-error
SimonDanisch Jul 28, 2023
b3065cc
try a more generic approach
SimonDanisch Jul 28, 2023
31d0191
Merge branch 'master' into sd/improve-colorbar-error
SimonDanisch Aug 21, 2023
9e31dbf
Merge branch 'sd/improve-colorbar-error' of https://github.com/MakieO…
SimonDanisch Aug 23, 2023
e8bfb6b
Merge branch 'master' into sd/improve-colorbar-error
SimonDanisch Aug 23, 2023
0105441
recursively search for colormap
SimonDanisch Aug 23, 2023
b31aa88
implement categorical=true correctly
SimonDanisch Aug 25, 2023
ef7b503
correctly get cgrad values
SimonDanisch Aug 25, 2023
af4857d
always use ColorMap
SimonDanisch Sep 6, 2023
765d058
fix most cases?!
SimonDanisch Sep 7, 2023
5f13c6a
fiiiixies!?
SimonDanisch Sep 8, 2023
28a2c2c
merge master
SimonDanisch Sep 8, 2023
e76c9d1
improve ReversibleScale printing
SimonDanisch Sep 8, 2023
de507e2
one last bug?
SimonDanisch Sep 8, 2023
efc72cd
fix cairomakie + Makie unit tests
SimonDanisch Sep 8, 2023
b9d61fc
fix contourf
SimonDanisch Sep 8, 2023
9106ebb
allow type change for ticks
SimonDanisch Sep 8, 2023
aba34cb
clean up implementation
SimonDanisch Sep 12, 2023
ff7acf5
add reference test
SimonDanisch Sep 12, 2023
79f2b71
Merge branch 'master' into sd/improve-colorbar-error
SimonDanisch Sep 12, 2023
f67539e
add test
SimonDanisch Sep 12, 2023
a9aabbd
Merge branch 'sd/improve-colorbar-error' of https://github.com/MakieO…
SimonDanisch Sep 12, 2023
6ee1a44
update comment
SimonDanisch Sep 12, 2023
de83ce2
fix broadcast
SimonDanisch Sep 12, 2023
eb1e1a9
fix continous with values
SimonDanisch Sep 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/makielayout/blocks/colorbar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ end

function Colorbar(fig_or_scene, plot::AbstractPlot; kwargs...)
colorbar_check((:colormap, :limits, :highclip, :lowclip), keys(kwargs))

if haskey(plot, :calculated_colors) && plot.calculated_colors[] isa ColorMap
cmap = plot.calculated_colors[]
scale = cmap.scale
else
# Atomic plots should always have calculated_colors set, if they actually use a colormap
if is_atomic_plot(plot)
error("Plot `$(plotfunc(plot))` has no values that are mapped to colors, so it cannot be used to create a colorbar.")
SimonDanisch marked this conversation as resolved.
Show resolved Hide resolved
end
# So this is for recipes
if !all(x-> haskey(plot, x), (:colormap, :colorrange, :highclip, :lowclip))
SimonDanisch marked this conversation as resolved.
Show resolved Hide resolved
error("Plot $(plotfunc(plot)) doesn't have all colormap attributes. Attributes needed: colormap, colorrange, highclip, lowclip")
end
cmap = plot
scale = plot.colorscale
end
Expand Down
Loading