Two-Dimensional Plots
Two-Dimensional Plots
Computer
Programming
Dr. Deniz Kutluay
Two-Dimensional Plots
Goal #1 Goal #2
Two-Dimensional
Plots
Plots are a very useful tool for presenting
information
002
Basic Computer Programming Dr. Deniz Kutluay
Line Specifiers:
The line style specifiers are:
Line specifiers are optional and can be
used to define the style and color of the
line and the type of markers.
004
Basic Computer Programming Dr. Deniz Kutluay
Line Specifiers:
The marker type specifiers are:
Line specifiers are optional and can be
used to define the style and color of the
line and the type of markers.
005
Basic Computer Programming Dr. Deniz Kutluay
006
Basic Computer Programming Dr. Deniz Kutluay
007
Basic Computer Programming Dr. Deniz Kutluay
Property Name and Property Value: The Property Names for the line specifiers are:
009
Basic Computer Programming Dr. Deniz Kutluay
010
Basic Computer Programming Dr. Deniz Kutluay
011
Basic Computer Programming Dr. Deniz Kutluay
012
Basic Computer Programming Dr. Deniz Kutluay
The fplot command plots a function with The command has the form:
the form y = f(x) between specified
limits.
013
Basic Computer Programming Dr. Deniz Kutluay
014
Basic Computer Programming Dr. Deniz Kutluay
Plotting multiple
graphs in the same
plot Using the plot Command:
derivatives, for ,
derivatives, for ,
derivatives
derivatives, for ,
Plotting multiple
graphs in the same
plot
Using the hold on and hold off Commands
Plotting multiple
graphs in the same
plot
Using the line Command
The form of the line command is:
With the line command additional graphs
(lines) can be added to a plot that
already exists.
Plotting multiple
graphs in the same
plot
Using the line Command
Formatting a plot
The formatting commands are entered
after the plot or the fplot command.
Labels can be placed next to the axes with A title can be added to the plot with the
the xlabel and ylabel command which command:
have the form:
019
Basic Computer Programming Dr. Deniz Kutluay
Formatting a plot
The formatting commands are entered
after the plot or the fplot command.
The pos is an optional number that specifies where
in the figure the legend is to be placed.
The legend command:
020
Basic Computer Programming Dr. Deniz Kutluay
Formatting a plot
The text command:
Formatting a plot
022
Basic Computer Programming Dr. Deniz Kutluay
Formatting a plot
Greek characters:
Subscript and superscript:
Greek characters can be included in the text by
A single character can be displayed as a typing \name of the letter within the string.
subscript or a superscript by typing _ (the
underscore character) or ^ in front of the
character, respectively.
023
Basic Computer Programming Dr. Deniz Kutluay
Formatting a plot
024
Basic Computer Programming Dr. Deniz Kutluay
Formatting a plot
025
Basic Computer Programming Dr. Deniz Kutluay
Formatting a plot
The axis command:
026
Basic Computer Programming Dr. Deniz Kutluay
Formatting a plot
The grid command:
027
Basic Computer Programming Dr. Deniz Kutluay
Formatting a plot
028
Basic Computer Programming Dr. Deniz Kutluay
Plots with
logarithmic axes
Log scales provide means for presenting
data over a wide range of values.
029
Basic Computer Programming Dr. Deniz Kutluay
Plots with
logarithmic axes
The figure shows four plots of the same
function:
031
Basic Computer Programming Dr. Deniz Kutluay
032
Basic Computer Programming Dr. Deniz Kutluay
033
Basic Computer Programming Dr. Deniz Kutluay
034
Basic Computer Programming Dr. Deniz Kutluay
035
Basic Computer Programming Dr. Deniz Kutluay
036
Basic Computer Programming Dr. Deniz Kutluay
Histograms
037
Basic Computer Programming Dr. Deniz Kutluay
Histograms
038
Basic Computer Programming Dr. Deniz Kutluay
Polar plots
The line specifiers are the same as in where theta and radius are vectors whose elements
define the coordinates of the points to be plotted.
the plot command.
039
Basic Computer Programming Dr. Deniz Kutluay
Polar plots
is shown here
040
Basic Computer Programming Dr. Deniz Kutluay
041
Sample Problem 5.2:
Piston-crank mechanism
Piston-crank mechanism
Piston-crank mechanism
Piston-crank mechanism