Skip to content

Commit

Permalink
Clean up docs
Browse files Browse the repository at this point in the history
  • Loading branch information
henry2004y committed Jul 8, 2024
1 parent e239440 commit 1e04fe0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/plot/pyplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@ end


"""
plotdata(data, func, args, kwargs...)
plotdata(bd, func, args, kwargs...)
Plot the variable from SWMF output.
`plotdata(data, "p", plotmode="contbar")`
# Examples
`plotdata(bd, "p", plotmode="contbar")`
`plotdata(data, "p", plotmode="grid")`
`plotdata(bd, "p", plotmode="grid")`
`plotdata(data, func, plotmode="trimesh", plotrange=[-1.0, 1.0, -1.0, 1.0], plotinterval=0.2)`
`plotdata(bd, func, plotmode="trimesh", plotrange=[-1.0, 1.0, -1.0, 1.0], plotinterval=0.2)`
# Arguments
- `bd::BATLData`: BATSRUS data.
Expand Down Expand Up @@ -317,13 +318,12 @@ end


"""
cutplot(data, var, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf], dir="x", sequence=1,
levels=20)
cutplot(data, var, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf], dir="x", sequence=1)
2D plane cut contourf of 3D box data.
2D plane cut pcolormesh of 3D box data. `sequence` is the index along `dir`.
"""
function cutplot(bd::BATLData, var::AbstractString, ax=nothing;
plotrange=[-Inf,Inf,-Inf,Inf], dir="x", sequence=1, levels::Int=20)
plotrange=[-Inf,Inf,-Inf,Inf], dir="x", sequence=1)
x, w = bd.x, bd.w
varIndex_ = findindex(bd, var)

Expand All @@ -349,7 +349,7 @@ function cutplot(bd::BATLData, var::AbstractString, ax=nothing;
cut1, cut2, W = subsurface(cut1, cut2, W, plotrange)
end
if isnothing(ax) ax = plt.gca() end
c = ax.contourf(cut1, cut2, W, levels)
c = ax.pcolormesh(cut1, cut2, W)

title(bd.head.wnames[varIndex_])

Expand Down Expand Up @@ -473,7 +473,7 @@ end
contourf(data, var, ax=nothing; levels=0, plotrange=[-Inf,Inf,-Inf,Inf],
plotinterval=0.1, innermask=false, kwargs...)
Wrapper over `contourf` in matplotlib.
Wrapper over `contourf` in matplotlib. See [`getdata2d`](@ref) for some related keywords.
"""
function PyPlot.contourf(bd::BATLData, var::AbstractString, ax=nothing; levels::Int=0,
plotrange=[-Inf,Inf,-Inf,Inf], plotinterval=0.1, innermask=false, kwargs...)
Expand Down
12 changes: 7 additions & 5 deletions src/plot/utility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

"""
getdata2d(bd::BATLData, var::AbstractString, plotrange=[-Inf, Inf, -Inf, Inf],
plotinterval=Inf; innermask=false, rbody=1.0)
plotinterval=Inf; kwargs...)
Return 2D slices of data `var` from `bd`. If `plotrange` is not set, output data resolution
is the same as the original. If `innermask==true`, then the inner boundary cells are set to
NaN. If `innermask == true` but the rbody parameter is not found in the header, we use the
keyword `rbody` as the inner radius. If `useMatplotlib==false`, a native Julia scattered
interpolation is used (but is somehow slower than Matplotlib).
is the same as the original.
# Keyword Arguments
- `innermask=false`: Whether to mask the inner boundary with NaN.
- `rbody=1.0`: Radius of the inner mask. Used when the rbody parameter is not found in the header.
- `useMatplotlib=true`: Whether to Matplotlib (somehow faster) or NaturalNeighbours for scattered interpolation.
"""
function getdata2d(bd::BATLData, var::AbstractString,
plotrange::Vector=[-Inf, Inf, -Inf, Inf], plotinterval::Real=Inf;
Expand Down

0 comments on commit 1e04fe0

Please sign in to comment.