3
$\begingroup$

I believe the three lines drawn (or not) should be the same. In Mathematica 10.3 they are not.

side = Line[{{0, 0}, {6, 0}}]
Graphics @ Scale[side, 31]
Graphics @ Scale[side, 32]
Graphics @ Scale[side, 33]

Oddly, numbers below 32 work fine and number above 32 do not display (without warning).

$\endgroup$
  • $\begingroup$ I tried it with MMA 10.4. At first, two lines were visible. So, I changed the magnification / zoom from 100% to 200%, scrolled down some and all 3 lines were visible. I used the magnification button in the lower right hand corner. $\endgroup$ – LouisB Aug 6 '16 at 7:39
  • $\begingroup$ The three lines should certainly not be the same. It might be correct to expect that they look the same on your screen, but the three lines certainly do not have the same end point coordinates. $\endgroup$ – m_goldberg Aug 6 '16 at 19:17
2
$\begingroup$

I can cast some light on what is happening by adding some options to Graphics.

Graphics[{Scale[side, 40]}, Frame -> True]

g1

Graphics[{Scale[side, 40]}, PlotRangePadding -> 10, Frame -> True]

g2

Somehow the scaling has moved the line upwards, so it is outside the viewport in the first example. Note also the horizontal stretching is also likely not what you were expected. Probably what you really want is

Graphics[Scale[side, 40, {0, 0}], PlotRangePadding -> 10, Frame -> True]

g3

Giving Scale an explicit anchor point solves the problem.

Graphics[Scale[side, 40, {0, 0}]]

g4

Note: the results are sensitive to the Front End setting for magnification. The results shown here were obtained at a magnification of 125%. The work-around is good at all magnifications that I experimented with.

$\endgroup$
  • $\begingroup$ So ... am I right that the behavior I found is surprising or a front-end bug? That an anchor point "fixes" it suggests so ... $\endgroup$ – Alan Aug 6 '16 at 18:46
  • $\begingroup$ @Alan. The behavior feels like a bug to me, but I don't have the confidence to categorically pronounce it to be a bug. I would like to see comments from other community members. $\endgroup$ – m_goldberg Aug 6 '16 at 19:22
0
$\begingroup$

The behavior is also affected by PlotRange

$Version

(*  "10.4.1 for Mac OS X x86 (64-bit) (April 11, 2016)"  *)

side = Line[{{0, 0}, {6, 0}}];

Manipulate[
 Column[
  Graphics[#, PlotRange -> {-2, ymax}] & /@
   {Scale[side, scale],
    Scale[side, scale + 1],
    Scale[side, scale + 2]}],
 {{ymax, 19, Subscript["y", "max"]}, 2, 20, 1,
  Appearance -> {"Open", "Labeled"}},
 {{scale, 31}, 2, 38, 1,
  Appearance -> {"Open", "Labeled"}}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.