File Exchange

## wgPlot - Weighted Graph Plot (a better version of gplot)

version 1.7.0.0 (185 KB) by
Plot graphs with weighted vertices and weighted edges from a weighted adjacency matrix.

Updated 23 Jun 2009

Plot graphs just like gplot. But allow user to input an adjacency matrix with weighted edges and/or weighted vertices. The Edge weights are mapped to a colormap. The vertex weights are proportional to the vertex size. Using parameter-value pairs, user can even specify the vertex scaling factor, edge width, and the colormap used to show other meta data associated with the vertices. (Couple of the graph included as example were from David Gleich's matlabBGL package.)

### Cite As

Mike Wu (2021). wgPlot - Weighted Graph Plot (a better version of gplot) (https://www.mathworks.com/matlabcentral/fileexchange/24035-wgplot-weighted-graph-plot-a-better-version-of-gplot), MATLAB Central File Exchange. Retrieved .

hi sir
I cannot run the simple example, I get the following error:

Error using scatter (line 70)
S must be a scalar or a vector of the same length as X.

Error in wgPlot (line 153)
hV=scatter(coord(qq,1),coord(qq,2),vWt,'filled','MarkerFaceColor',[1,0.5,0.2]);

Error in wgPlotDemo (line 17)
[he,hv]=wgPlot(A,xy,'vertexWeight',rand(length(A),1));

what should I do?

zhicheng liu

Nice and handy extension of gplot !

samaneh jolany

Hi
I have plotted a graph by wgplot. The color of the vortices must correspond the colorbar but it does not
What to do now?
thanks

Thales

Xinwei Shen

mahyar

Thanks for this very useful tool.

I have two question to modify this program:

1- What should I do see the results of edges normalized between 0 and 1? As in the fig shown in this page it is between 0.24 to 9.97.

2- What should I do map edge weights to edge width (thickness)rather than edge colormap?

Smita

Even after I fixed all the other bugs in wgPlotDemo, the last of the demos uses fruchterman_reingold_force_directed_layout, which was not included in wgPlotDemo. I downloaded that off of the mathBgl package, but that function refers to another function called fruchterman_reingold_mex which was not in that package! So now I'm not sure what to do. Any hints on where to find that function?

Kishan

I cannot run the simple example, I get the following error:

figure;
tic;
[he,hv]=wgPlot(A,xy,'vertexWeight',rand(length(A),1));
toc
Error using scatter (line 68)
S must be a scalar or a vector the same length as X.

Error in wgPlot (line 153)
hV=scatter(coord(qq,1),coord(qq,2),vWt,'filled','MarkerFaceColor',[1,0.5,0.2]);

Charles Nelatury

Thanks!

AlexV Mantzaris

I commented out axesArea to get the network plot into a figure with other subplots and it works exactly as I need it. Work well and fast even for a large number of edges.

Anthony Saccullo

Great program. Contains exactly what I'm looking for. I'm just having issues with the vertices having color. I'd like to have them all be a uniform size, but have the color change with weight. Or have both the color and size change would work too. The issue I'm having is that when the weight values are inputted some of the nodes do not show a weight. Any suggestions?

Maxime

Very useful, nice display, computationally fast. Good job, thank you!

1. file: wgPlotDemo.m, line: 2, load('cores_example.mat')
2. file: wgPlotDemo.m, line: 46, load('cs-stanford.mat')
3. file: axesArea.m, line: 25, if ishghandle(varargin{1})
4. file: wgPlot.m, line: 150, hV=scatter(coord(qq,1),coord(qq,2),vWt(qq),vrtxCol(qq),'filled');
5. file: wgPlot.m, line: 153, hV=scatter(coord(qq,1),coord(qq,2),vWt(qq),'filled','MarkerFaceColor',[1,0.5,0.2]);

Jeroen

Even for a very simple example, i get an error:

>> wgplot(sprand(10,10,0.2), rand(10,2));

> In wgPlot at 36
In corrcoeff at 44
??? Error using ==> ishghandle
Too many input arguments.

Error in ==> axesArea at 25
if ishghandle(varargin{1},'axes')

Error in ==> wgPlot at 36
axesArea(h,[6 7 5 5]);

What's wrong?

##### MATLAB Release Compatibility
Created with R2009a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux