3
$\begingroup$

I need to change the position of my axes labels such that the y-axis label is in the middle and parallel to the y-axis. Also, show the ticks 1000 in the axis, as shown in the picture. Here is my code:

p1 = 
  Plot[x, {x, 0, 1000}, 
    PlotRange -> {0, 1000},
    PlotStyle -> {RGBColor[0, 0, 0], Thickness[0.01]},
    PlotLegends -> {Style["Standard", 20]}];

p2 = 
  Plot[x^10/1000^9, {x, 0, 1000}, 
    PlotRange -> {0, 1000},
    PlotStyle -> {RGBColor[0.9, 0, 0], Thickness[0.01]},
    PlotLegends -> {Style["n=10", 20]}];

Show[p1, p2, 
  LabelStyle -> {FontSize -> 20, FontColor -> Black},
  AxesStyle -> Directive[Black, AbsoluteThickness[2], 
  Arrowheads[0.04]],
  TicksStyle -> Directive[Black, AbsoluteThickness[5]],
  ImageSize -> Large, 
  AxesLabel -> {"ρ", "f(ρ)"}]

enter image description here

$\endgroup$
5
$\begingroup$

I think this gives you pretty much everything you asked for.

Labeled[
  Plot[{x, x^10/1000^9}, {x, 0, 1000},
    PlotRange -> {0, 1000},
    PlotRangePadding -> {{Automatic, 125}, {20, 200}},
    PlotStyle ->
      {Directive[RGBColor[0, 0, 0], Thickness[0.01]], 
       Directive[RGBColor[0.9, 0, 0], Thickness[0.01]]},
    AxesStyle -> 
      Directive[Black, AbsoluteThickness[1.5], Arrowheads[Automatic]], 
    TicksStyle -> Directive[Black, AbsoluteThickness[5]], 
    PlotLegends -> {Style["Standard", 20], Style["n = 10", 20]},
    ImageSize -> 450],
  {Style["ρ", 20, Bold], Style["f(ρ)", 20, Bold]}, {Bottom, Left}]

plot

However, I think the plot would look better if custom ticks were used as well and if the axis arrows thickness were visually balanced.

ticks =
  {Table[{x, x, {.015, 0}}, {x, 200, 1000, 200}],
   Table[{y, y, {.015, 0}}, {y, 200, 1000, 200}]};

arrows =
  {Directive[AbsoluteThickness[1.6], Arrowheads[Automatic]],
   Directive[AbsoluteThickness[2], Arrowheads[Automatic]]};

Labeled[
  Plot[{x, x^10/1000^9}, {x, 0, 1000},
    PlotRange -> {0, 1000},
    PlotRangePadding -> {{Automatic, 125}, {20, 200}},
    PlotStyle ->
      {Directive[RGBColor[0, 0, 0], Thickness[0.01]], 
       Directive[RGBColor[0.9, 0, 0], Thickness[0.01]]},
    AxesStyle -> arrows,
    Ticks -> ticks, 
    TicksStyle -> Directive[Black, AbsoluteThickness[5]], 
    PlotLegends -> {Style["Standard", 20], Style["n = 10", 20]},
    ImageSize -> 500],
  {Style["ρ", 20, Bold], Style["f(ρ)", 20, Bold]}, {Bottom, Left}]

plot

$\endgroup$
  • $\begingroup$ Yes, I am woking on it, Thank you very much, the second one looks better. $\endgroup$ – Tingyun.Yin Nov 6 '17 at 13:04
4
$\begingroup$

Something like this:

Plot[{x, x^10/1000^9}, {x, 0, 1000}, 
PlotRange -> {{0, 1000}, {0, 1000}}, 
PlotStyle -> {{Black, Thickness[0.01]},{Red, Thickness[0.01]}} 
PlotLegends -> {Style["Standard", 20], Style["n=10", 20]}, 
FrameLabel -> {Style["\[Rho]", 14], Style["f(\[Rho])", 14]}, 
RotateLabel -> False, Frame -> {{True, False}, {True, False}}]

enter image description here

$\endgroup$
  • $\begingroup$ Yeah, Get it. Thanks a lot. $\endgroup$ – Tingyun.Yin Nov 6 '17 at 13:02

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.