College of Engineering Logo Web Server Logs Student Server Logs Orange bar Main Page General Information Special Events Programs Research Student Information Computer Facility Outreach Xtreme Engineering Jobs Available

Setting the ranges for Two-dimensional plots

Computer Facility University of Hawaii at Manoa
College of Engineering

Note that gnuplot automatically sets the range for the x and y variables. you can specify ranges for none, either or both the x and y axes. For example, you can tell gnuplot to plot exactly two cycles of the sine wave by setting the x range to go from -2 pi to 2 pi, which is represented below as [ -2 * pi : 2 * pi ]. The command looks like this:

plot [-2 * pi : 2 * pi] sin(x)
By specifying two ranges, you can also control the y range as well. This example shows the plot's y-axis going from -1.5 to 1.5:
plot [-2 * pi : 2 * pi] [-1.5:1.5] sin(x)
These ranges can also be set using the set xrange and set yrange commands.

Author: Ben Yoshino (ben@wiliki.eng.hawaii.edu)

Comments, Questions? | E-mail: webmaster@wiliki.eng.hawaii.edu


Last updated on Thursday, August %.1d, 2002
Copyright © 2001 University of Hawai`i, College of Engineering, Computer Facility
All rights reserved.