Skip to content
Snippets Groups Projects
Commit d7421794 authored by Julian Stürmer's avatar Julian Stürmer
Browse files

Minor changes in plotting functions

parent 9ed616a0
No related branches found
No related tags found
No related merge requests found
......@@ -6,8 +6,8 @@ Plots histograms of the number of line failures for given values of γ
=#
function plothist_tl_failures(
γ_values::Array{Float64,1},
N_runs::Int64,
rstep = 20; # number of realizations that were saved together
N_runs::Int64;
rstep = 20, # number of realizations that were saved together
datapath = "", # path to folder containing different γ scans
plotpath = "" # where to save the plot
)
......@@ -35,15 +35,17 @@ function plothist_tl_failures(
γ::Float64,
N_runs::Int64,
rstep = 20; # number of realizations that were saved together
datapath::String, # path to folder containing data files
plotpath::String # where to save the plot
datapath = "", # path to folder containing data files
plotpath = "", # where to save the plot
)
Nf = zeros(Int64, N_runs) # array for number of failures
### Read data and save the number of failures that occured in each run
for i in rstep:rstep:N_runs
res = load(datapath * "gamma$γ/" * "results_$γ" * "_$i.jld2", "result")
res = load(datapath * "Ike_impact_gamma$γ/scan_data/" *
"tl_failures_gamma$γ" * "_n$(i-rstep+1)_to_n$i.jld2", "result"
)
for j in 1:rstep
Nf[i-rstep+j] = length(res[j])
end
......@@ -64,7 +66,7 @@ function plothist_tl_failures(
[no_marker for i in 1:4],
[L"γ = " * "$γ",
L"N_r = " * "$N_runs",
L"\bar{N}_\mathrm{f} \approx" * "$mean_Nf",
L"\widebar{N}_\mathrm{f} \approx" * "$mean_Nf",
L"\sigma_\mathrm{f} \approx" * "$σ"],
handletextpad = 0, handlelength = 0
)
......@@ -74,8 +76,10 @@ function plothist_tl_failures(
plt.ylabel("Frequency")
### Save and close figure
figpath = plotpath * "Texas_hist_tl_failures_gamma$γ.png"
plt.savefig(figpath, bbox_inches="tight")
if isempty(plotpath) == false
figpath = plotpath * "gamma$γ.png"
plt.savefig(figpath, bbox_inches="tight")
end
plt.clf()
return mean_Nf, σ
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment