Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting formula into plot

What's a standard way to insert formula into Plot?

My plot is below. I'd like to have the formula of the plot nicely formatted and inserted into plot. TraditionalForm looks OK, but it puts the formula in one line, whereas I want a two-line fraction.

Plot[{1, (\[CapitalDelta] - 1)^(\[CapitalDelta] - 
   1)/(\[CapitalDelta] - 2)^\[CapitalDelta]}, {\[CapitalDelta], 3, 6},
  PlotRange -> {0, 4}, PlotStyle -> {Dashing[.02], Thick}, 
 AxesLabel -> {"\[CapitalDelta]", "\[Lambda]"}]
like image 909
Yaroslav Bulatov Avatar asked Feb 12 '11 22:02

Yaroslav Bulatov


2 Answers

Sorry for being late :D. I mostly use a simplified version of Leonid's answer. Not sure if it is general enough for any purpose, but certainly works here.

Plot[{1, (\[CapitalDelta] - 1)^(\[CapitalDelta] - 
      1)/(\[CapitalDelta] - 2)^\[CapitalDelta]}, {\[CapitalDelta], 3, 
  6}, PlotRange -> {0, 4}, PlotStyle -> {Dashing[.02], Thick}, 
 AxesLabel -> {"\[CapitalDelta]", "\[Lambda]"}, 

Epilog -> Inset[HoldForm@TraditionalForm[

   (\[CapitalDelta] - 1)^(\[CapitalDelta] - 1)/
   (\[CapitalDelta] - 2)^\[CapitalDelta]]]]  

enter image description here

Or use Epilog -> Inset[Panel@HoldForm@TraditionalForm... for a nice box around the function:

enter image description here

like image 83
Dr. belisarius Avatar answered Oct 09 '22 10:10

Dr. belisarius


Perhaps this could get you started?

Plot[{1,(\[CapitalDelta]-1)^(\[CapitalDelta]-1)/(\[CapitalDelta]-2)^\[CapitalDelta]}, 
{\[CapitalDelta],3,6},PlotRange->{0,4},
PlotStyle->{Dashing[.02],Thick},AxesLabel->{"\[CapitalDelta]","\[Lambda]"},
Epilog->Inset[Style[
   HoldForm@@MakeExpression@MakeBoxes@TraditionalForm[(\[CapitalDelta]-1)^
   (\[CapitalDelta]-1)/(\[CapitalDelta]-2)^\[CapitalDelta]],10]]]
like image 43
Leonid Shifrin Avatar answered Oct 09 '22 11:10

Leonid Shifrin