Visualization

MultiscaleGraphSignalTransforms.gplotFunction
gplot(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 graph G
  • 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 arrays
  • style::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 vector
  • Y::Matrix{Float64}: Nan-punctuated Y coordinate vector
  • Z::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

source
MultiscaleGraphSignalTransforms.scatter_gplotFunction
scatter_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 is nothing. Present different colors given different signal value at each node.
  • ms::Array{Float64}: default is 4. Present different node sizes given different signal value at each node.
  • shape::Symbol: default is :none. Shape of the markers.
  • mswidth::Number: default is 0. Width of the marker stroke border.
  • msalpha::Number: default is nothing. The opacity for the marker stroke.
  • plotOrder::Symbol: default is :normal. Optional choices :s2l or :l2s, i.e., plots from the smallest value of marker 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 is 1. The subplot index.
source
MultiscaleGraphSignalTransforms.GraphSig_PlotFunction
GraphSig_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 object
  • symmetric symmetrize the colorbar
  • markersize the size of the nodes
  • markercolor markercolor scheme
  • markershape shape of marker
  • markerstrokewidth width of marker stroke
  • markerstrokealpha capacity of marker stroke
  • markervaluevaries if the marker color depends on the signal value
  • linewidth the width of the lines in gplot
  • linecolor the color of the lines (1D) / graph edges (2D & 3D)
  • linestyle: the style of line
  • notitle display a title
  • nocolorbar display a colorbar
  • nolegend display a legend
  • stemplot use a stem plot
  • clim specify the dynamic display range
  • sortnodes plot the signal values from smallest to largest in magnitude
source
MultiscaleGraphSignalTransforms.cost_functionalFunction
costfun = 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)
source
MultiscaleGraphSignalTransforms.dmatrix_flattenFunction
dmatrix_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)
source
MultiscaleGraphSignalTransforms.dmatrix_ldb_flattenFunction
function 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.

source