You are on page 1of 15

Information and

Communication
Technology
ICT01 – Course Outcome 2
shs.mapua.edu.ph
Plotting
Table of Plot Colors, Marker Style and Line Style

shs.mapua.edu.
Values of pos in the legend Command

shs.mapua.edu.
Possible location for a Plot Legend

shs.mapua.edu.
Additional properties associated with each line:

• LineWidth – specifies the width of each line in points

• MarkerEdgeColor – specifies the color of the marker or the edge color filled markers

• MarkerFaceColor – specifies the color of the face of filled markers

• MarkerSize – specifies the size of the marker in points

These properties are specified in the plot command after the data to be plotted in the following
fashion:
plot( x, y, ’PropertyName’, value,…)

shs.mapua.edu.
For example:

The following command plots a 3-point-wide solid black line with 6-point-wide
circular markers at the data points. Each marker has a red edge and a green center.

x = 0 : pi/15 : 4*pi ;
y = exp(2*sin(x));

shs.mapua.edu.
Enhanced Control of Text Strings
It is also possible to enhance plotted text strings (titles, axis, labels and so forth) with formatting
such as bold face, italics, and so forth, and with special characters such as Greek and
mathematical symbols.

The font used to display the text can be modified by stream modifiers. A stream modifier is a
special sequence of characters that tells the MATLAB interpreter to change its behavior. The most
common stream modifiers are:

• \bf – bold face


• \it – Italics
• \rm – Removes stream modifiers, restoring normal font
• \fontname{fontname} – specify the font name to use
• \fontsize{fontsize} – specify font size
• _{xxx} – the characters inside the braces are the subscript
• ^{xxx} – the characters inside the braces are the superscript

shs.mapua.edu.
Selected Greek and Mathematical Symbols

shs.mapua.edu.
Enhanced Control of Text Strings
Once a stream modifier has been inserted into a string, it will remain in effect until the end of the
string or until cancelled. Any stream modifier can be followed by braces {}. If a modifier is
followed by braces, only the text within the braces are affected.

Special Greek and mathematical symbols may also be used in text strings. The are created by
embedding escape sequences into the text string.

shs.mapua.edu.
Example:

shs.mapua.edu.
Creating Linear and Logarithmic Plots
Plot the function
𝑦 𝑥 = 𝑥 2 − 10𝑥 + 25
over the range of 0 to 10 on a linear plot using 21 evenly spaced
points in one subplot and over the range of 10−1 𝑡𝑜 101 on semi-
logarithmic plot using 21 evenly spaced points on a logarithmic x-axis
in a second subplot. Put markers on each point used in the calculation
so that they will be visible, and be sure to include title and axis label
on each plot.

shs.mapua.edu.
End of Presentation

You might also like