11module PlotsExt
22
3- using Plots, StatsPlots
4- using Plots. Measures
3+ using StatsPlots
4+ using StatsPlots . Plots. Measures
55
66using DataFrames, Dates, Statistics, Distributions, LaTeXStrings
77import Bootstrap: bootstrap, BalancedSampling
88
99using Streamfall
1010import Streamfall: Analysis. TemporalCrossSection
11+ import Streamfall. Viz: symlog
1112
1213function Streamfall. Viz. plot (node:: NetworkNode , climate:: Climate )
1314 return Plots. plot (
@@ -50,23 +51,23 @@ function Streamfall.Viz.quickplot(node::NetworkNode, climate::Climate)
5051
5152 @assert length (all_dates) == length (node. outflow) || " Date length and result lengths do not match!"
5253
53- fig = plot (all_dates, node. outflow)
54+ fig = Plots . plot (all_dates, node. outflow)
5455
5556 return fig
5657end
57- function Streamfall. Viz. quickplot (obs, node:: NetworkNode , climate:: Climate , label= " " , log= false ; burn_in= 1 , limit= nothing , metric= Streamfall. mKGE)
58- return Streamfall. Viz. quickplot (obs, node. outflow, climate, label, log; burn_in= burn_in , limit= limit, metric = metric)
58+ function Streamfall. Viz. quickplot (obs:: Vector , node:: NetworkNode , climate:: Climate ; label:: String = " " , log:: Bool = false , burn_in= 1 , limit= nothing , metric= Streamfall. mKGE)
59+ return Streamfall. Viz. quickplot (obs, node. outflow, climate; label, log, burn_in, limit, metric)
5960end
60- function Streamfall. Viz. quickplot (obs:: DataFrame , sim:: Vector , climate:: Climate , label= " " , log= false ; burn_in= 1 , limit= nothing , metric= Streamfall. mKGE)
61+ function Streamfall. Viz. quickplot (obs:: DataFrame , sim:: Vector , climate:: Climate ; label:: String = " " , log:: Bool = false , burn_in= 1 , limit= nothing , metric= Streamfall. mKGE)
6162 return Streamfall. Viz. quickplot (Matrix (obs[:, Not (" Date" )])[:, 1 ], sim, climate, label, log; burn_in, limit, metric)
6263end
63- function Streamfall. Viz. quickplot (obs:: Vector , sim:: Vector , climate:: Climate , label= " " , log= false ; burn_in= 1 , limit= nothing , metric= Streamfall. mKGE)
64+ function Streamfall. Viz. quickplot (obs:: Vector , sim:: Vector , climate:: Climate ; label:: String = " " , log:: Bool = false , burn_in= 1 , limit= nothing , metric= Streamfall. mKGE)
6465 date = timesteps (climate)
6566 last_e = ! isnothing (limit) ? limit : lastindex (obs)
6667 show_range = burn_in: last_e
67- return quickplot (obs[show_range], sim[show_range], date[show_range], label, log; metric = metric)
68+ return quickplot (obs[show_range], sim[show_range], date[show_range]; label, log, metric)
6869end
69- function Streamfall. Viz. quickplot (obs:: Vector , sim:: Vector , xticklabels:: Vector , label= " Modeled" , log= false ; metric= Streamfall. mKGE)
70+ function Streamfall. Viz. quickplot (obs:: Vector , sim:: Vector , xticklabels:: Vector ; label= " Modeled" , log= false , metric= Streamfall. mKGE)
7071 @assert length (xticklabels) == length (obs) || " x-axis tick label length and observed lengths do not match!"
7172 @assert length (xticklabels) == length (sim) || " x-axis tick label length and simulated lengths do not match!"
7273
@@ -167,7 +168,7 @@ function Streamfall.Viz.temporal_cross_section(
167168 logscale = [:log , :log10 ]
168169 tmp = nothing
169170
170- xsect_res = TemporalCrossSection (dates, obs, period)
171+ xsect_res = TemporalCrossSection (dates, obs; period)
171172
172173 if :yscale in arg_keys || :yaxis in arg_keys
173174 tmp = (:yscale in arg_keys) ? kwargs[:yscale ] : kwargs[:yaxis ]
@@ -178,7 +179,7 @@ function Streamfall.Viz.temporal_cross_section(
178179 # Format function for y-axis tick labels (e.g., 10^x)
179180 format_func = y -> (y != 0 ) ? L " %$(Int(round(sign(y)) * 10))^{%$(round(abs(y), digits=1))}" : L " 0"
180181
181- log_xsect_res = TemporalCrossSection (dates, log_obs, period)
182+ log_xsect_res = TemporalCrossSection (dates, log_obs; period)
182183 target = log_xsect_res. cross_section
183184 else
184185 target = xsect_res. cross_section
@@ -273,7 +274,7 @@ function Streamfall.Viz.temporal_cross_section(
273274 logscale = [:log , :log10 ]
274275 tmp = nothing
275276
276- xsect_res = TemporalCrossSection (dates, obs, sim, period)
277+ xsect_res = TemporalCrossSection (dates, obs, sim; period)
277278 target = xsect_res. cross_section
278279
279280 if :yscale in arg_keys || :yaxis in arg_keys
@@ -286,7 +287,7 @@ function Streamfall.Viz.temporal_cross_section(
286287 # Format function for y-axis tick labels (e.g., 10^x)
287288 format_func = y -> (y != 0 ) ? L " %$(Int(round(sign(y)) * 10))^{%$(round(abs(y), digits=1))}" : L " 0"
288289
289- log_xsect_res = TemporalCrossSection (dates, log_obs, log_sim, period)
290+ log_xsect_res = TemporalCrossSection (dates, log_obs, log_sim; period)
290291 target = log_xsect_res. cross_section
291292 end
292293 end
0 commit comments