Visualization
MultiscaleGraphSignalTransforms.gplot
— Functiongplot(A, xyz; plotp = true,
style = :auto, width = 2, color = :blue,
shape = :none, mwidth = 2, mcolor = color, malpha = 1.0,
mscolor = color, mswidth = 1, msalpha = 1.0,
grid::Bool = false, label = "", subplot = 1)
GPLOT Plot graph, as in graph theory. GPLOT(A,xyz,...) plots the graph specified by the adjacency matrix A and the node coordinates xyz. GPLOT!(A,xyz,...) adds a plot to current
one.
Input Arguments
A::SparseMatrixCSC{Float64,Int}
: the adjacency matrix of a graphG
xyz::Matrix{Float64}
: The coordinates array,xyz
, is an n-by-2 or n-by-3 matrix
with the position for node i in the i-th row, xyz[i,:] = [x[i] y[i]] or xyz[i,:] = [x[i] y[i] z[i]].
plotp::Bool
: if the plot is made (default) or return the X, Y, Z arraysstyle::Symbol
: of line; choose from Symbol[:auto,:solid,:dash,:dot,:dashdot] (default: :auto)width::Number
: of line in pixels (default: 2; fraction, e.g., 0.5 is allowed)color::Symbol
: of line; choose from Symbol[:white,:blue,:red,:green,...] (default: :blue)shape::Symbol
: choose from Symbol[:none,:auto,:circle,:rect,:star5,:diamond, :hexagon,:cross,:xcross,:utriangle, :dtriangle,:pentagon,:heptagon,:octagon, :star4,:star6,:star7,:star8,:vline,:hline] (default: :none)mwidth::Number
: marker size (or radius) in pixels (default: 2)mcolor::Symbol
: of marker (default: the same as line color)malpha::Float64
: opacity of marker interior; choose from [0,1] (default: 1.0)mswidth::Number
: marker stroke size (width) in pixels (default: 1)mscolor::Symbol
: of marker stroke (default: the same as line color)msalpha::Float64
: opacity of marker stroke; choose from [0,1] (default: 1.0)grid::Bool
: a flag to show grid lines (default: false)label::String
: a string for legend (default: "")subplot::Int
: subplot index (default: 1)
Output Arguments
X::Matrix{Float64}
: Nan-punctuated X coordinate vectorY::Matrix{Float64}
: Nan-punctuated Y coordinate vectorZ::Matrix{Float64}
: Nan-punctuated Z coordinate vector
(X,Y)= GPLOT(A,xyz,plotp=false,...) or (X,Y,Z) = GPLOT(A,xyz,plotp=false,...) return the NaN-punctuated vectors X and Y or X, Y and Z without actually generating a plot. These vectors can be used to generate the plot at a later time with PLOT or PLOT3D if desired.
A backward-compatible elaboration of Mathworks's gplot that uses 3D data (if available) when the plot is rotated. Robert Piche, Tampere Univ. of Tech., 2005
Translated into julia by Naoki Saito, Dec. 21, 2016. Note that we should still consider the keywords organized as function gplot(A,xyz,kw...)
Nicholas Hausch edits: Must install Plots package For 3D rotation, use plotlyjs()
backend
Revised by Naoki Saito, Feb. 17, 2017 Revised by Naoki Saito, Oct. 13, 2017 Revised by Haotian Li, Jul. 25, 2018 Revised by Haotian Li and Naoki Saito for Julia v0.7/1.0, Sep. 21, 2018 Instead of plot(...), we decided to use Plots.plot(...) in order to avoid the function name ambiguity; this is a safer approach. Revised by Naoki Saito, Oct. 22, 2018
MultiscaleGraphSignalTransforms.scatter_gplot
— Functionscatter_gplot(X; marker = nothing, ms = 4, plotOrder = :normal, c = :viridis, subplot = 1)
SCATTER_GPLOT generates a scatter plot figure, which is for quick viewing of a graph signal. SCATTER_GPLOT!(X; ...) adds a plot to current
one.
Input Arguments
X::Matrix{Float64}
: points locations, can be 2-dim or 3-dim.marker::Array{Float64}
: default isnothing
. Present different colors given different signal value at each node.ms::Array{Float64}
: default is4
. Present different node sizes given different signal value at each node.shape::Symbol
: default is:none
. Shape of the markers.mswidth::Number
: default is0
. Width of the marker stroke border.msalpha::Number
: default isnothing
. The opacity for the marker stroke.plotOrder::Symbol
: default is:normal
. Optional choices:s2l
or:l2s
, i.e., plots from the smallest value ofmarker
to the largest value or the other way around, or:propabs
, ms is automatically set to be proportional to the absolute value of the marker values.c::Symbol
: default is:viridis
. Colors of the markers.subgplot::Int
: default is1
. The subplot index.
MultiscaleGraphSignalTransforms.GraphSig_Plot
— FunctionGraphSig_Plot(G::GraphSig; symmetric::Bool = false,
markersize::Float64 = 2.,
markercolor::Symbol = :balance,
markershape::Symbol = :circle,
markerstrokewidth::Float64 = 1.0,
markerstrokealpha::Float64 = 1.0,
markervaluevaries::Bool = true,
linewidth::Float64 = 1.,
linecolor::Symbol = :blue,
linestyle::Symbol = :solid,
clim::Tuple{Float64,Float64} = (0., 0.),
notitle::Bool = false, nocolorbar::Bool = false, nolegend::Bool = true,
stemplot::Bool = false, sortnodes::Symbol = :normal)
Display a plot of the data in a GraphSig object
Input Argument
G::GraphSig
: an input GraphSig objectsymmetric
symmetrize the colorbarmarkersize
the size of the nodesmarkercolor
markercolor schememarkershape
shape of markermarkerstrokewidth
width of marker strokemarkerstrokealpha
capacity of marker strokemarkervaluevaries
if the marker color depends on the signal valuelinewidth
the width of the lines in gplotlinecolor
the color of the lines (1D) / graph edges (2D & 3D)linestyle
: the style of linenotitle
display a titlenocolorbar
display a colorbarnolegend
display a legendstemplot
use a stem plotclim
specify the dynamic display rangesortnodes
plot the signal values from smallest to largest in magnitude
Best Basis Related
MultiscaleGraphSignalTransforms.cost_functional
— Functioncostfun = cost_functional(cfspec::Any)
Determine the cost functional to be used by the best-basis algorithm.
Input Argument
cfspec::Any
: the specification for the cost functional
Output Argument
costfun::Function
: the cost functional (as a function_handle)
MultiscaleGraphSignalTransforms.dmatrix_flatten
— Functiondmatrix_flatten(dmatrix::Array{Float64,3}, flatten::Any)
Flatten dmatrix using the method specified by the string "flatten"
Input Arguments
dmatrix::Array{Float64,3}
: the matrix of expansion coefficients; after this function is called, it becomes the size of (~, ~, 1).flatten::Any
: the method for flattening dmatrix (see the code in details)
MultiscaleGraphSignalTransforms.dmatrix_ldb_flatten
— Functionfunction dmatrix_ldb_flatten(dmatrix::Array{Float64,3}...; dm::Symbol = :KLdivergence)
Flatten dmatrices using the LDB method; after this function is called, it returns a matrix of size (~, ~, 1).
Input Arguments
dmatrix::Array{Float64,3}
: the matrix of LDB expansion coefficients in one class.dm::Symbol
: discriminant measure. Options::KLdivergence
(default),:Jdivergence
,:l1
,:l2
, and:Hellinger
.
Example Usage:
dmatrix_ldb_flatten(dmatrix1, dmatrix2, dmatrix3)
, each argument is the expansion coefficient matrix of a class of signals. It uses the default discriminant measure KL divergence to flatten these matrices. In other words, it flattens these expansion coefficent matrices by computing and summing "statistical distances" among them.