9
$\begingroup$

Bug introduced in 11.0 or earlier and persisting through 11.3.
Related but non-identical bug present in 10.0-10.4.
Reported to Worfram, Inc as CASE:3926732


$Version
(* "11.1.1 for Microsoft Windows (64-bit) (April 18, 2017)" *)

p1 = Plot[{Abs[5 x], -Abs[x/5]}, {x, -2, 2}, PlotRange -> {-2, 2}];
zz[{x_, y_}] := Piecewise[{{{3 /5 x -  y + 32/100 , x}, -1/5 Abs[x] <= y <= 
 5 Abs[x]}}, 
    {4/5 x + y + 52/100, x}]
p2 = ListPlot[NestList[zz, {.384, .384}, 212]]
p3 = Show[p1, p2]

enter image description here

enter image description here

Now, if I click on any line of code in the notebook, the points in the second plot vanish from the screen, leaving just the lines. I imagine that Show cannot cope with the extreme difference in PlotRange between the two plots. Nonetheless, I find this bizarre and would welcome an explanation. By the way, decreasing the third argument of NestList to 211 eliminates this behavior, while increasing that argument substantially (say, to 1000) causes both plots to exhibit this behavior.

Edit: To be more explicit, is this a bug?

Addition: In versions 10.0.2–10.4.1, Show does not display the points even at first.

$\endgroup$
  • $\begingroup$ This title is obscure, misleading, and very unhelpful for anyone trying to search for this information. $\endgroup$ – David G. Stork Aug 8 '17 at 20:30
  • $\begingroup$ @DavidG.Stork You are right. I shall change it., $\endgroup$ – bbgodfrey Aug 8 '17 at 20:30
  • $\begingroup$ I can confirm this behavior as well (same OS, same version here). Not only clicking, but scrolling the MMA window is enough to cause the points in the bottom plot to vanish. $\endgroup$ – MarcoB Aug 8 '17 at 20:36
  • 1
    $\begingroup$ Behavior is somewhat different when running V11.1 on OS X. I get the plot p2 showing the plotted points for about a second, then the points disappear, leaving only an empty plot. My work-around is similar to John Joseph M. Carrasco's, but I use pts = NestList[zz, {.384, .384}, 212]; okPts = Select[pts, ManhattanDistance[#, {0, 0}] < 4 &]; $\endgroup$ – m_goldberg Aug 8 '17 at 21:47
  • 2
    $\begingroup$ I am marking this a bug because I think it's been sufficiently confirmed. $\endgroup$ – m_goldberg Aug 8 '17 at 21:49
3
$\begingroup$

I would say this is a bug, but perhaps not so unexpected.

It is indeed about having way too many points out of Range. Fixed, e.g., by selecting only the points you want to plot:

    (p1 = Plot[{Abs[5 x], -Abs[x/5]}, {x, -2, 2}, PlotRange -> {-2, 2}]) //
       StylePrint;
    zz[{x_, y_}] := Piecewise[{{{3/5 x - y + 32/100, x}, -1/5 Abs[x] <= y <= 
                    5 Abs[x]}}, {4/5 x + y + 52/100, x}];
    (p2 = ListPlot[Select[NestList[zz, {.384, .384}, 212], #.# < 4 &], 
         PlotRange -> {{-2, 2}, {-2, 2}}]) // StylePrint;
    p3 = Show[p1, p2]

yielding:

enter image description here

$\endgroup$
  • $\begingroup$ I appreciate the work-around, but it does not really answer my question. $\endgroup$ – bbgodfrey Aug 8 '17 at 21:11
  • $\begingroup$ It looks like a bug that exists happily in ListPlot. At least on my setup, I have the same situation with either: ListPlot[xxx = Table[{RandomReal[{-1.1, 1.1}, 2], 10^20 RandomReal[{-1.1, 1.1}, 2]}, {5}], PlotRange -> {{-2, 2}, {-2, 2}}] not showing 5 inner points. Or with bbgodfrey's ListPlot[zoop = NestList[zz, {.384, .384}, 212], PlotRange -> {{-2, 2}, {-2, 2}}] loosing all its points. $\endgroup$ – John Joseph M. Carrasco Aug 8 '17 at 21:53

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.