MasterScan  Lab_Matlab_control Master Branch
List of all members | Properties and Events | Methods | Static Methods
DataGrapher Class Reference

Overview

A Matlab interface for the GraphViz graphing tool.

DataGrapher uses the GraphViz graphing tool to generate nice-looking graphs of arbitrary data. The input data are a Matlab struct array, each element of which defines a node to be plotted. User-supplied functions generate a name for each node as well as "edges" that connect nodes. Properties of DataGrapher control the general behavior of GraphViz.

Inheritance diagram for DataGrapher:
Inheritance graph
[legend]

Properties and Events

Property graphVizPath = '/usr/local/bin'
 file path to the GraphViz executables, like "dot" and "neato"
 
Property graphVisAlgorithm = 'dot'
 GraphViz algorithm name, "dot", "neato", "twopi", "circo", or "fdp".
 
Property workingPath = '~/Desktop/datagraph'
 file path to put GraphViz data and image files
 
Property workingFileName = 'dataGraph'
 file name base for GraphViz output files
 
Property imageType = 'png'
 file extension for GraphViz output image files
 
Property inputData
 struct array containing node data The graph will contain one node per element of inputData. More...
 
Property graphName = 'dataGraph'
 string name for the graph
 
Property nodeNameFunction = @DataGrapher.nodeNameFromField
 function to generate graph node names Should take inputData and an index into inputData and return a string name for the indexth node. More...
 
Property nodeDescriptionFunction
 function to generate graph node descriptions (optional) Should take inputData and an index into inputData and return a cell array of strings describing the indexth node. More...
 
Property edgeFunction = @DataGrapher.edgeFromField
 function to generate graph edges Should take inputData and an index into inputData and return an array of other indexes. More...
 
Property colors = spacedColors(10)
 Matlab colormap for coloring in each node its edges.
 
Property graphIsDirected = true
 true or false, whether the graph should be a directed "digraph" or an undirected "graph"
 
Property floatingEdgeNames = true
 true or false whether to write edge names on the edges themselves. More...
 
Property listedEdgeNames = true
 true or false whether to list edge names inside their originating nodes. More...
 
Property graphProperties
 arbitrary struct of GraphViz properties to apply to the graph itself
 
Property nodeProperties
 arbitrary struct of GraphViz properties to apply to all nodes
 
Property edgeProperties
 arbitrary struct of GraphViz properties to apply to all edges
 
Property nodeAlpha = 1
 0-255 opacity for nodes
 
Property edgeAlpha = .5
 0-255 opacity for edges
 
Property nodes
 internal accounting of node and edge data
 

Methods

self DataGrapher ()
 Constructor takes no arguments.
 
nodes parseNodes (self)
 Apply nodeNameFunction and edgeFunction to the inputData.
 
string composeGraph (self)
 Write a string that contains a whole GraphVis specification.
 
string composeGraphHeader (self)
 Write a string that contains graph properties.
 
string composeNodeHeader (self)
 Write a string that contains default node properties.
 
string composeEdgeHeader (self)
 Write a string that contains default edge properties.
 
string composeNodes (self)
 Write a string that specifies nodes.
 
string composeEdges (self)
 Write a string that specifies edges.
 
 writeDotFile (self)
 Write a GraphViz specification to file.
 
 generateGraph (self)
 Feed the GraphViz specification to GraphViz and get a graph.
 
string composeProperties (self, propStruct, delimiter)
 Write out property-value pairs from a struct.
 
string composeRGB (self, rgb, a)
 Write out a hex string for an RGB[A] color.
 

Static Methods

static nodeName nodeNameFromField (inputData, index)
 Default node names from the "name" field.
 
static edgeIndexes edgeNames edgeFromField (inputData, index)
 Default edges from "edge" field, and trivial edge names.
 

Properties and Events

◆ inputData

Property inputData

struct array containing node data The graph will contain one node per element of inputData.

◆ nodeNameFunction

Property nodeNameFunction = @DataGrapher.nodeNameFromField

function to generate graph node names Should take inputData and an index into inputData and return a string name for the indexth node.

◆ nodeDescriptionFunction

Property nodeDescriptionFunction

function to generate graph node descriptions (optional) Should take inputData and an index into inputData and return a cell array of strings describing the indexth node.

◆ edgeFunction

Property edgeFunction = @DataGrapher.edgeFromField

function to generate graph edges Should take inputData and an index into inputData and return an array of other indexes.

These specify edges from the given indexth node to the returned indexth nodes. Should also return as a second output a cell array with a string name for each edge.

◆ floatingEdgeNames

Property floatingEdgeNames = true

true or false whether to write edge names on the edges themselves.

◆ listedEdgeNames

Property listedEdgeNames = true

true or false whether to list edge names inside their originating nodes.


The documentation for this class was generated from the following file: