Skip to content

Commit

Permalink
fix plots
Browse files Browse the repository at this point in the history
  • Loading branch information
PharmCat committed Jul 31, 2024
1 parent c5951ad commit 47a06b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/src/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ png(p, "plot2.png")
p = pkplot(ds; elim = true, ls = true)
png(p[1][2], "plot3.png")
png(p[1], "plot3.png")
# If pagesort used - return pairs with `Page ID` => `Plot`
p = pkplot(ds; typesort = :Subject, pagesort = :Formulation)
Expand Down
8 changes: 7 additions & 1 deletion src/plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ PK plot for subject set.
* `namepref` - name prefix for saving files.
Use `pagesort = MetidaNCA.NoPageSort()` to prevent page plotting.
If pagesort used - return vector of pairs: `Page ID` => `Plot`
"""
function pkplot(data::DataSet{T};
typesort::Union{Nothing, Symbol, AbstractVector{Symbol}} = nothing,
Expand Down Expand Up @@ -468,7 +470,11 @@ function pkplot(data::DataSet{T};
end
if isnothing(namepref) namepref = "plot" end
for i = 1:length(p)
savefig(p[i][2], joinpath(savepath, namepref*"_$(i).png"))
if isa(p[i], Pair)
savefig(p[i][2], joinpath(savepath, namepref*"_$(i).png"))

Check warning on line 474 in src/plots.jl

View check run for this annotation

Codecov / codecov/patch

src/plots.jl#L472-L474

Added lines #L472 - L474 were not covered by tests
else
savefig(p[i], joinpath(savepath, namepref*"_$(i).png"))

Check warning on line 476 in src/plots.jl

View check run for this annotation

Codecov / codecov/patch

src/plots.jl#L476

Added line #L476 was not covered by tests
end
end
else
@warn "savefig not defined, install Plots.jl for plot writing... plots NOT saved..."
Expand Down

0 comments on commit 47a06b1

Please sign in to comment.