Thanks ... And I did some tests this morning:

Plotted the *bisector (3rd, 1st quadrant) and *sin using

   pd 'xrange _1 1'
   pd 'yrange _1.1 1.1'
and
   pd 'aspect xx'   with these values:  xx= 0.866 | 1.0 | 1.155

Results:

aspect:                                 0.866 | 1.0  | 1.155    'xrange _1 1'
-------------------------------------------------------------
vertical/horizontal unit length:        0.81  | 0.92 | 1.05
height/width of grid frame:             0.87  | 1.0  | 1.15

'aspect 1.0' does not produce an angle of 45 deg of tangent versus horizontal at the root as expected.

Try it with a different xrange and have a look how distorted it becomes:

aspect:                                 0.866 | 1.0  | 1.155    'xrange _2 2'
-------------------------------------------------------------
vertical/horizontal unit length:        1.57  | 1.83 | 2.13
height/width of grid frame:             0.87  | 1.0  | 1.15

This clearly shows (at least to me) that the aspect value is definitely governing the rectangular grid frame, and somehow (on the way) influencing the units ratio.
I think that's a bug (as it should at least be the other way around).
Therefore I still plead for a separate pf option of e.g. 'compression ratio' or 'units ratio' if possible.

-M



At 2022-03-21 21:43, you wrote:

On Mon, 21 Mar 2022, Martin Kreuzer wrote:

[I'm writing under the influence of a (so long) mild attack of big C, so beg your pardon if reads a bit incoherently in places.]

Sad to hear that.  Hope you get better soon.


When plotting a unit circle (using pd commands and options) I got disappointed again as it looked like a ballon from last weeks birthday party.

When I run the following:

plot r.2p1 * 128 %~ i.128

I get something that looks stretched out and disappointing. But the aspect ratio follows the window size. If, instead, I run this:

'aspect 1' plot r.2p1 * 128 %~ i.129

The aspect ratio remains fixed regardless of the window size, and I get something that looks like a circle.

On to the issue of the hexagon:

   pd'reset'
   pd'aspect 1'
   pd r.2p1*6%~i.7
   pd'show'

If I do this, I get a slightly distorted hexagon. However, if I inscribe it in a circle, it looks correct:

   pd r.2p1*128%~i.129
   pd'show'

So I think it is a bug in plot. The aspect ratio is being computed relative to the max/min bounds of the function being plotted, not in absolute terms.

So where does 0.866 come from? We can find the max/min bounds of the points in our hexagon, and thereby find the (incorrect) aspect ratio used by plot:

   +. p=. r.2p1*6%~i.6
   1           0
 0.5    0.866025
_0.5    0.866025
  _1 1.22465e_16
_0.5   _0.866025
 0.5   _0.866025
   (>./ - <./)+.p
2 1.73205
   %/(>./ - <./)+.p
1.1547

plot is using ~1.1547 as its aspect ratio, so we need the reciprocal,
which is ~0.866.  0.866 is also visible in p, as it really comes from
1 o. o. %3.  And yes, it really is -:%:3.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to