1
$\begingroup$

I have this code:

Clear[r,\[Lambda],ref,c];
ft[\[Rho]_]=(((1-ref^2)/(Pi*ref))^2+(\[Rho]^4/(\[Lambda]*r^3))^2)^(-1/2);
\[Lambda]=685*10^-9;r=25*10^-3;c=3*10^8;ref=0.995;
p1=Plot[ft[\[Rho]*10^-3],{\[Rho],0,1},PlotRange->{{0,1},{0,350}},PlotTheme- 
>"Monochrome",PlotStyle->Blue, FrameStyle -> {{Blue, Automatic}, {Automatic, 
Automatic}},Frame -> {{True, False}, {True, True}},FrameTicksStyle -> 
Directive[16, FontFamily -> "Times"],AspectRatio->1/2,ImagePadding ->{{60, 
60}, {50, 10}},FrameLabel -> {{Style[Subscript[\[ScriptCapitalF],t], 
16,FontFamily -> "Times"],None},{Style["\[Rho] (mm)", 16,FontFamily -> 
"Times"],None}},ImageSize->400];
p2=LogPlot[(c/(4*r*ft[\[Rho]*10^-3]))/10^6,{\[Rho],0,1},PlotRange->{{0,1}, 
{0,350}},PlotTheme->"Monochrome",PlotStyle->Red, FrameStyle -> {{Automatic, 
Red}, {Automatic, Automatic}},Frame -> {{False, True}, {False, 
False}},FrameTicks -> {{None, All}, {None, None}},FrameTicksStyle -> 
Directive[16, FontFamily -> "Times"],AspectRatio->1/2,ImagePadding ->{{60, 
60}, {50, 10}},FrameLabel -> {{None,Rotate[Style[Subscript[\[CapitalDelta] \ 
[Nu] ,m] , 16,FontFamily -> "Times"],180 Degree]},{None,None}},ImageSize- 
>400];
Overlay[{p1,p2}]

Which generates this graph:

enter image description here

I want the red frame label to show as $\Delta\nu_{m}$ (MHz). How can I add the units without messing up the subscript?

$\endgroup$
  • 2
    $\begingroup$ You can use Row[{Subscript[...],...}] for that (see the documentation of Row for more details) $\endgroup$ – Lukas Lang Oct 8 at 14:13
3
$\begingroup$

As Lukas Lang points out, Row will allow you to achieve the label you want. Here is the code. Note that I have rewritten parts of it to make it simpler.

λ = 685.*^-9; r = 25.*^-3; c = 3.*^8; ref = 0.995;
ft[ρ_] = (((1 - ref^2)/(π ref))^2 + (ρ^4/(λ r^3))^2)^(-1/2);
p1 =
  Plot[ft[ρ 10^-3], {ρ, 0, 1},
    AspectRatio -> 1/2,
    PlotRange -> {{0, 1}, {0, 350}},
    PlotStyle -> Blue,
    FrameStyle -> {{Blue, Automatic}, {Automatic, Automatic}}, 
    Frame -> {{True, False}, {True, True}},
    FrameTicksStyle -> Directive[16, "TR"],
    FrameLabel ->
      Transpose[{Style[#, 16, "TR"] & /@ {Subscript[ℱ, t], "ρ (mm)"}, {None, None}}],
    ImagePadding -> {{60, 60}, {50, 10}},
    ImageSize -> 400];
p2 =
  LogPlot[(c/(4 r ft[ρ 10^-3]))/10^6, {ρ, 0, 1},
    AspectRatio -> 1/2,
    PlotStyle -> Red,
    FrameStyle -> {{Automatic, Red}, {Automatic, Automatic}}, 
    Frame -> {{False, True}, {False, False}},
    FrameTicks -> {{None, All}, {None, None}},
    FrameTicksStyle -> Directive[16, "TR"],
    FrameLabel ->
      {{None, Rotate[Style[Row[{Subscript[Δν, m], " (MHz)"}], 16, "TR"], 180 Degree]},
       {None, None}},
    ImagePadding -> {{60, 60}, {50, 10}},
    ImageSize -> 400];
Overlay[{p1, p2}]

plot

Note, in particular, the use of "TR", a handy short form of FontFamily -> "Times"

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