Skip to content

Commit 550165d

Browse files
authored
Update plotting docstrings (#247)
* Update plotting docstrings * Format * Fix typo * Update signatures and (kw)arg partitioning in docstrings
1 parent 4d975c0 commit 550165d

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

src/utility/plotting.jl

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
11
"""
22
entanglementplot(state; site=0[, kwargs...])
33
4-
Plot the entanglement spectrum of a given InfiniteMPS.
4+
Plot the [entanglement spectrum](@ref entanglement_spectrum) of a given MPS `state`.
55
66
# Arguments
7-
- `site::Int=0`: mps index for multisite unit cells. Spectrum is computed for the bond between `site` and `site + 1`.
7+
- `state`: the MPS for which to compute the entanglement spectrum.
8+
9+
# Keyword Arguments
10+
- `site::Int=0`: MPS index for multisite unit cells. The spectrum is computed for the bond
11+
between `site` and `site + 1`.
812
- `expand_symmetry::Logical=false`: add quantum dimension degeneracies.
913
- `sortby=maximum`: the method of sorting the sectors.
1014
- `sector_margin=1//10`: the amount of whitespace between sectors.
1115
- `sector_formatter=string`: how to convert sectors to strings.
1216
- `kwargs...`: other kwargs are passed on to the plotting backend.
17+
18+
!!! note
19+
You will need to manually import [Plots.jl](https://github.com/JuliaPlots/Plots.jl) to
20+
be able to use this function. MPSKit.jl defines its plots based on
21+
[RecipesBase.jl](https://github.com/JuliaPlots/Plots.jl/tree/v2/RecipesBase), but the
22+
user still has to add `using Plots` to be able to actually produce the plots.
23+
1324
"""
1425
function entanglementplot end
1526
@userplot EntanglementPlot
1627

1728
@recipe function f(h::EntanglementPlot; site=0, expand_symmetry=false, sortby=maximum,
1829
sector_margin=1 // 10, sector_formatter=string)
1930
mps = h.args[1]
20-
site <= length(mps) || throw(ArgumentError("Not a valid site for the given mps."))
31+
(site <= length(mps) && !(isa(mps, FiniteMPS) && site == 0)) ||
32+
throw(ArgumentError("Invalid site $site for the given mps."))
2133

2234
spectra = entanglement_spectrum(mps, site)
2335
sectors = []
@@ -75,21 +87,31 @@ function entanglementplot end
7587
end
7688

7789
"""
78-
transferplot(above, below[, sectors[, transferkwargs[, kwargs]]])
90+
transferplot(above, below=above; sectors=[], transferkwargs=(;)[, kwargs...])
7991
8092
Plot the partial transfer matrix spectrum of two InfiniteMPS's.
8193
8294
# Arguments
8395
- `above::InfiniteMPS`: above mps for [`transfer_spectrum`](@ref).
84-
- `below::InfiniteMPS`: below mps for [`transfer_spectrum`](@ref).
96+
- `below::InfiniteMPS=above`: below mps for [`transfer_spectrum`](@ref).
97+
98+
# Keyword Arguments
8599
- `sectors=[]`: vector of sectors for which to compute the spectrum.
86100
- `transferkwargs`: kwargs for call to [`transfer_spectrum`](@ref).
87101
- `kwargs`: other kwargs are passed on to the plotting backend.
88102
- `thetaorigin=0`: origin of the angle range.
89103
- `sector_formatter=string`: how to convert sectors to strings.
104+
105+
!!! note
106+
You will need to manually import [Plots.jl](https://github.com/JuliaPlots/Plots.jl) to
107+
be able to use this function. MPSKit.jl defines its plots based on
108+
[RecipesBase.jl](https://github.com/JuliaPlots/Plots.jl/tree/v2/RecipesBase), but the
109+
user still has to add `using Plots` to be able to actually produce the plots.
110+
90111
"""
91112
function transferplot end
92113
@userplot TransferPlot
114+
93115
@recipe function f(h::TransferPlot; sectors=nothing, transferkwargs=(;), thetaorigin=0,
94116
sector_formatter=string)
95117
if sectors === nothing

0 commit comments

Comments
 (0)