diff --git a/Project.toml b/Project.toml index 65f5586..1decdfe 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MetidaNCA" uuid = "097c2839-c7bc-4c4b-a5f2-b4167c1b4e7c" authors = ["PharmCat "] -version = "0.5.7" +version = "0.5.8" [deps] diff --git a/change.log b/change.log index 313adf4..3e8ff28 100644 --- a/change.log +++ b/change.log @@ -1,3 +1,9 @@ +0.5.8 +- plots minor changing + +0.5.7 +- fix partials + 0.5.6 - extend partials diff --git a/src/nca.jl b/src/nca.jl index 39b0d0b..6d2695c 100644 --- a/src/nca.jl +++ b/src/nca.jl @@ -833,8 +833,12 @@ end function maxconc(subj::T) where T <: PKSubject maximum(subj.obs) end -function minconc(subj::T) where T <: PKSubject - minimum(subj.obs) +function minconc(subj::T, pos = false) where T <: PKSubject + if pos + return minimum(Iterators.filter(x-> x > zero(x), subj.obs)) + else + return minimum(subj.obs) + end end function exrate(time::AbstractVector{Tuple{S, E}}, conc::AbstractVector{C}, vol::AbstractVector{V}) where S where E where C where V diff --git a/src/plots.jl b/src/plots.jl index 796ee3e..67d2f0f 100644 --- a/src/plots.jl +++ b/src/plots.jl @@ -192,13 +192,14 @@ function pkplot(subj::AbstractSubject; ls = false, elim = false, xticksn = :auto elseif kwargs[:yscale] == :ln || kwargs[:yscale] == :log b = ℯ end + t = collect(floor(log(b, minimum(obs))):ceil(log(b, maximum(obs)))) pushfirst!(t, first(t) - 1) kwargs[:yticks] = b .^ t - + end if !(:ylims in k) - kwargs[:ylims] = (b ^ floor(log(b, minimum(obs)*0.8)), maximum(obs)*1.3) + kwargs[:ylims] = (minimum(obs)*0.5, maximum(obs)*2.) end end else @@ -280,10 +281,9 @@ function pkplot!(subj; ls = false, elim = false, xticksn = :auto, yticksn = :aut t = collect(floor(log(b, minimum(obs))):ceil(log(b, maximum(obs)))) pushfirst!(t, first(t) - 1) kwargs[:yticks] = b .^ t - end if !(:ylims in k) - kwargs[:ylims] = (b ^ floor(log(b, minimum(obs)*0.8)), maximum(obs)*1.3) + kwargs[:ylims] = (minimum(obs)*0.5, maximum(obs)*2.) end end else @@ -320,7 +320,13 @@ function pageplot(data, id, ulist; kwargs...) # Y lims if !(:ylims in k) && length(subdata) > 1 - kwargs[:ylims] = (findmin(x->minconc(x), getdata(subdata))[1], findmax(x->maxconc(x), getdata(subdata))[1]*1.15) + ysc = :yscale in k + ylmin = findmin(x->minconc(x, ysc), getdata(subdata))[1] + ylmax = findmax(x->maxconc(x), getdata(subdata))[1]*1.15 + if ysc + ylmax *= 5 + end + kwargs[:ylims] = (ylmin, ylmax) end # Plotting subdata if length(subdata) > 1 kwargs[:elim] = false end