Skip to content

Commit 5bfa977

Browse files
Formatting changes
1 parent 917b08e commit 5bfa977

File tree

2 files changed

+30
-28
lines changed

2 files changed

+30
-28
lines changed

ext/MakieExt/MakieExt.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ function Streamfall.Viz.quickplot(obs::Vector, sim::Vector, xticklabels::Vector,
8282
# Add small constant in case of 0-flow
8383
obs = copy(obs)
8484
sim = copy(sim)
85-
obs[obs .== 0.0] .+= 1e-4
86-
sim[sim .== 0.0] .+= 1e-4
85+
obs[obs.==0.0] .+= 1e-4
86+
sim[sim.==0.0] .+= 1e-4
8787
end
8888

8989
scale = log == false ? identity : log10
9090

91-
f = Figure(size=(850,400))
92-
flow_ax = Axis(f[1,1]; xlabel="Date", ylabel="Streamflow", yscale=scale)
93-
qq_ax = Axis(f[1,2]; xlabel="Observed", ylabel="Modeled", xscale=scale, yscale=scale)
91+
f = Figure(size=(850, 400))
92+
flow_ax = Axis(f[1, 1]; xlabel="Date", ylabel="Streamflow", yscale=scale)
93+
qq_ax = Axis(f[1, 2]; xlabel="Observed", ylabel="Modeled", xscale=scale, yscale=scale)
9494

9595
label = "$(label) ($(metric_name): $(score))"
9696
lines!(flow_ax, xticklabels, obs, label="Observed")
@@ -218,7 +218,7 @@ function Streamfall.Viz.temporal_cross_section(
218218
ax.xticks = (1:12:length(xlabels), xlabels[1:12:end])
219219
end
220220

221-
ax.xticklabelrotation = π/4
221+
ax.xticklabelrotation = π / 4
222222

223223
# Apply log scale if specified
224224
if !isnothing(tmp) && (tmp in logscale)
@@ -360,7 +360,7 @@ function Streamfall.Viz.temporal_cross_section(
360360
ax.xticks = (1:12:length(xlabels), xlabels[1:12:end])
361361
end
362362

363-
ax.xticklabelrotation = π/4
363+
ax.xticklabelrotation = π / 4
364364

365365
# Apply log scale if specified
366366
if !isnothing(tmp) && (tmp in logscale)

src/plotting.jl

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function quickplot(obs::Vector, sim::Vector, xticklabels::Vector, label="Modeled
7575
yaxis!(qqfig, :log10)
7676
end
7777

78-
combined = plot(fig, qqfig, size=(1000, 500), left_margin=10mm, bottom_margin=5mm, layout=(1,2))
78+
combined = plot(fig, qqfig, size=(1000, 500), left_margin=10mm, bottom_margin=5mm, layout=(1, 2))
7979

8080
return combined
8181
end
@@ -96,9 +96,9 @@ Plot residual between two sequences.
9696
function plot_residuals(x::Array, y::Array; xlabel="", ylabel="", title="")
9797
# 1:1 Plot
9898
fig_1to1 = scatter(x, y, legend=false,
99-
markerstrokewidth=0, markerstrokealpha=0, alpha=0.2)
99+
markerstrokewidth=0, markerstrokealpha=0, alpha=0.2)
100100
plot!(x, y, color=:red, markersize=0.1, markerstrokewidth=0,
101-
xlabel=xlabel, ylabel=ylabel, title=title)
101+
xlabel=xlabel, ylabel=ylabel, title=title)
102102

103103
return fig_1to1
104104
end
@@ -130,9 +130,9 @@ Filters out leap days.
130130
- `period::Function` : Method from `Dates` package to group (defaults to `monthday`)
131131
"""
132132
function temporal_cross_section(dates, obs;
133-
title="", ylabel="ME", label=nothing,
134-
period::Function=monthday,
135-
kwargs...) # show_extremes::Bool=false,
133+
title="", ylabel="ME", label=nothing,
134+
period::Function=monthday,
135+
kwargs...) # show_extremes::Bool=false,
136136
if isnothing(label)
137137
label = ylabel
138138
end
@@ -190,20 +190,22 @@ function temporal_cross_section(dates, obs;
190190

191191
fig = plot(xlabels, lower_95, fillrange=upper_95, color="lightblue", alpha=0.3, label="CI₉₅ μ: $(wr95_m_ind), σ: $(wr95_sd_ind)", linealpha=0)
192192
plot!(fig, xlabels, lower_75, fillrange=upper_75, color="lightblue", alpha=0.5, label="CI₇₅ μ: $(wr75_m_ind), σ: $(wr75_sd_ind)", linealpha=0)
193-
plot!(fig, xlabels, x_section,
194-
label="Mean of $(label) μ: $(m_ind), σ: $(sd_ind)",
195-
color="black",
196-
xlabel=nameof(period),
197-
ylabel=ylabel,
198-
legend=:bottomleft,
199-
legendfont=Plots.font(10),
200-
fg_legend=:transparent,
201-
bg_legend=:transparent,
202-
left_margin=5mm,
203-
bottom_margin=5mm,
204-
title=title,
205-
yformatter=format_func;
206-
kwargs...)
193+
plot!(
194+
fig, xlabels, x_section,
195+
label="Mean of $(label) μ: $(m_ind), σ: $(sd_ind)",
196+
color="black",
197+
xlabel=nameof(period),
198+
ylabel=ylabel,
199+
legend=:bottomleft,
200+
legendfont=Plots.font(10),
201+
fg_legend=:transparent,
202+
bg_legend=:transparent,
203+
left_margin=5mm,
204+
bottom_margin=5mm,
205+
title=title,
206+
yformatter=format_func;
207+
kwargs...
208+
)
207209

208210
# if show_extremes
209211
# scatter!(fig, xlabels, min_section, label="", alpha=0.5, color="lightblue", markerstrokewidth=0; kwargs...)
@@ -346,7 +348,7 @@ function plot(node::DamNode, climate::Climate)
346348
levels = plot(timesteps(climate), node.level, xlabel="Date", ylabel="Dam Level", label=node.name)
347349
outflows = plot(timesteps(climate), node.outflow, xlabel="Date", ylabel="Discharge", label=node.name)
348350

349-
combined = plot(levels, outflows, size=(1000, 400), left_margin=10mm, bottom_margin=5mm, layout=(1,2))
351+
combined = plot(levels, outflows, size=(1000, 400), left_margin=10mm, bottom_margin=5mm, layout=(1, 2))
350352

351353
return combined
352354
end

0 commit comments

Comments
 (0)