Re: Reversing Axes in 2D plots

  • To: Edward Stanford <stanford@xxxxxxx>
  • Subject: Re: Reversing Axes in 2D plots
  • From: Doug Lindholm <lind@xxxxxxxx>
  • Date: Tue, 07 Nov 2000 16:12:27 -0700
You can reverse an axis by using the setRange method of the ScalarMap to
that axis.

ScalarMap sm = new ScalarMap(myRangeType, Display.YAxis);
myDisplay.addMap(sm);
...
double[] range = sm.getRange();
sm.setRange(range[1], range[0]);

Hope that helps,
Doug

Edward Stanford wrote:
> 
> Hello, all.
> 
> I have a 2D data set (pressure versus temperature), which I wish to display
> with pressure on the Y-Axis.  Using the obvious
> 
>              myDisplay.addMap(new ScalarMap(myRangeType, Display.XAxis));
>              myDisplay.addMap(new ScalarMap((RealType),
> myDomainType.getComponent(0),Display.YAxis));
> 
> produces almost what I want: at the origin, the pressure coordinate has the
> lowest value in the data set, and at the top, it has the highest.
> 
> This is certainly the expected behavior for a generic data set, but it is a
> trifle unphysical in reference to an atmosphere, where the highest
> pressures occur at the "lowest" point.
> 
> Is there any obvious way to invert the scales of a scalar map?  I didn't
> see one in the javadoc, but that doesn't mean it isn't there.
> 
>         Edward

-- 
*----------------------------------------------------------------------*
| Doug Lindholm, Software Engineer          |  E-mail: lind@xxxxxxxx   |
| Research Applications Program             |   Phone: 303-497-8374    |
| National Center for Atmospheric Research  |                          |
| P.O. Box 3000                             |     There's no place     |
| Boulder, Colorado 80307-3000              |        like $HOME        |
*----------------------------------------------------------------------*