-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from MakieOrg/up_search
Up search
- Loading branch information
Showing
73 changed files
with
1,292 additions
and
1,478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
using DocumenterVitepress # ] add https://github.com/LuxDL/DocumenterVitepress.jl.git | ||
using DocumenterVitepress | ||
using Documenter | ||
include("theme_light_dark.jl") | ||
set_theme!(merge(theme_latexfonts(), theme_light_dark())) | ||
|
||
# ENV["RASTERDATASOURCES_PATH"] = "/Users/lalonso/data/" | ||
# ENV["DATADEPS_ALWAYS_ACCEPT"] = "true" | ||
|
||
makedocs(; sitename="BeautifulMakie", authors="Lazaro Alonso", | ||
clean=true, | ||
checkdocs=:all, | ||
format=DocumenterVitepress.MarkdownVitepress(), | ||
format=DocumenterVitepress.MarkdownVitepress(; | ||
repo = "github.com/MakieOrg/BeautifulMakie",), | ||
draft=false, | ||
source="src", build=joinpath(@__DIR__, "docs_site/") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# ## heatmap with 1 shared colorbar | ||
|
||
# ![](heatmap1SharedCbar.png) | ||
|
||
using CairoMakie | ||
using Random | ||
CairoMakie.activate!() # hide | ||
|
||
Random.seed!(123) | ||
fig = Figure(; size = (600, 400)) | ||
axs = [Axis(fig[1, j], aspect = 1, xticks = [1, 10], yticks = [1, 10]) for j in 1:2] | ||
[heatmap!(axs[i], 1:10, 1:10, rand(10, 10); colormap = :plasma, | ||
colorrange = (0, 1)) for i in 1:2] | ||
Colorbar(fig[2, :1:2], colormap = :plasma, limits= (0,1), | ||
vertical = false, flipaxis = false, height = 15, tickwidth = 2, | ||
ticklabelsize = 14, ticks = [0, 0.5, 1]) | ||
hideydecorations!(axs[2], ticks = false) | ||
fig | ||
save("heatmap1SharedCbar.png", fig); # hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# ## heatmap with 2 shared colorbars | ||
|
||
# ![](heatmap2SharedCbars.png) | ||
|
||
using CairoMakie, Random | ||
using ColorSchemes | ||
CairoMakie.activate!() # hide | ||
|
||
Random.seed!(123) | ||
cmaps = collect(keys(colorschemes)) | ||
fig = Figure(; size = (600, 400)) | ||
for i in 1:2, j in 1:2:3 | ||
ax = Axis(fig[i, j]; aspect = 1) | ||
hm = heatmap!(ax, 1:10, 1:10, rand(10, 10); colorrange = (0, 1), | ||
colormap = cmaps[5j]) | ||
Colorbar(fig[1:2, j+1]; limits=(0,1), colormap = cmaps[5j], ticklabelsize = 14, | ||
height = Relative(0.85), ticks = [0, 0.5, 1], tickwidth = 2) | ||
end | ||
fig | ||
save("heatmap2SharedCbars.png", fig); # hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# ## heatmap with bottom colorbar | ||
|
||
# ![](heatmapCbarBottom.png) | ||
|
||
using CairoMakie, Random | ||
CairoMakie.activate!() # hide | ||
|
||
Random.seed!(123) | ||
fig = Figure(;size = (600, 400)) | ||
ax = Axis(fig[1, 1], aspect = 1, xlabel = "x", ylabel = "y") | ||
hmap = heatmap!(rand(20, 20), colormap = :lajolla) | ||
Colorbar(fig[2, 1], hmap, label = "values", height = 15, vertical = false, | ||
flipaxis = false, ticksize = 15, tickalign = 1, width = Relative(0.5)) | ||
rowsize!(fig.layout, 1, Aspect(1, 0.5)) | ||
fig | ||
save("heatmapCbarBottom.png", fig); # hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# ## heatmap with left colorbar | ||
|
||
# ![](heatmapCbarLeft.png) | ||
|
||
using CairoMakie, Random | ||
CairoMakie.activate!() # hide | ||
|
||
Random.seed!(123) | ||
fig = Figure(; size = (600, 400)) | ||
ax = Axis(fig[1, 2]; xlabel = "x", ylabel = "y") | ||
hmap = heatmap!(2rand(20, 20) .- 1; colormap = :Spectral_11) | ||
Colorbar(fig[1, 1], hmap; label = "values", width = 15, flipaxis = false, | ||
ticksize = 15, tickalign = 1) | ||
colsize!(fig.layout, 2, Aspect(1, 1.0)) | ||
fig | ||
save("heatmapCbarLeft.png", fig); # hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# ## heatmap with top colorbar | ||
|
||
# ![](heatmapCbarTop.png) | ||
|
||
using CairoMakie, Random | ||
CairoMakie.activate!() #HIDE | ||
|
||
Random.seed!(123) | ||
fig = Figure(; size = (600, 400)) | ||
ax = Axis(fig[2, 1], aspect = 1, xlabel = "x", ylabel = "y") | ||
hmap = heatmap!(rand(20, 20), colormap = :CMRmap) | ||
Colorbar(fig[1, 1], hmap, label = "values", height = 15, vertical = false, | ||
ticksize = 15, tickalign = 1, width = Relative(0.5)) | ||
rowsize!(fig.layout, 2, Aspect(1, 0.5)) | ||
fig | ||
save("heatmapCbarTop.png", fig); # hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# ## heatmaps: grid | ||
|
||
# ![](heatmapGrid.png) | ||
|
||
using CairoMakie, Random, ColorSchemes | ||
CairoMakie.activate!() # hide | ||
|
||
Random.seed!(21) | ||
cmaps = collect(keys(colorschemes)) | ||
fig = Figure(; size = (1200, 800), fontsize = 20) | ||
for i in 1:2, j in 1:2:5 | ||
ax = Axis(fig[i, j], aspect = 1, xticks = [1, 10], yticks = [1, 10]) | ||
hmap = heatmap!(ax, 1:10, 1:10, rand(10, 10); colorrange = (0, 1), | ||
colormap = cmaps[rand(1:length(cmaps))]) | ||
Colorbar(fig[i, j+1], hmap; height = Relative(0.5), tickwidth = 2, | ||
ticks = [0, 0.5, 1]) | ||
end | ||
fig | ||
save("heatmapGrid.png", fig); # hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# ## heatmap irregular steps | ||
|
||
# ![](heatmapIrregular.png) | ||
|
||
using CairoMakie, Random | ||
CairoMakie.activate!() # hide | ||
|
||
Random.seed!(123) | ||
x = y = sqrt.(1:10:101) | ||
z = abs.(randn(10, 10)) | ||
fig = Figure(; size = (600, 400)) | ||
ax = Axis(fig[1, 1]; aspect = 1, xlabel = "x", ylabel = "y") | ||
hmap = heatmap!(x, y, z; colormap = :magma) | ||
Colorbar(fig[1, 2], hmap; label="z values", width=15, ticksize=15, tickalign=1) | ||
colsize!(fig.layout, 1, Aspect(1, 1.0)) | ||
colgap!(fig.layout, 7) | ||
fig | ||
save("heatmapIrregular.png", fig); # hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# ## heatmap: Irregular Categories | ||
|
||
# ![](heatmapIrregularCategories.png) | ||
|
||
# Example by @walra356 (modified) | ||
using CairoMakie, Random | ||
Random.seed!(13) | ||
|
||
CairoMakie.activate!() # hide | ||
|
||
n= 5 | ||
x = rand(n) # specify x steplength | ||
y = rand(n) # specify y steplength | ||
σ = rand(length(x), length(y)) # beware of dims | ||
|
||
## custom ticks | ||
function steps(x::Vector{T} where T<:Real) | ||
sum(x .< 0) == 0 || error("Error: $x - negative step length not allowed") | ||
return (s = append!(eltype(x)[0],x); [Base.sum(s[1:i]) for i ∈ Base.eachindex(s)]) | ||
end | ||
function stepcenters(x::Vector{T} where T<:Real) | ||
δ = x .* 0.5 | ||
s = append!(eltype(x)[0],x) | ||
return [Base.sum(s[1:i]) for i ∈ Base.eachindex(x)] .+ δ | ||
end | ||
stepedges(x::Vector{T} where T<:Real) = steps(x) | ||
|
||
## the actual plot | ||
theme = Theme(fontsize = 16, colormap = :gist_earth, ; size = (750,450)) | ||
set_theme!(theme) | ||
|
||
attr1 = (xticks = (stepcenters(x),string.(1:n)), | ||
yticks = (stepcenters(y), string.(1:n)), xlabel = "cat", ) | ||
attr2 = (xticks = (stepedges(x),string.(0:n)), | ||
yticks = (stepedges(y), string.(0:n)), xlabel="cat", ) | ||
|
||
fig = Figure() | ||
ax1 = Axis(fig[1,1]; attr1...) | ||
ax2 = Axis(fig[1,2]; attr2...) | ||
heatmap!(ax1, steps(x), steps(y), σ) | ||
heatmap!(ax2, steps(x), steps(y), σ) | ||
fig | ||
save("heatmapIrregularCategories.png", fig); # hide |
Oops, something went wrong.