12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

lineline('XData',x,'YData',y,'ZData',z,'PropertyName',PropertyValue,...) creates a line in the current axes using the property values defined asarguments. This is the low-level form of the line function, which does notaccept matrix coordinate data as the other informal forms described above.h = line(...) returns a column vector of handles corresponding to each lineobject the function creates.RemarksIn its informal form, the line function interprets the first three arguments(two for 2-D) as the X, Y, and Z coordinate data, allowing you to omit theproperty names. You must specify all other properties as name/value pairs. Forexample,line(X,Y,Z,'Color','r','LineWidth',4)The low-level form of the line function can have arguments that are onlyproperty name/property value paris. For example,line('XData',x,'YData',y,'ZData',z,'Color','r','LineWidth',4)Line properties control various aspects of the line object and are described inthe “Line Properties” section. You can also set and query property values aftercreating the line using set and get.You can specify properties as property name/property value pairs, structurearrays, and cell arrays (see the set and get reference pages for examples of howto specify these data types).Unlike high-level functions such as plot, line does not respect the setting ofthe figure and axes NextPlot properties. It simply adds line objects to thecurrent axes. However, axes properties that are under automatic control suchas the axis limits can change to accommodate the line within the current axes.ExamplesThis example uses the line function to add a shadow to plotted data. First, plotsome data and save the line’s handle:t = 0:pi/20:2*pi;hline1 = plot(t,sin(t),’k’);Next, add a shadow by offsetting the x coordinates. Make the shadow line lightgray and wider than the default LineWidth:hline2 = line(t+.06,sin(t),'LineWidth',4,'Color',[.8 .8 .8]);2-272

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!