Changes between Version 5 and Version 7 of Ticket #32560


Ignore:
Timestamp:
10/25/21 14:10:29 (8 months ago)
Author:
slelievre
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32560

    • Property Cc slelievre added
    • Property Commit changed from 36813911e27d5c31842016a28fe582c03e28497a to 89f101edbae884df2d4e41016e0ea7ca3f8befed
    • Property Summary changed from unexpected behavior of aspect_ratio in threejs template to Add auto_scaling option to threejs plots
  • Ticket #32560 – Description

    v5 v7  
    1 `threejs_template.html` overwrites the last entry in the parameter `aspect_ratio` to provide an automatic scaling in the z-axis.
     1Up to Sage 9.5.beta4, `threejs_template.html` can
     2automatically scale down the z-axis if `aspect_ratio`
     3has its default value of `[1, 1, 1]` (whether because
     4the user did not specify a value, or because the user
     5specified a value identical to the default value)
     6and the plot extends a lot more in the z direction
     7than in the x and y directions.
    28
    39For instance, the following example
    410{{{
    5 sage: plot = sum([cube((0,0,i)) for i in range(0,6)])
    6 ....: plot.show(aspect_ratio=[1,1,1])
     11sage: plot = sum([cube((0, 0, i)) for i in range(0, 6)])
     12sage: plot.show(aspect_ratio=[1, 1, 1])
    713}}}
    8 will produce a stack of cubes squeezed along the z-axis.
     14shows a stack of cubes squeezed along the z-axis,
     15rather than a stack of undistorted cubes.
    916
    10 This behavior is unexpected since the user provided the scaling they want.
    11 I looked into the file `threejs_template.html` and I found the lines responsible for this behavior:
     17This behavior is unexpected after explicitly
     18setting the aspect ratio.
     19
     20In the file `threejs_template.html`,
     21the lines responsible for this behavior are:
    1222{{{
    1323    var autoAspect = 2.5;
     
    1525}}}
    1626
    17 It turned out that the automatic scaling was introduced in #12402. I quote the following text from that ticket:
    18 >  There is already automatic scaling in the z-direction to avoid the tall thin box that appears in the current version on the cell server (and SMC), but that can easily be overridden.
     27That automatic scaling down was introduced in #12402.
     28Quoting from that ticket:
     29> There is already automatic scaling in the z-direction
     30> to avoid the tall thin box that appears in the current
     31> version on the cell server (and SMC), but that can
     32> easily be overridden.
    1933
    20 
    21 It is worth mentioning that one way to overwrite this behavior is to do:
     34It is worth mentioning that one way to overwrite
     35this behavior is to do:
    2236{{{
    23 sage: plot.show(aspect_ratio=[1,1,0.99999])
     37sage: plot.show(aspect_ratio=[1, 1, 0.99999])
    2438}}}
    2539
    26 This ticket overwrites this behavior and introduces a new threejs-specific plot option.
    27 The new option is called  `auto_scaling` (default: [False, False, False]) which is a list
    28 or a tuple of three booleans; set to `True` to automatically scale down the corresponding
    29 direction if it is too large.
     40This ticket fixes this behavior and introduces
     41a new threejs-specific plot option.
     42
     43The new option is called  `auto_scaling`
     44(default: [False, False, False]) and takes
     45a list or a tuple of three booleans;
     46set to `True` to automatically scale down
     47the corresponding direction if it is too large.