Skip to content

Commit

Permalink
Merge pull request #165 from mabarnes/makie-resolution-to-size
Browse files Browse the repository at this point in the history
Replace deprecated `resolution` kwarg with `size` for Makie calls
  • Loading branch information
johnomotani authored Nov 30, 2023
2 parents 137b9ca + 6066997 commit 45cb3d3
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions src/makie_post_processing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2674,7 +2674,7 @@ end

"""
get_1d_ax(n=nothing; title=nothing, subtitles=nothing, yscale=nothing,
get_legend_place=nothing, kwargs...)
get_legend_place=nothing, size=nothing, kwargs...)
Create a new `Figure` `fig` and `Axis` `ax` intended for 1d plots.
Expand All @@ -2696,13 +2696,13 @@ increased in proportion to `n`.
When `n` is passed, `subtitles` can be passed a Tuple of length `n` which will be used to
set a subtitle for each `Axis` in `ax`.
`resolution` is passed through to the `Figure` constructor. Its default value is
`(600, 400)` if `n` is not passed, or `(600*n, 400)` if `n` is passed.
`size` is passed through to the `Figure` constructor. Its default value is `(600, 400)` if
`n` is not passed, or `(600*n, 400)` if `n` is passed.
Extra `kwargs` are passed to the `Axis()` constructor.
"""
function get_1d_ax(n=nothing; title=nothing, subtitles=nothing, yscale=nothing,
get_legend_place=nothing, resolution=(600, 400), kwargs...)
get_legend_place=nothing, size=nothing, kwargs...)
valid_legend_places = (nothing, :left, :right, :above, :below)
if get_legend_place valid_legend_places
error("get_legend_place=$get_legend_place is not one of $valid_legend_places")
Expand All @@ -2711,10 +2711,10 @@ function get_1d_ax(n=nothing; title=nothing, subtitles=nothing, yscale=nothing,
kwargs = tuple(kwargs..., :yscale=>yscale)
end
if n == nothing
if resolution == nothing
resolution = (600, 400)
if size == nothing
size = (600, 400)
end
fig = Figure(resolution=resolution)
fig = Figure(size=size)
ax = Axis(fig[1,1]; kwargs...)
if get_legend_place === :left
legend_place = fig[1,0]
Expand All @@ -2730,10 +2730,10 @@ function get_1d_ax(n=nothing; title=nothing, subtitles=nothing, yscale=nothing,
Label(title_layout[1,1:2], title)
end
else
if resolution == nothing
resolution = (600*n, 400)
if size == nothing
size = (600*n, 400)
end
fig = Figure(resolution=resolution)
fig = Figure(size=size)
plot_layout = fig[1,1] = GridLayout()

if title !== nothing
Expand Down Expand Up @@ -2791,7 +2791,7 @@ function get_1d_ax(n=nothing; title=nothing, subtitles=nothing, yscale=nothing,
end

"""
get_2d_ax(n=nothing; title=nothing, subtitles=nothing, kwargs...)
get_2d_ax(n=nothing; title=nothing, subtitles=nothing, size=nothing, kwargs...)
Create a new `Figure` `fig` and `Axis` `ax` intended for 2d plots.
Expand All @@ -2807,18 +2807,17 @@ horizontal row, and the width of the figure is increased in proportion to `n`.
When `n` is passed, `subtitles` can be passed a Tuple of length `n` which will be used to
set a subtitle for each `Axis` in `ax`.
`resolution` is passed through to the `Figure` constructor. Its default value is
`(600, 400)` if `n` is not passed, or `(600*n, 400)` if `n` is passed.
`size` is passed through to the `Figure` constructor. Its default value is `(600, 400)` if
`n` is not passed, or `(600*n, 400)` if `n` is passed.
Extra `kwargs` are passed to the `Axis()` constructor.
"""
function get_2d_ax(n=nothing; title=nothing, subtitles=nothing, resolution=nothing,
kwargs...)
function get_2d_ax(n=nothing; title=nothing, subtitles=nothing, size=nothing, kwargs...)
if n == nothing
if resolution == nothing
resolution = (600, 400)
if size == nothing
size = (600, 400)
end
fig = Figure(resolution=resolution)
fig = Figure(size=size)
if title !== nothing
title_layout = fig[1,1] = GridLayout()
Label(title_layout[1,1:2], title)
Expand All @@ -2829,10 +2828,10 @@ function get_2d_ax(n=nothing; title=nothing, subtitles=nothing, resolution=nothi
ax = Axis(fig[irow,1]; kwargs...)
colorbar_place = fig[irow,2]
else
if resolution == nothing
resolution = (600*n, 400)
if size == nothing
size = (600*n, 400)
end
fig = Figure(resolution=resolution)
fig = Figure(size=size)

if title !== nothing
title_layout = fig[1,1] = GridLayout()
Expand Down

0 comments on commit 45cb3d3

Please sign in to comment.