15
$\begingroup$

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.

$\endgroup$
10
  • $\begingroup$ It doesn't like your PlotRange, reporting it. $\endgroup$
    – rcollyer
    Commented Mar 27, 2016 at 17:16
  • 1
    $\begingroup$ Well, you got me to do some work on a Sunday ... :P $\endgroup$
    – rcollyer
    Commented Mar 27, 2016 at 17:23
  • 2
    $\begingroup$ 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. $\endgroup$ Commented Mar 29, 2016 at 15:34
  • 1
    $\begingroup$ 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. $\endgroup$
    – gwr
    Commented Apr 22, 2016 at 11:07
  • 1
    $\begingroup$ @gwr Unfortunately, the Placed workaround is not robust enough, see e.g. LogPlot[{0, 0.1}, {t, 0, 1}, PlotLabels -> Placed[{"A", "B"}, Above]]. $\endgroup$ Commented Jul 25, 2016 at 18:03

1 Answer 1

3
$\begingroup$

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!

$\endgroup$
13
  • $\begingroup$ It's fun to watch that Mathematica crashes instantly after I paste everything in the code block into a notebook :) $\endgroup$ Commented Mar 28, 2016 at 13:20
  • $\begingroup$ @xslittlegrass I have no problem with that. It may be the problem of your notebook. May be restarting would be a good idea. $\endgroup$ Commented Mar 28, 2016 at 13:24
  • $\begingroup$ Here is a screenshot, I'm using 10.4 on OS X 10.11.4. What system are you using? $\endgroup$ Commented Mar 28, 2016 at 13:32
  • 2
    $\begingroup$ @AlexeiBoulbitch PlotLabel labels the entire plot, i.e. it's the title. PlotLabels labels the individual plots. $\endgroup$
    – rcollyer
    Commented Mar 28, 2016 at 13:34
  • $\begingroup$ @xslittlegrass 10.11.4? I'll forward this to someone who is running that. $\endgroup$
    – rcollyer
    Commented Mar 28, 2016 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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