Skip to content

Commit

Permalink
Merge pull request #49 from MakieOrg/up_search
Browse files Browse the repository at this point in the history
Up search
  • Loading branch information
lazarusA authored Jun 20, 2024
2 parents ad45c9a + dcc75fd commit 0b2a8b6
Show file tree
Hide file tree
Showing 73 changed files with 1,292 additions and 1,478 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/Deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: npm # or pnpm / yarn
cache-dependency-path: 'package-lock.json' # this should be a package-lock.json file
- name: Setup Pages
Expand All @@ -54,7 +54,7 @@ jobs:
- name: Install documentation dependencies
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
- name: Install documentation dependencies
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs -e 'using Pkg; pkg"add https://github.com/LuxDL/DocumenterVitepress.jl.git"; Pkg.instantiate(); Pkg.precompile()'
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs -e 'using Pkg; Pkg.instantiate(); Pkg.precompile()'
- name: generating examples md files
env:
RASTERDATASOURCES_PATH: ".." # For downloading raster data
Expand All @@ -66,11 +66,11 @@ jobs:
- name: Build with VitePress
run: |
NODE_OPTIONS=--max-old-space-size=32768 npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
touch docs/docs_site/.vitepress/dist/.nojekyll
touch docs/docs_site/.documenter/.vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/docs_site/.vitepress/dist
path: docs/docs_site/.documenter/.vitepress/dist

# Deployment job
deploy:
Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
GDAL = "add2ef01-049f-52c4-9ee2-e494f65e021a"
GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
GeoMakie = "db073c08-6b98-4ee5-b6a4-5efafb3259c6"
Expand Down
14 changes: 6 additions & 8 deletions docs/gen_mds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ OUTPUT = joinpath(@__DIR__, "src", "examples")

folders = readdir(joinpath(@__DIR__, "..", "examples"))
setdiff!(folders, [".DS_Store"])
setdiff!(folders, ["rpr"])
#folders = ["aog", "dashboards", "geo", "rpr"]

function get_files(folders)
srcsfiles = []
Expand All @@ -16,15 +16,13 @@ function get_files(folders)
names = readdir(p)
setdiff!(names, [".DS_Store",
"world_energy.jl",
"gapminder.jl",
"gott_azimuthal.jl",
"density_ridges.jl",
"penguins.jl",
"penguins3d.jl",
"penguinsAoG.jl",
"penguinsBoxes.jl",
"penguinsViolins.jl",
"earthquakes_proj.jl",
"rasters.jl",
"submarine_cables.jl",
"textScatterLines.jl",
"gott_azimuthal.jl",
"us_states.jl",
])

