Skip to content

Commit

Permalink
change y axis to linear scale in ci plots
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Mar 14, 2024
1 parent 8371841 commit 2bc7f22
Showing 1 changed file with 20 additions and 29 deletions.
49 changes: 20 additions & 29 deletions post_processing/ci_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# vars,
# y = 0.0,
# time = LAST_SNAP,
# more_kwargs = YLOGSCALE,
# more_kwargs = YLINEARSCALE,
# )
# end
# ```
Expand Down Expand Up @@ -93,24 +93,15 @@ const LAST_SNAP = LARGE_NUM
const FIRST_SNAP = -LARGE_NUM
const BOTTOM_LVL = -LARGE_NUM
const TOP_LVL = LARGE_NUM
const H_EARTH = 7000
# Shorthand for logscale on y axis and to move the dimension to the y axis on line plots
# (because they are columns)
Plvl(y) = -H_EARTH * log(y)
Makie.inverse_transform(::typeof(Plvl)) = (y) -> exp(-y / H_EARTH)
Makie.defaultlimits(::typeof(Plvl)) = (0.0000001, 1)
Makie.defined_interval(::typeof(Plvl)) = Makie.OpenInterval(0.0, Inf)
function Makie.get_tickvalues(yticks::Int, yscale::typeof(Plvl), ymin, ymax)
exp_func = Makie.inverse_transform(yscale)
exp_z_min, exp_z_max = exp_func(ymin), exp_func(ymax)
return Plvl.(range(exp_z_min, exp_z_max, yticks))

function Makie.get_tickvalues(yticks::Int, ymin, ymax)
return range(max(ymin, 0), ymax, yticks)
end

YLOGSCALE = Dict(
YLINEARSCALE = Dict(
:axis => ca_kwargs(
dim_on_y = true,
yscale = Plvl,
yticks = 7,
yticks = 10,
ytickformat = "{:.3e}",
),
)
Expand Down Expand Up @@ -391,7 +382,7 @@ make_plots_generic(
time = LAST_SNAP,
x = 0.0, # Our columns are still 3D objects...
y = 0.0,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
```
If we want to be more daring, we can mix in some information about `reductions` and `periods`
Expand All @@ -407,7 +398,7 @@ make_plots_generic(
time = LAST_SNAP,
x = 0.0, # Our columns are still 3D objects...
y = 0.0,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
```
"""
Expand Down Expand Up @@ -435,7 +426,7 @@ function make_plots(::ColumnPlots, output_paths::Vector{<:AbstractString})
x = 0.0, # Our columns are still 3D objects...
y = 0.0,
MAX_NUM_COLS = length(simdirs),
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
end

Expand All @@ -453,7 +444,7 @@ function make_plots(
vars,
y = 0.0,
time = LAST_SNAP,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
end

Expand Down Expand Up @@ -541,7 +532,7 @@ function make_plots(::MountainPlots, output_paths::Vector{<:AbstractString})
output_paths,
vars,
time = LAST_SNAP,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
end

Expand All @@ -556,7 +547,7 @@ function make_plots(
output_paths,
vars,
time = LAST_SNAP,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
end

Expand All @@ -573,7 +564,7 @@ function make_plots(
output_paths,
vars,
time = LAST_SNAP,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
end

Expand Down Expand Up @@ -637,7 +628,7 @@ function make_plots(
output_paths,
vars,
time = LAST_SNAP,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
end

Expand Down Expand Up @@ -680,7 +671,7 @@ function make_plots(
output_paths,
vars,
time = LAST_SNAP,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
end

Expand Down Expand Up @@ -708,7 +699,7 @@ function make_plots(
output_paths,
vars_3D,
time = LAST_SNAP,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
make_plots_generic(
output_paths,
Expand Down Expand Up @@ -761,7 +752,7 @@ function make_plots(
output_paths,
vars_3D,
time = LAST_SNAP,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
make_plots_generic(
output_paths,
Expand Down Expand Up @@ -823,7 +814,7 @@ function make_plots(
output_paths,
vars_3D,
time = LAST_SNAP,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
make_plots_generic(
output_paths,
Expand Down Expand Up @@ -874,7 +865,7 @@ function make_plots(::AquaplanetPlots, output_paths::Vector{<:AbstractString})
output_paths,
vars_3D,
time = LAST_SNAP,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
make_plots_generic(
output_paths,
Expand Down Expand Up @@ -931,7 +922,7 @@ function make_plots(::Aquaplanet1MPlots, output_paths::Vector{<:AbstractString})
output_paths,
vars_3D,
time = LAST_SNAP,
more_kwargs = YLOGSCALE,
more_kwargs = YLINEARSCALE,
)
make_plots_generic(
output_paths,
Expand Down

0 comments on commit 2bc7f22

Please sign in to comment.