Plotting functions¶
Plot¶
-
pygsp.plotting.
plot
(O, default_qtg=True, **kwargs)[source]¶ Main plotting function.
This function should be able to determine the appropriate plot for the object. Additionnal kwargs may be given in case of filter plotting.
Parameters: O : object
Should be either a Graph, Filter or PointCloud
default_qtg: boolean
Define the library to use if both are installed. Default is pyqtgraph (field=True).
Examples
>>> from pygsp import graphs, plotting >>> G = graphs.Logo() >>> try: ... plotting.plot(G, default_qtg=False) ... except Exception as e: ... print(e)
Plot Graph¶
-
pygsp.plotting.
plot_graph
(G, default_qtg=True, **kwargs)[source]¶ Plot a graph or an array of graphs with installed libraries.
This function should be able to determine the appropriate plot for the graph. Additionnal kwargs may be given in case of filter plotting.
Parameters: G : Graph
Graph object to plot
show_edges : boolean
Set to False to only draw the vertices (default G.Ne < 10000).
default_qtg: boolean
Define the library to use if both are installed. Default is pyqtgraph (field=True).
Examples
>>> from pygsp import graphs, plotting >>> G = graphs.Logo() >>> try: ... plotting.plot_graph(G, default_qtg=False) ... except Exception as e: ... print(e)
Plot Pointcloud¶
Plot Filter¶
-
pygsp.plotting.
plot_filter
(filters, npoints=1000, line_width=4, x_width=3, x_size=10, plot_eigenvalues=None, show_sum=None, savefig=False, plot_name=None)[source]¶ Plot a system of graph spectral filters.
Parameters: filters : filter object
npoints : int
Number of point where the filters are evaluated.
line_width : int
Width of the filters plots.
x_width : int
Width of the X marks representing the eigenvalues.
x_size : int
Size of the X marks representing the eigenvalues.
plot_eigenvalues : boolean
To plot black X marks at all eigenvalues of the graph (You need to compute the Fourier basis to use this option). By default the eigenvalues are plot if they are contained in the Graph.
show_sum : boolean
To plot an extra line showing the sum of the squared magnitudesof the filters (default True if there is multiple filters).
savefig : boolean
Determine wether the plot is saved as a PNG file in yourcurrent directory (True) or shown in a window (False) (default False).
plot_name : str
To give custom names to plots
Examples
>>> from pygsp import filters, plotting, graphs >>> G = graphs.Logo() >>> mh = filters.MexicanHat(G) >>> try: ... plotting.plot_filter(mh) ... except: ... pass
Plot Signal¶
-
pygsp.plotting.
plot_signal
(G, signal, default_qtg=True, **kwargs)[source]¶ Plot a graph signal in 2D or 3D with installed libraries.
Parameters: G : Graph object
If not specified it will take the one used to create the filter.
signal : array of int
Signal applied to the graph.
show_edges : boolean
Set to False to only draw the vertices (default G.Ne < 10000).
cp : List of int
Camera position for a 3D graph.
vertex_size : int
Size of circle representing each signal component.
vertex_highlight : boolean
Vector of indices of vertices to be highlighted.
climits : array of int
Limits of the colorbar.
colorbar : boolean
To plot an extra line showing the sum of the squared magnitudes of the filters (default True if there is multiple filters).
bar : boolean
NOT IMPLEMENTED: False display color, True display bar for the graph (default False).
bar_width : int
Width of the bar (default 1).
default_qtg: boolean
Define the library to use if both are installed. Default is pyqtgraph (field=True).
Examples
>>> import numpy as np >>> from pygsp import graphs, filters, plotting >>> G = graphs.Ring(15) >>> signal = np.sin((np.arange(1, 16)*2*np.pi/15)) >>> try: ... plotting.plot_signal(G, signal, default_qtg=False) ... except: ... pass