fpaths = "$(f)/" .* names
Expand Down
6 changes: 4 additions & 2 deletions docs/make.jl
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/")
)
16 changes: 15 additions & 1 deletion docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,20 @@ const viteConfig = defineViteConfig({
items: [
{ text: 'heatmaps',link: '/examples/2d/heatmaps/heatmap' },
{ text: 'text_heatmap',link: '/examples/2d/heatmaps/text_heatmap' },

{ text: 'heatmap with 1 shared colorbar',link: '/examples/2d/heatmaps/heatmap1SharedCbar' },
{ text: 'heatmap with 2 shared colorbars',link: '/examples/2d/heatmaps/heatmap2SharedCbars' },
{ text: 'heatmap with bottom colorbar',link: '/examples/2d/heatmaps/heatmapCbarBottom' },
{ text: 'heatmap with left colorbar',link: '/examples/2d/heatmaps/heatmapCbarLeft' },
{ text: 'heatmap with top colorbar',link: '/examples/2d/heatmaps/heatmapCbarTop' },
{ text: 'heatmaps: grid',link: '/examples/2d/heatmaps/heatmapGrid' },
{ text: 'heatmap irregular steps',link: '/examples/2d/heatmaps/heatmapIrregular' },
{ text: 'heatmap irregular categories',link: '/examples/2d/heatmaps/heatmapIrregularCategories' },
{ text: 'heatmap: log scales',link: '/examples/2d/heatmaps/heatmapLogIrregular' },
{ text: 'heatmap: scales added',link: '/examples/2d/heatmaps/heatmapScaleAdd' },
{ text: 'heatmap: scale crosshair',link: '/examples/2d/heatmaps/heatmapScaleCrosshair' },
{ text: 'heatmap: scale detail',link: '/examples/2d/heatmaps/heatmapScaleDetail' },
{ text: 'heatmap: scale sections',link: '/examples/2d/heatmaps/heatmapScaleSections' },
{ text: 'heatmap: x, y positions',link: '/examples/2d/heatmaps/heatmapxyz' },
],
},
{
Expand Down Expand Up @@ -470,6 +483,7 @@ const viteConfig = defineViteConfig({
{ text: 'leos', link: '/examples/datavis/leos' },
{ text: 'multipleTitles', link: '/examples/datavis/multipleTitles' },
{ text: 'strange_attractors', link: '/examples/datavis/strange_attractors' },
{ text: 'candlestick', link: '/examples/datavis/candlestick' },
],
},
],
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const images = [
src: 'streamplot.png',
},
{
href: 'examples/3d/contour3d',
href: 'examples/3d/contour3d/contourf_contour3d',
src: 'contourf_contour3d.png',
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/theme_light_dark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function theme_light_dark()
Hist = (cycle = Cycle([:color, :strokecolor], covary=true),),
Stairs = (cycle=cycle1,),
Stem= (cycle=cycle5,),
Text = (cycle = [:color],),
# Text = (cycle = [:color],),
Violin = (cycle = [:color, :strokecolor, :mediancolor],),
strokewidth=0.5,
colormap= Reverse(:Hokusai3),
Expand Down Expand Up @@ -68,7 +68,7 @@ function theme_light_dark()
yminortickcolor = :grey45,
),
Legend=(framecolor=(:black, 0.35),
bgcolor=(:white, 0.1)),
backgroundcolor=(:white, 0.1)),
Axis3 = (
zlabelrotation = 0π,
xlabeloffset = 50,
Expand Down
8 changes: 4 additions & 4 deletions examples/2d/arrows/arrows.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ## Arrows

# ![](arrows.svg)
# ![](arrows.png)

using CairoMakie
CairoMakie.activate!(type = "svg") #hide
CairoMakie.activate!(type = "png") #hide

xs = LinRange(-3, 3, 20)
ys = LinRange(-3, 3, 20)
Expand All @@ -12,7 +12,7 @@ vs = [y - x for x in xs, y in ys]
strength = vec(sqrt.(us .^2 .+ vs .^2))
cmap = :gnuplot

fig = Figure(size = (600, 400))
fig = Figure(; size = (600, 400))
ax = Axis(fig[1,1], xlabel = "x", ylabel = "y", aspect = DataAspect())
arrows!(ax, xs, ys, us, vs, arrowsize = 10, lengthscale = 0.1,
arrowcolor = strength, linecolor = strength, colormap = cmap)
Expand All @@ -21,4 +21,4 @@ Colorbar(fig[1,2], limits =(minimum(strength), maximum(strength)),
limits!(ax, -3,3,-3,3)
colsize!(fig.layout, 1, Aspect(1, 1.0))
fig
save("arrows.svg", fig); # hide
save("arrows.png", fig); # hide
6 changes: 3 additions & 3 deletions examples/2d/density/density.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ## density plot

# ![](density.svg)
# ![](density.png)

using CairoMakie, Distributions, Random
CairoMakie.activate!(type = "svg") #hide
CairoMakie.activate!(type = "png") #hide

Random.seed!(124)
colors = ["#FF410D", "#6EE2FF", "#F7C530", "#95CC5E", "#D0DFE6", "#F79D1E"]
Expand All @@ -20,4 +20,4 @@ end
axislegend(L"\mu,\quad\sigma"; position= :cb, titlesize= 22)
hidedecorations!(ax; grid = false)
fig
save("density.svg", fig); # hide
save("density.png", fig); # hide
1 change: 1 addition & 0 deletions examples/2d/heatmaps/heatmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using CairoMakie, Random
CairoMakie.activate!(type = "svg") #hide

using GLMakie
Random.seed!(123)
fig = Figure(size = (600, 400))
ax = Axis(fig[1, 1]; xlabel = "x", ylabel = "y")
Expand Down
19 changes: 19 additions & 0 deletions examples/2d/heatmaps/heatmap1SharedCbar.jl
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
20 changes: 20 additions & 0 deletions examples/2d/heatmaps/heatmap2SharedCbars.jl
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
16 changes: 16 additions & 0 deletions examples/2d/heatmaps/heatmapCbarBottom.jl
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
16 changes: 16 additions & 0 deletions examples/2d/heatmaps/heatmapCbarLeft.jl
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
16 changes: 16 additions & 0 deletions examples/2d/heatmaps/heatmapCbarTop.jl
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
19 changes: 19 additions & 0 deletions examples/2d/heatmaps/heatmapGrid.jl
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
18 changes: 18 additions & 0 deletions examples/2d/heatmaps/heatmapIrregular.jl
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
43 changes: 43 additions & 0 deletions examples/2d/heatmaps/heatmapIrregularCategories.jl
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
Loading

0 comments on commit 0b2a8b6

Please sign in to comment.