Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: Sorting object properties; change marker color for single plot point
Replies: 1   Last Post: Dec 7, 2013 4:28 PM

 Messages: [ Previous | Next ]
 Paul Posts: 517 Registered: 2/23/10
Sorting object properties; change marker color for single plot point
Posted: Dec 6, 2013 9:23 PM

I used MatlabBGL to visualize a social network graph by plotting a "scatter graph" of the graph nodes. Just to be clear, it's not really for social network analysis, but it is a bunch of nodes with distance relationships between them all.

Since I'm new to the actual practice of graph visualization (as opposed to having a nodding acquaintance with the general ideas) both in Matlab in in general, I'll supply some details which I suspect are not directly relevant, but I don't know for certain. First, I'm laying out a weighted, undirected graph using the MatlabBGL download, http://www.mathworks.com/matlabcentral/fileexchange/10922-matlabbgl. It encapsulates a C++ graph manipulation library in a Matlab interface. The specific function I'm using is kamada_kawai_spring_layout, which is documented at the site for the library: http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/table_of_contents.html (search for the function name). I found an example Matlab invocation at http://www.mathworks.com/matlabcentral/fileexchange/10922-matlabbgl/content/matlab_bgl/kamada_kawai_spring_layout.m. If edgeDist(i,j) is a symmetric matrix of distances between nodes i and j, then the following gives me a graph:

edgeDistSp=sparse(edgeDist);
gplot(edgeDistSp,edgeDistSpLay)

It's way too dense, so I just want to see how the pattern of cloud of points:

set(get(gca,'Children'),'Marker','o');
set(get(gca,'Children'),'MarkerFaceColor','b');
set(get(gca,'Children'),'LineStyle','none');

I finangled myself into the above code by noting that get(gca) showed only one "children" in the Children property, and get(get(gca,'Children')) showed a Type property of 'line'.

There are a few key nodes that I want to highlight e.g. maybe by coloring the faces red and making them bigger. I was hoping that I could find myway down the object hierarchy to the exact data point and change its properties (which wouldn't work if the parameters are for the whole series of data). Unfortunately, all the plot symbol properties like MarkerEdgeColor, MarkerSize, and MarkerFaceColor seem to belong to the 'line' object, which itself has a 0x1 double show for Children (a zero dimension array, meaning it has no children). This despite the fact that it has the series data -- I'm *assuming* this because it has XData and YData properties, each being a 1x33708 double (even though there are only 106 nodes). Most of that data is NaNs.

It looks pretty bleak. I will likely have to find the coordinates of the special points from edgeDistSpLay and plot them as separate plots on the same axis. At this point, I'm just guessing at how it all works, and I'll be exploring that in the next little while. Any comments from the greybeards are welcome.

On a related note, is there any way to force the properties of an object of an object to be shown in sorted order? It's really difficult to find something specific from a barrage of properties. Thanks.

Date Subject Author
12/6/13 Paul
12/7/13 Paul