Re: shapescale

Hi Henner,

> no, sorry, that doesn't solve my problem, because the range of a RealType
> mapped to ShapeScale only seems to affect the size of the shape. if the
> minimum of the observed deviations is (let's say) -1 and i'd set this also
> as minimum for the range concerning ShapeScale nearly all the shapes would
> have same maximum lengths, because they represent (always positive) standard
> deviations (for example a std dev of 0 should be represented by bar of
> length 0, but it would be longer that way, because 0 is "much" bigger then
> the minimum (see assumption above).
> i'll try to explain my problem a bit more understandably:
> - i have a sequence of sampled data from which i compute the average and the
> standard deviation.
> - i want to plot that standard deviation as a bar (a line from +sigma to
> -sigma cutting the x-axis vertically). lets say its 1.
> - i want to plot a single point x (perhaps a new point of the considered
> sequence) with the same scale. if x < 1 it should be plotted on the bar, if
> x = -1 it should be plotted exactly at the lower end and if  x = 1 exactly
> at the upper end of the bar.

I think this will get it.  The xmap.setRange() call will cause
x = -xrange to map to YAxis = -1, and x = xrange to map to 
YAxis = 1.  The ssmap.setRange() should cause 
standard_deviation = xrange to map to a bar from YAxis = -1
to YAxis = 1, and a standard_deviation = 0 to map to a bar
of zero length.

  ScalarMap xmap = new ScalarMap(x, Display.YAxis);
  xmap.setRange(-xrange, xrange);

  ScalarMap smap = new ScalarMap(standard_deviation, Display.Shape);
  ShapeControl scontrol = smap.getControl();
  scontrol.setShapeSet(new Integer1DSet(1));  // only one value
  VisADLineArray line = new VisADLineArray();
  line.vertexCount = 2;
  line.coordinates = new float[]
    {0.0f,  -1.0f, 0.0f,    0.0f, 1.0f, 0.0f};
  scontrol.setShapes(new VisADGeometryArray[] {line});

  ScalarMap ssmap = new ScalarMap(standard_deviation, Display.ShapeScale);
  ssmap.setRange(0.01 * xrange, 1.0 * xrange);

This stuff can be a bit tricky, so you may need to fiddle a bit.

Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738

  • 2000 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: