[net.graphics] Scaling graphs

rouil@ada-uts.UUCP (07/12/86)

   I will be working on a tool, for a research computer, that will
generate a scale for plotting data points given a data set of several
thousand points.

   The easiest way to generate a linear scale for both the X and Y axes is
to take the differences of the min and max then divide by the size of the
axis to determine the distence/unit.  Then to plot the points it is a
simple mapping of w plotter distance being equal to z scale distance.

   However I also need a method of generating logarithmic scales for the
data.  Does anybody know a good way of generating a logarithmic scale
from a set of points.

   Once you have the logarithmic scale how do you map betwen the scale
distance and the plotter distance.

   This program will be written in DEC fortran on a VAX.  If there is
public domain code out there please let me know about it.

   I would prefer that you mail responses to me.  If there is interest in
the answers I will post to the net.

                                          Thanks,

John Rouillard                          UUCP:ihnp4!inmet!ada-uts!rouil
Intermetrics Inc.
733 Concord Ave.
Cambridge, Ma. 02138

rdp@teddy.UUCP (07/14/86)

In article <14200002@ada-uts> rouil@ada-uts writes:
>
>   However I also need a method of generating logarithmic scales for the
>data.  Does anybody know a good way of generating a logarithmic scale
>from a set of points.
>
>   Once you have the logarithmic scale how do you map betwen the scale
>distance and the plotter distance.
>
>   This program will be written in DEC fortran on a VAX.  If there is
>public domain code out there please let me know about it.
>

But I have problems here with mail so I will post: 
 
From the "Collected Algorithms from CACM" one finds Algorithm 463:
"Algorithms SCALE1, SCALE2, and SCALE3 for Determination of Scales
on Computer Generated Plots", which perfrom the sort of linear and 
logarithmic scaling you are searching for. The sources are in standard
FORTRAN-IV.

The three routines provide the follwoing services:

	      subroutine scale1(xmin, xmax, n, xminp, xmaxp, dist)
	C
	C Given XMIN,XMAX and N, SCALE1 finds a new range XMINP and
	C XMAXP divisible into approximately N linear intervals
	C of size DIST.
	C VINT is an array of acceptable values for DIST (times
	C an integer power of 10)
	C SQR is an array of geometric means of adjacent values
	C of VINT, it is used as break points to determine
	C which VINT value to assign to DIST
	C
 
	      subroutine scale2(xmin, xmax, n, xminp, xmaxp, dist)
	C
	C Given XMIN, XMAX and N, SCALE2 finds a new range XMINP and
	C XMAXP divisible into exactly N linear intervals of size
	C DIST, where N is greater than 1
	C

	      subroutine scale3(xmin, xmax, n, xminp, xmaxp, dist)
	C
	C Given XMIN, XMAX and N, where N is greater than 1, SCALE3
	C finds a new range XMINP and XMAXP divisible into exactly
	C N logarithmic intervals, where the ratio of adjacent
	C uniformly spaced values is DIST.
	C

I have the code online and will post if interest is high enough (maybe to
mod.sources with an announcement here.

Dick Pierce