diff --git a/CHANGELOG.md b/CHANGELOG.md index d8ef11a..9ee5bbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [1.16.3] - 2026-01-07 +- Add `title`, `xlabel`, and `ylabel` to 1D and 2D `gridplot!` with `GLMakie` +- Add `title`, `xlabel`, and `ylabel` to 1D and 2D `gridplot!` with `Py[thon]Plot` + ## [1.16.2] - 2025-12-04 - `leglocs[:cc]`: correct "center center" to "center" diff --git a/Project.toml b/Project.toml index 213e64d..fc72edc 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GridVisualize" uuid = "5eed8a63-0fb0-45eb-886d-8d5a387d12b8" authors = ["Juergen Fuhrmann ", "Patrick Jaap "] -version = "1.16.2" +version = "1.16.3" [deps] ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4" diff --git a/ext/GridVisualizeMakieExt.jl b/ext/GridVisualizeMakieExt.jl index 9ff52a7..1a5ac2f 100644 --- a/ext/GridVisualizeMakieExt.jl +++ b/ext/GridVisualizeMakieExt.jl @@ -275,6 +275,7 @@ function scenecorners1d(grid, gridscale) return [Point2f(xmin * gridscale, -5 * h), Point2f(xmax * gridscale, 5 * h)] end +# 1D version function gridplot!(ctx, TP::Type{MakieType}, ::Type{Val{1}}, grid) XMakie = ctx[:Plotter] nregions = num_cellregions(grid) @@ -286,6 +287,7 @@ function gridplot!(ctx, TP::Type{MakieType}, ::Type{Val{1}}, grid) yticklabelsvisible = false, yticksvisible = false, title = ctx[:title], + xlabel = ctx[:xlabel], scenekwargs(ctx)..., ) @@ -619,6 +621,8 @@ function gridplot!(ctx, TP::Type{MakieType}, ::Type{Val{2}}, grid) ctx[:scene] = XMakie.Axis( ctx[:figure]; title = ctx[:title], + xlabel = ctx[:xlabel], + ylabel = ctx[:ylabel], aspect = aspect, autolimitaspect = autolimitaspect, scenekwargs(ctx)..., diff --git a/src/dispatch.jl b/src/dispatch.jl index 2d50129..dd54279 100644 --- a/src/dispatch.jl +++ b/src/dispatch.jl @@ -221,7 +221,7 @@ Depending on the `layout` keyword argument, a 2D grid of subplots is created. Further `...plot!` commands then plot into one of these subplots: ```julia -vis=GridVisualizer(Plotter=PyPlot, layout=(2,2) +vis=GridVisualizer(Plotter=PyPlot, layout=(2,2)) ...plot!(vis[1,2], ...) ``` diff --git a/src/pycommon.jl b/src/pycommon.jl index 2f72658..8155754 100644 --- a/src/pycommon.jl +++ b/src/pycommon.jl @@ -149,6 +149,9 @@ function gridplot!(ctx, TP::Type{T}, ::Type{Val{1}}, grid) where {T <: AbstractP ax.grid(true) ax.get_yaxis().set_ticks(Float64[]) ax.set_ylim(-5 * h, xmax - xmin) + ax.set_title(ctx[:title]) + ax.set_xlabel(ctx[:xlabel]) + cmap = region_cmap(max(ncellregions, 5)) gridscale = ctx[:gridscale] @@ -212,6 +215,9 @@ function gridplot!(ctx, TP::Type{T}, ::Type{Val{2}}, grid) where {T <: AbstractP end end ax = ctx[:ax] + ax.set_title(ctx[:title]) + ax.set_xlabel(ctx[:xlabel]) + ax.set_ylabel(ctx[:ylabel]) fig = ctx[:figure] cellregions = cellcolors(grid, ctx[:cellcoloring]) ncellregions = num_cellcolors(grid, ctx[:cellcoloring])