Skip to content

Commit 4b48c2a

Browse files
committed
rft: Abdul-Razzak and Ghan 2000 Figure 1 to Makie
1 parent 1a32419 commit 4b48c2a

File tree

1 file changed

+29
-45
lines changed

1 file changed

+29
-45
lines changed

docs/src/plots/ARGplots_fig1.jl

Lines changed: 29 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Plots as PL
1+
import CairoMakie as MK
22

33
import CloudMicrophysics as CM
44
import CloudMicrophysics.AerosolModel as AM
@@ -35,62 +35,46 @@ sulfate = CMP.Sulfate(FT)
3535

3636
mass_fractions_1 = (1.0,)
3737
paper_mode_1_B = AM.Mode_B(
38-
r_dry,
39-
stdev,
40-
N_1,
41-
mass_fractions_1,
42-
(sulfate.ϵ,),
43-
(sulfate.ϕ,),
44-
(sulfate.M,),
45-
(sulfate.ν,),
46-
(sulfate.ρ,),
38+
r_dry, stdev, N_1, mass_fractions_1,
39+
(sulfate.ϵ,), (sulfate.ϕ,), (sulfate.M,), (sulfate.ν,), (sulfate.ρ,),
4740
)
4841

4942
N_2_range = range(0, stop = 5000 * 1e6, length = 100)
50-
N_act_frac_B = Vector{Float64}(undef, 100)
43+
N_act_frac_B = similar(N_2_range)
5144

52-
it = 1
53-
for N_2 in N_2_range
45+
for (it, N_2) in enumerate(N_2_range)
5446
mass_fractions_2 = (1.0,)
5547
paper_mode_2_B = AM.Mode_B(
56-
r_dry,
57-
stdev,
58-
N_2,
59-
mass_fractions_2,
60-
(sulfate.ϵ,),
61-
(sulfate.ϕ,),
62-
(sulfate.M,),
63-
(sulfate.ν,),
64-
(sulfate.ρ,),
48+
r_dry, stdev, N_2, mass_fractions_2,
49+
(sulfate.ϵ,), (sulfate.ϕ,), (sulfate.M,), (sulfate.ν,), (sulfate.ρ,),
6550
)
6651
AD_B = AM.AerosolDistribution((paper_mode_1_B, paper_mode_2_B))
67-
N_act_frac_B[it] =
68-
AA.N_activated_per_mode(ap, AD_B, aip, tps, T, p, w, q_vs, FT(0), FT(0))[1] / N_1
69-
global it += 1
52+
N_act_frac_B[it] = AA.N_activated_per_mode(ap, AD_B, aip, tps, T, p, w, q_vs, FT(0), FT(0))[1] / N_1
7053
end
7154

7255
# data read from Fig 1 in Abdul-Razzak and Ghan 2000
7356
# using https://automeris.io/WebPlotDigitizer/
7457
include(joinpath(pkgdir(CM), "docs", "src", "plots", "ARGdata.jl"))
7558

76-
PL.plot(
77-
N_2_range * 1e-6,
78-
N_act_frac_B,
79-
label = "CliMA-B",
80-
xlabel = "Mode 2 aerosol number concentration [1/cm3]",
81-
ylabel = "Mode 1 number fraction activated",
82-
)
83-
PL.scatter!(
84-
Fig1_x_obs,
85-
Fig1_y_obs,
86-
markercolor = :black,
87-
label = "paper observations",
88-
)
89-
PL.plot!(
90-
Fig1_x_param,
91-
Fig1_y_param,
92-
linecolor = :black,
93-
label = "paper parameterization",
94-
)
59+
# Create figure and axis
60+
m_to_cm = FT(100)
61+
fig = MK.with_theme(MK.theme_minimal(), linewidth = 2, fontsize = 14) do
62+
fig = MK.Figure()
63+
ax = MK.Axis(fig[1, 1];
64+
xlabel = "Mode 2 aerosol number concentration [1/cm³]", ylabel = "Mode 1 number fraction activated",
65+
limits = (extrema(N_2_range) ./ m_to_cm^3, (0, 1)),
66+
)
67+
68+
# Plot the computed data
69+
MK.lines!(ax, N_2_range / m_to_cm^3, N_act_frac_B; label = "CliMA-B")
70+
# Plot the observed data points
71+
MK.scatter!(ax, Fig1_x_obs, Fig1_y_obs; label = "paper observations", color = :black, markersize = 15)
72+
# Plot the parameterization line
73+
MK.lines!(ax, Fig1_x_param, Fig1_y_param; label = "paper parameterization", color = :black)
74+
# Add legend
75+
MK.axislegend(ax, position = :rt)
76+
# Save the figure
77+
# MK.save("Abdul-Razzak_and_Ghan_fig_1.svg", fig)
9578

96-
PL.savefig("Abdul-Razzak_and_Ghan_fig_1.svg")
79+
fig
80+
end

0 commit comments

Comments
 (0)