15

Bug introduced in 10.4, fixed in 11.0.


Version 10.4 introduced the PlotLabels option in ListPlot and similar functions. But it seems that it doesn't work when setting the PlotRange. For example

ListLinePlot[{1, 1, 2, 3, 5, 8}, PlotRange -> {All, {5.5, 6}}, PlotLabels -> 1]

enter image description here

Could you confirm it as a bug?

I'm using version 10.4 on OS X 10.11.4.

István Zachar
  • 47,032
  • 20
  • 143
  • 291
xslittlegrass
  • 27,549
  • 9
  • 97
  • 186
  • It doesn't like your PlotRange, reporting it. – rcollyer Mar 27 '16 at 17:16
  • @rcollyer Thanks! – xslittlegrass Mar 27 '16 at 17:18
  • 1
    Well, you got me to do some work on a Sunday ... :P – rcollyer Mar 27 '16 at 17:23
  • 2
    Bug is all over the place with PlotLabels, see e.g. LogPlot[{0, 0.1}, {t, 0, 1}, PlotLabels -> Automatic], Plot[0, {t, 0, 1}, PlotRange -> {{0, 1}, {.001, All}}, PlotLabels -> All]. Reported them and TechSupport has filed it internally. – István Zachar Mar 29 '16 at 15:34
  • 1
    As a workaround: I note that the problem only arises, when the labels are placed automatically. So Placed[ lbl, pos ] will work, if pos is different from Automatic. In the given example this will work: ListLinePlot[{1, 1, 2, 3, 5, 8}, PlotRange -> {All, {5.5, 6}}, PlotLabels -> Placed[1, {0.9, 0.7}]] where the position specs are relative fractions of the plot's region. – gwr Apr 22 '16 at 11:07
  • Is not it supposed to be PlotLabel without the s at the end? – Sumit Jun 19 '16 at 13:25
  • @Sumit See rcollyer's comment under Alexei's answer. – xslittlegrass Jun 19 '16 at 14:23
  • 1
    @gwr Unfortunately, the Placed workaround is not robust enough, see e.g. LogPlot[{0, 0.1}, {t, 0, 1}, PlotLabels -> Placed[{"A", "B"}, Above]]. – István Zachar Jul 25 '16 at 18:03
  • @IstvánZachar Thanks for pointing out. Sometimes one feels like one could "go bonkers" with these things. :) – gwr Jul 25 '16 at 18:41
  • 2022 and Plotting is still a pain in the ass in MMA. For me using PlotLegends did the trick. – Rainer Glüge Dec 01 '22 at 09:05

1 Answers1

3

It is not a matter of an answer, but of a short comment: not PlotLabels but PlotLabel and everything works.

But just to make this answer more useful, you may check this as follows:

 Options[ListLinePlot]

{AlignmentPoint -> Center, AspectRatio -> 1/GoldenRatio, Axes -> True,
  AxesLabel -> None, AxesOrigin -> Automatic, AxesStyle -> {}, 
 Background -> None, BaselinePosition -> Automatic, BaseStyle -> {}, 
 ClippingStyle -> None, ColorFunction -> Automatic, 
 ColorFunctionScaling -> True, ColorOutput -> Automatic, 
 ContentSelectable -> Automatic, CoordinatesToolOptions -> Automatic, 
 DataRange -> Automatic, DisplayFunction :> $DisplayFunction, 
     Epilog -> {}, Filling -> None, FillingStyle -> Automatic, 
     FormatType :> TraditionalForm, Frame -> False, FrameLabel -> None, 
     FrameStyle -> {}, FrameTicks -> Automatic, FrameTicksStyle -> {}, 
     GridLines -> None, GridLinesStyle -> {}, ImageMargins -> 0., 
     ImagePadding -> All, ImageSize -> Automatic, 
     ImageSizeRaw -> Automatic, InterpolationOrder -> None, 
     Joined -> True, LabelStyle -> {}, MaxPlotPoints -> \[Infinity], 
     Mesh -> None, MeshFunctions -> {#1 &}, MeshShading -> None, 
     MeshStyle -> Automatic, Method -> Automatic, 
     PerformanceGoal :> $PerformanceGoal, PlotLabel -> None, 
 PlotLegends -> None, PlotMarkers -> None, PlotRange -> Automatic, 
 PlotRangeClipping -> True, PlotRangePadding -> Automatic, 
 PlotRegion -> Automatic, PlotStyle -> Automatic, 
 PlotTheme :> $PlotTheme, PreserveImageOptions -> Automatic, 
 Prolog -> {}, RotateLabel -> True, TargetUnits -> Automatic, 
 Ticks -> Automatic, TicksStyle -> {}}

and then find the option you ar5e looking for (and sometimes also the one you never thought of).

Have fun!

Alexei Boulbitch
  • 39,397
  • 2
  • 47
  • 96
  • It's fun to watch that Mathematica crashes instantly after I paste everything in the code block into a notebook :) – xslittlegrass Mar 28 '16 at 13:20
  • @xslittlegrass I have no problem with that. It may be the problem of your notebook. May be restarting would be a good idea. – Alexei Boulbitch Mar 28 '16 at 13:24
  • Here is a screenshot, I'm using 10.4 on OS X 10.11.4. What system are you using? – xslittlegrass Mar 28 '16 at 13:32
  • 2
    @AlexeiBoulbitch PlotLabel labels the entire plot, i.e. it's the title. PlotLabels labels the individual plots. – rcollyer Mar 28 '16 at 13:34
  • @xslittlegrass 10.11.4? I'll forward this to someone who is running that. – rcollyer Mar 28 '16 at 13:36
  • @rcollyer Yes, thanks! – xslittlegrass Mar 28 '16 at 13:38
  • @rcollyer OK, I have 10.3 on this computer, may be this is the reason that I do not see such an option. However, the general method is to exaluate Option[functionInQuestion] and choose the existing options. – Alexei Boulbitch Mar 28 '16 at 15:02
  • @xslittlegrass I am using Win7, Mma10.3 on this computer. Tomorrow I will have a look, how is it on 10.4 – Alexei Boulbitch Mar 28 '16 at 15:08
  • @xslittlegrass thus far, we have not been able to reproduce the crash. Can you send support@wolfram.com a copy of the crash report along with your SystemInformation[]? We'll see if we can hunt it down that way. – rcollyer Mar 28 '16 at 15:16
  • @rcollyer I have reported. I just tried a few times and it seems to have something to do with the automatic switching of my graphics card and the pop out of the floating elements. I'm using an late 2013 model of 15 inch Macbook pro retina, and it has both an intel and nvidia graphics cards. If my computer is using the nvidia graphics card then there is no problem. The problem only occurs when my computer is on intel, and the crash happens when I paste codes and it tries to switch to nvidia. – xslittlegrass Mar 28 '16 at 19:41
  • @rcollyer Moreover, there is no crash if I move my mouse away before I paste the code, so that the mouse is outside of the posted code. In that sense there is mouse related pop up, and thus no graphics card switch and no crash. – xslittlegrass Mar 28 '16 at 19:44
  • @xslittlegrass i'll let support try and diagnose then, as I don't have something comparable. – rcollyer Mar 28 '16 at 19:51
  • @xslittlegrass I tried on Mma10.4, Win7. I confirm that your code gives rise to the eoor message and a pink plot also indicating the error. If the PlotRange option is removed, the errors disappear and the code works as expected. This looks like a bug. – Alexei Boulbitch Mar 29 '16 at 07:27