Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to draw a simple line with some symbols, but so far have had no luck finding an easy way to do it in Mathematica. Does anyone know if Mathematica can easily implement e.g. the example below?

example

share|improve this question
1  
Try NumberLinePlot in Mathematica 10. –  Ernst Stelzer Aug 1 at 13:09

2 Answers 2

up vote 3 down vote accepted

Just to show some basics using Text, and Line:

text[s_String, s1_String, pos_] := {Text[s, {pos, .04}], Text[s1, {pos, -.04}]}
tick[pos_] := Line[{{pos, .01}, {pos, -.01}}]
Show[Graphics[{Line[{{0, 0}, {1, 0}}]}],
 Graphics[{
   text["", "0", 0], 
   text["σ2(m1)", "x/2", 1/4], 
   text["", "x/2+1/4", 2/4], 
   text["σ2(m2)", "x/2+1/2", 3/4],
   text["", "1", 1], 
   tick /@ Range[0, 1, 1/4]}]]

Mathematica graphics

share|improve this answer
    
Thanks, this is great. –  Tomaaat Aug 2 at 10:12

Just to give you an idea of what direction to go, try this:

 Show[{
  Graphics[{AbsoluteThickness[2], Line[{{0, 0}, {10, 0}}], 
    AbsoluteThickness[1], 
    Line[{Scaled[{0.25, 0.45}], Scaled[{0.25, 0.55}]}], 
    Line[{Scaled[{0.75, 0.45}], Scaled[{0.75, 0.55}]}]}],
  Graphics[{Text[
     Style["\!\(\*SubscriptBox[\(\[Sigma]\), \
\(2\)]\)(\!\(\*SubscriptBox[\(m\), \(1\)]\))", 12], 
     Scaled[{0.25, 0.8}]], 
    Text[Style[
      "\!\(\*SubscriptBox[\(\[Sigma]\), \
\(2\)]\)(\!\(\*SubscriptBox[\(m\), \(2\)]\))", 12], 
     Scaled[{0.75, 0.8}]]}]

  }]

which looks like this

enter image description here

Other elements you may draw by analogy. Have fun!

share|improve this answer
    
This is great. Thanks so much! –  Tomaaat Aug 2 at 10:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.