0
$\begingroup$

Bug introduced in 11.0 and persisting through 11.1.0


in V 11.1 I noticed something strange.

Compare this

SetOptions[$FrontEnd,PrintPrecision->15]
f[x_]:=Piecewise[{{0,x<1},{1,True}}];
Plot[f[x],{x,0,10}]

Mathematica graphics

To

SetOptions[$FrontEnd,PrintPrecision->16]
f[x_]:=Piecewise[{{0,x<1},{1,True}}];
Plot[f[x],{x,0,10}]

Mathematica graphics

But this affects only the above plot. Other plot I tried such as below is OK

SetOptions[$FrontEnd,PrintPrecision->16]
f[x_]:=Sin[x];
Plot[f[x],{x,0,10}]

Mathematica graphics

Any idea why this happens? Btw, the above only happens in version 11 and 11.1. On version 10.4, it does not happen. Here is screen shot on version 10.4

Mathematica graphics

It only happens on version 11 and 11.1 and when I change from 15 to 16 PrintPrecision.

$\endgroup$
  • $\begingroup$ It is PlotRange what triggers this behavior: try Plot[Sin[x], {x, 0, 10}, PlotRange -> {{0, 10.}, {0., 1.}}] or simply Graphics[{}, Axes -> True, PlotRange -> {{0, 1.}, {0., 1.}}]. $\endgroup$ – Alexey Popkov Apr 19 '17 at 8:57
  • $\begingroup$ It is better don't change the options permanently, use $FrontEndSession instead of $FrontEnd: SetOptions[$FrontEndSession, PrintPrecision -> 16]. $\endgroup$ – Alexey Popkov Apr 19 '17 at 9:01
  • 1
    $\begingroup$ Reproduced with versions 11.0.1 and 11.1.0 on Windows 7 x64, versions 10.4.1 and 8.0.4 do not have this behavior. $\endgroup$ – Alexey Popkov Apr 19 '17 at 9:03
  • $\begingroup$ Have you reported this to the tech support? $\endgroup$ – Alexey Popkov Apr 19 '17 at 9:14
  • $\begingroup$ @AlexeyPopkov No I have not. I was not sure if it is a bug or not. Thanks. $\endgroup$ – Nasser Apr 19 '17 at 9:15
1
$\begingroup$

Looks like a bug of Graphics in version 11, here is a minimal code sample reproducing the problem:

SetOptions[$FrontEndSession, PrintPrecision -> 16]
Graphics[{}, Axes -> True, PlotRange -> {{0, 1.}, {0., 1.}}]

screenshot

The second Graphics on the screenshot above is the same graphics after automatic scaling when I typed // after it and then deleted. Obviously it is an additional related bug.

A workaround is to add BaseStyle -> {PrintPrecision -> 6}:

Graphics[{}, Axes -> True, PlotRange -> {{0, 1.}, {0., 1.}}, 
 BaseStyle -> {PrintPrecision -> 6}]

or wrap the whole Graphics with Style:

Style[Graphics[{}, Axes -> True, PlotRange -> {{0, 1.}, {0., 1.}}], PrintPrecision -> 6]

Another way is to set the option NumberMarks -> True instead of PrintPrecision -> 16 if you wish to see all the digits:

SetOptions[$FrontEndSession, PrintPrecision -> 6, NumberMarks -> True]
$\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.