Changes between Version 5 and Version 7 of Ticket #32560
- Timestamp:
- 10/25/21 14:10:29 (8 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #32560
- Property Cc slelievre added
-
Property
Commit
changed from
36813911e27d5c31842016a28fe582c03e28497a
to89f101edbae884df2d4e41016e0ea7ca3f8befed
-
Property
Summary
changed from
unexpected behavior of aspect_ratio in threejs template
toAdd 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. 1 Up to Sage 9.5.beta4, `threejs_template.html` can 2 automatically scale down the z-axis if `aspect_ratio` 3 has its default value of `[1, 1, 1]` (whether because 4 the user did not specify a value, or because the user 5 specified a value identical to the default value) 6 and the plot extends a lot more in the z direction 7 than in the x and y directions. 2 8 3 9 For instance, the following example 4 10 {{{ 5 sage: plot = sum([cube((0, 0,i)) for i in range(0,6)])6 ....: plot.show(aspect_ratio=[1,1,1])11 sage: plot = sum([cube((0, 0, i)) for i in range(0, 6)]) 12 sage: plot.show(aspect_ratio=[1, 1, 1]) 7 13 }}} 8 will produce a stack of cubes squeezed along the z-axis. 14 shows a stack of cubes squeezed along the z-axis, 15 rather than a stack of undistorted cubes. 9 16 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: 17 This behavior is unexpected after explicitly 18 setting the aspect ratio. 19 20 In the file `threejs_template.html`, 21 the lines responsible for this behavior are: 12 22 {{{ 13 23 var autoAspect = 2.5; … … 15 25 }}} 16 26 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. 27 That automatic scaling down was introduced in #12402. 28 Quoting 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. 19 33 20 21 It is worth mentioning that one way to overwritethis behavior is to do:34 It is worth mentioning that one way to overwrite 35 this behavior is to do: 22 36 {{{ 23 sage: plot.show(aspect_ratio=[1, 1,0.99999])37 sage: plot.show(aspect_ratio=[1, 1, 0.99999]) 24 38 }}} 25 39 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. 40 This ticket fixes this behavior and introduces 41 a new threejs-specific plot option. 42 43 The new option is called `auto_scaling` 44 (default: [False, False, False]) and takes 45 a list or a tuple of three booleans; 46 set to `True` to automatically scale down 47 the corresponding direction if it is too large.