5
$\begingroup$

Say in

ListPlot[Range[0, 1, 0.1], Frame -> True]

enter image description here

I want the tick marks on the vertical axis to be rotated 90 degrees. How to do it automatically, preserving the sub-ticks?

It's of course doable with explicitly given FrameTicks, but then the sub-ticks need to be specified and it gets cumbersome. I'm looking for something like FrameTicks(Labels) -> {{Rotated,Automatic},{Automatic,Automatic}}, or something similar to RotateLabel.


$Version

"10.4.1 for Linux x86 (64-bit) (April 11, 2016)"

$\endgroup$
8
$\begingroup$
ListPlot[Range[0, 1, 0.1], Frame -> True, 
 FrameTicks -> {{Charting`ScaledTicks["Linear"][##] /. 
      {a_?NumericQ, b_, c___} :> {a, Rotate[b, 90 Degree], c} &, Automatic}, 
    {Automatic, Automatic}}, 
 ImagePadding -> Scaled[.02]]

enter image description here

Also

ListPlot[Range[0, 1, 0.1], Frame -> True, 
 FrameTicks -> {{MapAt[Rotate[#, 90 Degree] &, 
    Charting`FindTicks[{0, 1}, {0, 1}][##], {All, 2}] &, Automatic}, 
   {Automatic, Automatic}},
  ImagePadding -> Scaled[.02]]

same picture

This works in

 $Version

"11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)"

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