TransWikia.com

Problem with one axis title in a plot

Mathematica Asked on April 26, 2021

If I have the following code:

ListLinePlot[
 {{{0, 25}, {1, 200}, {2, 200}, {3, 0}}, {{2, 200}, {3, 0}, {4, 
    200}, {5, 200}, {6, 0}, {7, 200}}}, ImageSize -> Large, 
 Axes -> False, Frame -> {{True, False}, {True, False}}, 
 FrameLabel -> {Style["Time (s)", 20, Bold], 
   Style["T ([Degree]C)", 20, Bold]}, FrameStyle -> Black, 
 FrameTicks -> {{{{0, 0, {0.015, 0}}, {25, 25, {0.015, 0}}, {200, 
      "!(*SubscriptBox[(T), (m)]) or 
!(*SubscriptBox[(T), (mx)])+ 10", {0.015, 0}}}, None}, {None, 
    None}}, FrameTicksStyle -> Directive[Bold, 16], 
 PlotStyle -> {Blue, {Blue, Dashed}}, PlotRange -> {All, {0, 250}},
 
 Epilog -> {
   Text[Style["1 min", 18], {#, 205}] & /@ {1.5, 4.5},
   Text[Rotate[Style["[Beta] = 10 K/min", 20], 75 Degree], {#, 
       100}] & /@ {0.25},
   Text[Rotate[Style["[Beta] = 30 K/min", 20], 77 Degree], {#, 
       100}] & /@ {3.35, 6.35}, 
   Text[Rotate[Style["q = 30 K/min", 20], -77 Degree], {#, 
       100}] & /@ {2.3, 5.3},
   
   Inset[Column[{
      
      LineLegend[{Blue}, {"1"}, {LegendMarkerSize -> 
         15}, {LabelStyle -> 15}]}], Scaled[{0.08, 0.98}]],
   
   Inset[Column[{
      
      LineLegend[{Directive[Dashed, 
         Blue]}, {"2"}, {LegendMarkerSize -> 
         15}, {LabelStyle -> {15}}]}], Scaled[{0.08, 0.9}]]
   
   
   }]

Which gives (without the ugly red circles):

enter image description here

How can I make the Temperature (denoted by one of the red circles) move closer to the axis (denoted by the other red circle)?

One Answer

You can use a rotated Tick to replace the FrameLabel

Clear["Global`*"]

ListLinePlot[{{{0, 25}, {1, 200}, {2, 200}, {3, 0}}, {{2, 200}, {3, 0}, {4, 
    200}, {5, 200}, {6, 0}, {7, 200}}},
 ImageSize -> Large,
 Axes -> False,
 Frame -> {{True, False}, {True, False}},
 FrameLabel -> {Style["Time (s)", 20, Bold], None},
 FrameStyle -> Black,
 FrameTicks -> {{{{0, 0, {0.015, 0}}, {25, 25, {0.015, 0}},
     {100, 
      Rotate[Style["T (°C)n", 20, Bold], 90 Degree], {0, 0}}, {200, 
      "!(*SubscriptBox[(T), (m)]) or n!(*SubscriptBox[(T), 
(mx)])+ 10", {0.015, 0}}}, None}, {None, None}},
 FrameTicksStyle -> Directive[Bold, 16],
 PlotStyle -> {Blue, {Blue, Dashed}},
 PlotRange -> {All, {0, 250}},
 Epilog -> {
   Text[Style["1 min", 18], {#, 205}] & /@ {1.5, 4.5},
   Text[Rotate[Style["β = 10 K/min", 20], 75 Degree], {#, 
       100}] & /@ {0.25},
   Text[Rotate[Style["β = 30 K/min", 20], 77 Degree], {#, 
       100}] & /@ {3.35, 6.35},
   Text[Rotate[Style["q = 30 K/min", 20], -77 Degree], {#, 100}] & /@ {2.3, 
     5.3},
   Inset[Column[{LineLegend[{Blue}, {"1"}, {LegendMarkerSize -> 
         15}, {LabelStyle -> 15}]}], Scaled[{0.08, 0.98}]],
   Inset[Column[{LineLegend[{Directive[Dashed, 
         Blue]}, {"2"}, {LegendMarkerSize -> 15}, {LabelStyle -> {15}}]}], 
    Scaled[{0.08, 0.9}]]}]

enter image description here

Correct answer by Bob Hanlon on April 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP