Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Re: Reversing Axes in 2D plots

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        |
*----------------------------------------------------------------------*


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690