8
$\begingroup$

Bug introduced after 12.0.0 and persisting through 13.0.1 or later

I'm creating a really simple plot with the code attached below. However the y-axis label is rotated and parallel to the y-axis by default. I'd like to rotate it by 90 degrees but it doesn't seem to work. I found some related posts such as this one but it doesn't seem to work in my case. I tried setting RotateLabel to True or False but neither does anything. Does anyone know what I did wrong? Many thanks.

p1 = ListLinePlot[{impData[[7, All, {1, 5}]]},
   PlotTheme -> "Monochrome",
   PlotMarkers -> None,
   AxesLabel -> " ",
   Frame -> True,
   FrameLabel -> {{"alpha^2", None}, {"alpha", None} },
   RotateLabel -> False,
   LabelStyle -> {20},
   PlotRange -> {{0, 1000}, {-100, 500}},
   PlotStyle -> {},
   ImageSize -> Large];
Show[p1]
$\endgroup$
11
  • 3
    $\begingroup$ Recommendation: pare your code down to the MINIMAL example that illustrates your problem. Why do you define p1, the Show it? (No reason.) Why do you define ImageSize -> Large? (No reason.) Why do you define AxesLabel -> "". (No reason.) Why do you define PlotTheme -> "Monochrome"? (No reason.) Why is your undefined data list set with indices? (No reason.) Why do you... well... get the idea? $\endgroup$ Apr 11 at 1:41
  • 3
    $\begingroup$ Not sure who downvoted this question and what's the reason behind it. The command runs perfectly on an earlier version and the there's indeed a puzzling situation that needs a workaround - at least I was not able to resolve it differently. And finally, the author of the OP has presented a very clean code that illustrates the problem $\endgroup$
    – bmf
    Apr 11 at 1:45
  • 2
    $\begingroup$ @DavidG.Stork The fact that the code has redundancies DOES NOT mean -at least for me- that it is not clean enough. In my eyes, the phrasing of the question is good. It describes a problematic situation that you obtain in versions later than V12.0.0. It has a working piece of code. The only thing that is missing is the set of data. Since you have a 5-digit reputation it should not be that difficult to come up with a toy-model set of data, and I am not being sassy or disrespectful. This is my honest opinion. In the sense that I was able to do it; below 3000. $\endgroup$
    – bmf
    Apr 11 at 1:53
  • 1
    $\begingroup$ My honest opinion is that the code is extremely bloated (i.e., not "clean"), as it distracts readers with numerous irrelevancies. A reader has to wonder: "Does it matter that the plot is created in full, and then in a separate line presented with Show?" Moreover, you are factually incorrect when you refer to the irrelevancies as "redundancies." They are the opposite of redundancies. Note I never complained the code "didn't work" (and wonder why you even brought up that issue). I'm teaching a Mathematica-based course at university next year and I will mark down such bloated code. $\endgroup$ Apr 11 at 4:01
  • 2
    $\begingroup$ @DavidG.Stork I just saw your comment. Evidently we have different opinions on the matter. I do not consider it to a bad thing, and I only meant to understand your comments, that's all. Enjoy your lectures and best of luck to your future endeavors $\endgroup$
    – bmf
    Apr 11 at 4:38

3 Answers 3

5
$\begingroup$

Rotate the label by -Pi/2 to cancel the undesired rotation.

Clear["Global`*"]

$Version

(* "13.0.1 for Mac OS X x86 (64-bit) (January 28, 2022)" *)

Clear["Global`*"]

SeedRandom[1234];

data = Sort@Table[
    {RandomReal[1000], RandomReal[500]},
    10];

p1 = ListLinePlot[data,
  Frame -> True,
  FrameLabel -> {
    {Rotate[HoldForm[alpha^2], -Pi/2], None}, {HoldForm@alpha, None}},
  LabelStyle -> {16},
  PlotRange -> {{0, 1000}, {-100, 500}}]

enter image description here

$\endgroup$
7
  • $\begingroup$ Very nicely done! Out of curiosity, and because the version is not mentioned in the OP, were you able to verify the behavior described in the question in V13.0.1? $\endgroup$
    – bmf
    Apr 11 at 3:20
  • $\begingroup$ @bmf - yes, the problem exists in v13.0.1 on a Mac $\endgroup$
    – Bob Hanlon
    Apr 11 at 3:22
  • $\begingroup$ Many thanks. Does this qualify as a bug? Since on V12.0.0 works as expected? I'm not quite sure $\endgroup$
    – bmf
    Apr 11 at 3:23
  • 1
    $\begingroup$ @bmf - yes it is a bug. It apparently was introduced some time after v12.0.0 $\endgroup$
    – Bob Hanlon
    Apr 11 at 3:26
  • $\begingroup$ Thanks again for your time. Would you like to update the OP as well? $\endgroup$
    – bmf
    Apr 11 at 3:26
3
$\begingroup$

Another work around that seems less kludgy: Use Show[p1,... RotateLabel -> False]. The List*Plot function must fumble the RotateLabel option.

Show[
 ListLinewPlot[data, PlotTheme -> "Monochrome", AxesLabel -> " ", 
  LabelStyle -> {20}, PlotRange -> {{0, 1000}, {-100, 500}}, 
  PlotStyle -> {}],
 Frame -> True, FrameLabel -> {{"alpha^2", None}, {"alpha", None}}, 
 RotateLabel -> False]

enter image description here

The bug also arises in ListPlot, ListLogPlot, etc.

$\endgroup$
2
$\begingroup$

I am on V13.0.0

This is a peculiar behavior of ListLinePlot as far as I can tell. If I try the example from the docs it works fine.


Suggesting a workaround using Graphics


With

impData = {RandomReal[{-10, 10}, 100], RandomReal[{-10, 10}, 100]};

We do

p1 = ListLinePlot[impData,
   PlotTheme -> "Monochrome",
   PlotMarkers -> None,
   AxesLabel -> " ",
   Frame -> True,
   FrameLabel -> {"alpha", "alpha^2"},
   RotateLabel -> {False, False},
   LabelStyle -> {20},
   PlotRange -> All,
   PlotStyle -> {},
   ImageSize -> Large];

And then

Show[Graphics@p1, PlotTheme -> "Monochrome",
 PlotMarkers -> None,
 AxesLabel -> " ",
 Frame -> True,
 FrameLabel -> {"alpha", "alpha^2"},
 RotateLabel -> False,
 LabelStyle -> {20},
 PlotRange -> All,
 PlotStyle -> {},
 ImageSize -> Large]

to get

desiredoutput


On Version 12.0.0 there's no problem

bug?


$\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.