makieorg / beautifulmakie Goto Github PK
View Code? Open in Web Editor NEWWeb page with basic examples showing how to use makie in julia
Home Page: https://beautiful.makie.org
License: MIT License
Web page with basic examples showing how to use makie in julia
Home Page: https://beautiful.makie.org
License: MIT License
It seems that whenever I click on a link the left menu, the positioning of the menu list resets to the top of the list rather than holding the position of the link that was clicked.
This makes it clunky to explore a series of examples under a particular heading like "Geoplots"
Anyway to make the position of the link list hold at the clicked link?
It looks like currently, the examples have to be run locally, and then the resulting files moved manually into place? I couldn't really find more logic than in the files in this folder https://github.com/lazarusA/BeautifulMakie/tree/main/_assets
Maybe we can think about ways in which this can be streamlined, and maybe just run when deploying.
One can automatically create md files during deployment, and then run optimization again to include them as well, they don't have to be added to the git repository itself. Or maybe you had some specific ideas already?
That would also help when generating thumbnails for the overview page (it takes long to load otherwise) etc.
One of the things I found really useful about the previous version of BeautifulMakie was that you could scroll through a gallery, look for a plot resembling what you wanted, and learn about the relevant functions used to create that plot. This was helpful especially since I didn't know the names of some types of plots I was looking for.
With the new version, if I don't know specifically what I'm looking for, I have to click through each link find a relevant example.
e.g. https://texample.net does this, where you can see a preview of each example on a single page, then click on it. We used to have that in MakieGallery as well, which is still up at https://juliaplots.github.io/MakieReferenceImages/gallery !
It would be great to have something like that here, as a welcoming front page. We could also possibly incorporate the documentation example plots in here, by parsing the docs!
When I open the website on my desktop, the menu sections are all the way to the right with grayish color on white background. Perhaps you could move these to the left of the top bar and change the color to something more visible.
I think it would make more sense for the purpose of browsing
A common plot is an Arrhenius plot.
Other plots that might be of interest are plots with (multiple) y axis on the left and the right hand side or a parallel coordinates plot like seen here:
https://plotly.com/python/parallel-coordinates-plot/
Spectacular page! :) Awesome work.
I spent a few seconds looking for a copyable link to Makie.jl on the front page, to save me having to visit github.com - did I miss one? Perhaps a link at the bottom?
Hello,
I noticed that https://beautiful.makie.org/dev/ is not linked anywhere obvious from the main https://docs.makie.org/stable/ .
The examples on beautiful Makie are a really nice addition, but right now you have to know about Beautiful Makie already / use a search engine to find them.
Maybe a "Gallery" link could be included at the top of https://docs.makie.org/stable/?
Thanks!
Is the following example of interest to you? I have more if you like.
using CairoMakie
CairoMakie.activate!()
x = [1,4,1,4,2] # specify x steplength
y = [0.5,2,1,4.5,1.5] # specify y steplength
σ = rand(length(x), length(y)) # beware of dims
theme = Theme(fontsize = 10, colormap = :gist_earth, resolution = (600,400) ); set_theme!(theme)
attr1 = (xticks=(stepcenters(x),string.(1:5)), yticks=(stepcenters(y),string.(1:5)), xlabel="x", )
attr2 = (xticks=(stepedges(x),string.(0:5)), yticks=(stepedges(y),string.(0:5)), xlabel="x", )
f = Figure()
ax = Axis(f[1,1]; attr1...); heatmap!(ax, steps(x), steps(y), σ)
ax = Axis(f[1,2]; attr2...); heatmap!(ax, steps(x), steps(y), σ)
f
for this you need the following convenience functions:
function steps(x::Vector{T} where T<:Real)
sum(x .< 0) == 0 || error("Error: $x - nagative 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)
Just a suggestion. After seeing the cube example
A comment on SO asking for something similar in Plots.jl said "this code is complicated for me" (and that they wanted to use Plots.jl, but that's not my point here).
Would it be possible to cook up a simpler cube example? The code is a little bit on the long side IMHO (Maybe building from the SO question code/data)
I couldn't find a nice easy image histogram easily, so I wonder if it might be a nice addition to your beautiful collection?
I struggled to make this:
using CairoMakie
using StatsBase
using Images
using TestImages
function image_histogram()
img = testimage("lighthouse")
fig = Figure(); ax = Axis(fig[1, 1])
reds = vec(float.(red.(img)))
greens = vec(float.(green.(img)))
blues = vec(float.(blue.(img)))
for (i, col) = enumerate([:red, :green, :blue])
hist!(ax, (reds, greens, blues)[i], scale_to=-0.6, bins=60, offset=i, direction=:x, color=col)
end
fig
end
fig = with_theme(image_histogram, theme_black())
I think a better version of this could be useful. People ask for it on stack overflow and discourse...
The example of geo raster not work any more.
It broke at here:
BeautifulMakie/examples/geo/rasters.jl
Lines 157 to 164 in da50ba5
[c9ce4bd3] ArchGDAL v0.10.1
[82cc6244] DataInterpolations v4.4.0
[e9467ef8] GLMakie v0.8.11
[ee78f7c6] Makie v0.19.11
[3cb90ccd] RasterDataSources v0.5.7
[a3a2b9e3] Rasters v0.9.0
using Rasters
using RasterDataSources
using ArchGDAL
using GLMakie
using Makie.GeometryBasics
using Makie.GeometryBasics: Tesselation, uv_normal_mesh
# using DataInterpolations, Printf
m = Makie.GeometryBasics.uv_normal_mesh(
Makie.GeometryBasics.Tesselation(
Makie.GeometryBasics.Sphere(
Point3f(0), 1.0f0
),
200
)
);
p = decompose(Point3f0, m)
uv = decompose_uv(m)
norms = decompose_normals(m);
cmap = [:darkblue, :deepskyblue2, :deepskyblue, :gold, :tomato3, :red, :darkred]
ENV["RASTERDATASOURCES_PATH"] = "data"
worldclim_stacks = [RasterStack(WorldClim{Climate}, month=i) for i in 1:12]
ra = worldclim_stacks[10].tmax
fig = Figure(resolution=(1600, 1600), backgroundcolor=:snow2) # 地图
ax, plt_obj = mesh(fig[1, 1],
uv_normal_mesh(Tesselation(Makie.GeometryBasics.Sphere(Point3f(0), 0.99), 128));
color=(:white, 0.1), transparency=true,
axis=(type=LScene, show_axis=false)
)
temperature_plot = mesh!(fig[1, 1],
m;
color=Makie.convert_arguments(Makie.ContinuousSurface(), ra)[3]',
# colorrange=(-0.1, 0.1),
colormap=:tableau_temperature, #cmap,
shading=true,
transparency=false
)
fig
ERROR: MethodError: no method matching GLMakie.GLAbstraction.GLBuffer(::LinearAlgebra.Adjoint{Float32, Matrix{Float32}})
Closest candidates are:
(::Type{GPUArrayType})(::Observable; kw...) where GPUArrayType<:GLMakie.GLAbstraction.GPUArray
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\GLAbstraction\AbstractGPUArray.jl:193
GLMakie.GLAbstraction.GLBuffer(::Type{T}, ::Int64; buffertype, usage) where T<:Union{Real, ColorTypes.Colorant, StaticArraysCore.StaticArray{Tuple{N}, T, 1} where {N, T}}
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLBuffer.jl:96
GLMakie.GLAbstraction.GLBuffer(::GLMakie.GLAbstraction.GLBuffer)
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLBuffer.jl:79
...
Stacktrace:
[1] GLMakie.GLAbstraction.GLBuffer(data::Observable{LinearAlgebra.Adjoint{Float32, Matrix{Float32}}}; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ GLMakie.GLAbstraction C:\Users\kong\.julia\packages\GLMakie\wkomB\src\GLAbstraction\AbstractGPUArray.jl:194
[2] GLMakie.GLAbstraction.GLBuffer(data::Observable{LinearAlgebra.Adjoint{Float32, Matrix{Float32}}})
@ GLMakie.GLAbstraction C:\Users\kong\.julia\packages\GLMakie\wkomB\src\GLAbstraction\AbstractGPUArray.jl:193
[3] gl_convert(::Type{GLMakie.GLAbstraction.GLBuffer}, a::Observable{LinearAlgebra.Adjoint{Float32, Matrix{Float32}}}; kw_args::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ GLMakie.GLAbstraction C:\Users\kong\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLUniforms.jl:261
[4] gl_convert(::Type{GLMakie.GLAbstraction.GLBuffer}, a::Observable{LinearAlgebra.Adjoint{Float32, Matrix{Float32}}})
@ GLMakie.GLAbstraction C:\Users\kong\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLUniforms.jl:258
[5] GLMakie.GLAbstraction.RenderObject(data::Dict{Symbol, Any}, program::GLMakie.GLVisualizeShader, pre::GLMakie.GLAbstraction.StandardPrerender, post::GLFW.Window, context::GLFW.Window)
@ GLMakie.GLAbstraction C:\Users\kong\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLTypes.jl:431
[6] GLMakie.GLAbstraction.RenderObject(data::Dict{Symbol, Any}, program::GLMakie.GLVisualizeShader, pre::GLMakie.GLAbstraction.StandardPrerender, post::GLFW.Window)
@ GLMakie.GLAbstraction C:\Users\kong\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLTypes.jl:404
[7] assemble_shader(data::Dict{Symbol, Any})
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\glshaders\visualize_interface.jl:108
[8] draw_mesh(screen::GLMakie.Screen{GLFW.Window}, data::Dict{Symbol, Any})
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\glshaders\mesh.jl:64
[9] mesh_inner(screen::GLMakie.Screen{GLFW.Window}, mesh::Observable{GeometryBasics.Mesh{3, Float32, TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, FaceView{TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NgonFace{3, OffsetInteger{-1, UInt32}}, StructArrays.StructVector{PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NamedTuple{(:position, :uv, :normals), Tuple{Vector{Point{3, Float32}}, Vector{Vec{2, Float32}}, Vector{Vec{3, Float32}}}}, Int64}, Vector{NgonFace{3, OffsetInteger{-1, UInt32}}}}}}, transfunc::Observable{Any}, gl_attributes::Dict{Symbol, Any}, space::Observable{Any})
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\drawing_primitives.jl:534
[10] (::GLMakie.var"#255#256"{GLMakie.Screen{GLFW.Window}, MakieCore.Mesh{Tuple{GeometryBasics.Mesh{3, Float32, TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, FaceView{TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NgonFace{3, OffsetInteger{-1, UInt32}}, StructArrays.StructVector{PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NamedTuple{(:position, :uv, :normals), Tuple{Vector{Point{3, Float32}}, Vector{Vec{2, Float32}}, Vector{Vec{3, Float32}}}}, Int64}, Vector{NgonFace{3, OffsetInteger{-1, UInt32}}}}}}}})(gl_attributes::Dict{Symbol, Any})
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\drawing_primitives.jl:541
[11] (::GLMakie.var"#177#180"{GLMakie.var"#255#256"{GLMakie.Screen{GLFW.Window}, MakieCore.Mesh{Tuple{GeometryBasics.Mesh{3, Float32, TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, FaceView{TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NgonFace{3, OffsetInteger{-1, UInt32}}, StructArrays.StructVector{PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NamedTuple{(:position, :uv, :normals), Tuple{Vector{Point{3, Float32}}, Vector{Vec{2, Float32}}, Vector{Vec{3, Float32}}}}, Int64}, Vector{NgonFace{3, OffsetInteger{-1, UInt32}}}}}}}}, GLMakie.Screen{GLFW.Window}, Scene, MakieCore.Mesh{Tuple{GeometryBasics.Mesh{3, Float32, TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, FaceView{TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NgonFace{3, OffsetInteger{-1, UInt32}}, StructArrays.StructVector{PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NamedTuple{(:position, :uv, :normals), Tuple{Vector{Point{3, Float32}}, Vector{Vec{2, Float32}}, Vector{Vec{3, Float32}}}}, Int64}, Vector{NgonFace{3, OffsetInteger{-1, UInt32}}}}}}}})()
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\drawing_primitives.jl:135
[12] get!(default::GLMakie.var"#177#180"{GLMakie.var"#255#256"{GLMakie.Screen{GLFW.Window}, MakieCore.Mesh{Tuple{GeometryBasics.Mesh{3, Float32, TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, FaceView{TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NgonFace{3, OffsetInteger{-1, UInt32}}, StructArrays.StructVector{PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NamedTuple{(:position, :uv, :normals), Tuple{Vector{Point{3, Float32}}, Vector{Vec{2, Float32}}, Vector{Vec{3, Float32}}}}, Int64}, Vector{NgonFace{3, OffsetInteger{-1, UInt32}}}}}}}}, GLMakie.Screen{GLFW.Window}, Scene, MakieCore.Mesh{Tuple{GeometryBasics.Mesh{3, Float32, TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, FaceView{TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NgonFace{3, OffsetInteger{-1, UInt32}}, StructArrays.StructVector{PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NamedTuple{(:position, :uv, :normals), Tuple{Vector{Point{3, Float32}}, Vector{Vec{2, Float32}}, Vector{Vec{3, Float32}}}}, Int64}, Vector{NgonFace{3, OffsetInteger{-1, UInt32}}}}}}}}, h::Dict{UInt64, GLMakie.GLAbstraction.RenderObject}, key::UInt64)
@ Base .\dict.jl:468
[13] cached_robj!(robj_func::GLMakie.var"#255#256"{GLMakie.Screen{GLFW.Window}, MakieCore.Mesh{Tuple{GeometryBasics.Mesh{3, Float32, TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, FaceView{TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NgonFace{3, OffsetInteger{-1, UInt32}}, StructArrays.StructVector{PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NamedTuple{(:position, :uv, :normals), Tuple{Vector{Point{3, Float32}}, Vector{Vec{2, Float32}}, Vector{Vec{3, Float32}}}}, Int64}, Vector{NgonFace{3, OffsetInteger{-1, UInt32}}}}}}}}, screen::GLMakie.Screen{GLFW.Window}, scene::Scene, x::MakieCore.Mesh{Tuple{GeometryBasics.Mesh{3, Float32, TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, FaceView{TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NgonFace{3, OffsetInteger{-1, UInt32}}, StructArrays.StructVector{PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NamedTuple{(:position, :uv, :normals), Tuple{Vector{Point{3, Float32}}, Vector{Vec{2, Float32}}, Vector{Vec{3, Float32}}}}, Int64}, Vector{NgonFace{3, OffsetInteger{-1, UInt32}}}}}}})
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\drawing_primitives.jl:103
[14] draw_atomic
@ C:\Users\kong\.julia\packages\GLMakie\wkomB\src\drawing_primitives.jl:538 [inlined]
[15] insert!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene, x::MakieCore.Mesh{Tuple{GeometryBasics.Mesh{3, Float32, TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, FaceView{TriangleP{3, Float32, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}}, PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NgonFace{3, OffsetInteger{-1, UInt32}}, StructArrays.StructVector{PointMeta{3, Float32, Point{3, Float32}, (:uv, :normals), Tuple{Vec{2, Float32}, Vec{3, Float32}}}, NamedTuple{(:position, :uv, :normals), Tuple{Vector{Point{3, Float32}}, Vector{Vec{2, Float32}}, Vector{Vec{3, Float32}}}}, Int64}, Vector{NgonFace{3, OffsetInteger{-1, UInt32}}}}}}})
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\drawing_primitives.jl:151
[16] insertplots!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene)
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\screen.jl:447
[17] insertplots!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene) (repeats 2 times)
@ GLMakie C:\Users\kong\.julia\packages\GLMakie\wkomB\src\screen.jl:450
[18] display_scene!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.