www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/AdjustPropertiesOfGraphPlotObjectExample.m

    %% Adjust Properties of GraphPlot Object
% Create a |GraphPlot| object, and then show how to adjust the properties
% of the object to affect the output display.
%
% Create and plot a graph.

% Copyright 2015 The MathWorks, Inc.

s = [1 1 1 1 1 1 1 9 9 9 9 9 9 9];
t = [2 3 4 5 6 7 8 2 3 4 5 6 7 8];
G = graph(s,t);
h = plot(G)

%%
% Use custom node coordinates for the graph nodes.
h.XData = [0 -3 -2 -1 0 1 2 3 0];
h.YData = [2 0 0 0 0 0 0 0 -2];

%%
% Make the graph nodes red.
h.NodeColor = 'r';

%%
% Use dashed lines for the graph edges.
h.LineStyle = '--';

%%
% Increase the size of the nodes.
h.MarkerSize = 8;