Tutorial > 2D Plotting > Modifying Plot Axes
  

Modifying Plot Axes
To understand data in the plot, you may want to modify the axes to reflect the information you seek. Plot axes in PV-WAVE are highly customizable. This section demonstrates some of the following concepts when modifying the plot’s axes:
* Scaling Plot Axes
* Specifying the Range of the Axes
* Specifying Exact Tick Intervals with XStyle = 1
* Plotting Additional Data on the Same Axes
* Plotting Date/Time Axes
* Drawing Additional Axes on Plots
Scaling Plot Axes
Fluctuations in data may not be readily apparent because of the way PV-WAVE scales the data. By default, PV‑WAVE sets the minimum y–axis value of linear plots to 0 if the y data is all positive. The maximum axis value is automatically set from the maximum y data value. In addition, PV‑WAVE attempts to produce from 3 to 6 tick mark intervals that are in increments of an integer power of 10 times 2, 2.5, 5, or 10.
Use the YNozero keyword to inhibit setting the y–axis minimum to 0 when given positive, non-zero data. You can make /YNozero the default in subsequent plots by setting bit 4 of !Y.Style to 1, (!Y.Style = 16).
Specifying the Range of the Axes
The range of the x–, y–, or z–axes can be explicitly specified with the XRange, YRange, and ZRange keyword parameters. The argument of the keyword parameter is a two-element vector containing the minimum and maximum axis values.
For example, if we wish to constrain the x–axis to the years 1975 to 1983, the following keyword parameter is included in the call to PLOT:
XRange = [1975, 1983] 
The effect of the YNozero keyword, explained in the previous section, is identical to that obtained by specifying the following YRange keyword parameter in the call to PLOT:
 YRange = [MIN(Y), MAX(Y)]
Specifying Exact Tick Intervals with XStyle = 1
As explained in the previous section, PV‑WAVE attempts to produce even tick intervals, and the axis range selected by PV‑WAVE may be slightly larger than that given with the XRange, YRange, and ZRange keywords. To obtain the exact specified interval, set the x–axis style parameter to 1 (XStyle=1).
Plotting Additional Data on the Same Axes
Additional data may be added to existing plots with the OPLOT procedure. Each call to PLOT establishes the plot window (the region of the display enclosed by the axes), the axis types (linear or log), and the scaling. This information is saved in the system variables !P, !X, and !Y, and used by subsequent calls to OPLOT.
It may be useful to change the color index, linestyle, or line thickness parameters in each call to OPLOT to distinguish the data sets. For a table describing the linestyle associated with each index, see the description of the !P.Linestyle system variable in the PV‑WAVE Reference.
Plotting Date/Time Axes
Data often follows a regular pattern related to the dates and times on which business is conducted or measurements are recorded. This data is often represented in relation to several levels of date/time information such as seconds, minutes, hours, days, weeks and years. In conjunction with the PLOT and OPLOT procedures, the date/time routines let you generate two-dimensional plots that display multiple levels of labeling for the date/time axis.
PV‑WAVE’s date/time feature provides a precise method for creating two-dimensional plots with date/time data represented on the X axis. Once you have generated date/time data, you can create plots that reflect various levels of time intervals. The PLOT procedure automatically draws and labels the date/time axis.
The date/time axis is well-suited for the display of data that follows an hourly, daily, weekly, or monthly pattern; financial and meteorological data are two examples of this type of data. By default, PV‑WAVE labels a date/time axis with up to six levels of tick labels that show the time frame of the data that is being displayed.
The four basic steps for creating a date/time plot are:
*Read data into PV‑WAVE.
*Convert data representing dates and/or times to date/time data.
*Manipulate the date/time data (optional).
*Plot the data.
Drawing Additional Axes on Plots
The AXIS procedure draws and annotates an axis. It optionally saves the scaling established by the axis for use by subsequent graphics procedures. It may be used to add additional axes to plots, or to draw axes at a specified position.
The AXIS procedure accepts the set of plotting keyword parameters that govern the scaling and appearance of the axes. In addition, the keyword parameters XAxis, YAxis, and ZAxis specify the orientation and position (if no position coordinates are present), of the axis. The values of these parameters are: 0 for the bottom or left axis, and 1 for the top or right. The tick marks and their annotation extend away from the plot window. For example, specify YAXIS = 1 to draw a y–axis on the right of the window.
The optional keyword parameter Save saves the data-scaling parameters established for the axis in the appropriate axis system variable, !X, !Y, or !Z.
The call to AXIS is:
AXIS [[, x, y], z]
where x, y, and optionally z specify the coordinates of the axis. By including the appropriate keyword parameter (Device, Normal, or Data) you can specify a coordinate system.

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.