7
$\begingroup$

I found a clock-diagram in a paper, so I would like to draw it in Mathematica. The main trouble for me is the corresponding line segments on the circle.

I would let the data1 lie the outside on the circle, and data2 lie the inside of the circle.

enter image description here

data1 = Range[0, 1, 0.2]
data2 = Range[0, 1, 0.15]

Graphics[{Circle[{0, 0}, 2], Line[{{0, 0.8}, {0, 1.2}}], 
 Text[Style["0", 20], {0, 0.65}], 
 Arrow[Reverse@Table[{Cos[t], Sin[t]}, {t, -Pi, Pi/2, 0.1}]]}]

enter image description here

$\endgroup$
7
$\begingroup$

You can change the line position and arc distances, I take this to be the correct configuration, though the inital image has weird proportions.

Graphics[{Circle[{0, 0}, 2], Line[{{0, 0.8}, {0, 1.2}}], 
  Arrow[Reverse@Table[{Cos[t], Sin[t]}, {t, -Pi, Pi/2, 0.1}]], 
  Table[Line[{{2 Sin[θ], 
      2 Cos[θ]}, {(2 + 
         0.2 (-1)^(θ 12/Pi)) Sin[θ], (2 + 
         0.2 (-1)^(θ 12/Pi)) Cos[θ]}}], {θ, 0, 
    2 π, π/12}], Text[Style[0, Large], {0, 0.6}]}]

enter image description here

Note that the line segments alternate in and out, simply change all the 12 to whatever number to increase or decrease the amounts of lines.

$\endgroup$
13
$\begingroup$

In case you're not familiar with the Gauges in Mathematica:

Show[{
  AngularGauge[.7, {0, 1}, 
    GaugeMarkers -> Placed[Automatic, "ScaleRange"], 
    ScaleOrigin -> {π/2, -3π/2}, 
    GaugeStyle -> {Directive[Blue, Opacity[0.5]], None}, 
    GaugeFrameStyle -> Directive[GrayLevel[.5]], 
    GaugeFrameSize -> .02],
  Graphics[
   {Directive[Red],
    Table[Line[{1.1 {Cos[θ], Sin[θ]}, 1.15 {Cos[θ], Sin[θ]}}], {θ, 0, 2π, π/6}] }]
  }]

enter image description here

$\endgroup$
7
$\begingroup$
Graphics[{
  Circle[{0, 0}, 2],
  Line[{{0, 0.8}, {0, 1.2}}],
  Arrow[Reverse@Table[{Cos[t], Sin[t]}, {t, -Pi, Pi/2, 0.1}]],
  Rotate[Line[{{0, 2}, {0, 2.2}}], 2 Pi # , {0, 0}] &  /@ 
   Range[0, 1, 1/12],
  Rotate[Line[{{0, 1.8}, {0, 2}}], 2 Pi # , {0, 0}] &  /@ 
   Range[1/24, 23/4, 1/12]
  }]

enter image description here

$\endgroup$
  • $\begingroup$ My initial answer may have let my error slip into your code too. The inner lines are displaced with $\frac{\pi}{12}$ $\endgroup$ – Feyre Oct 30 '16 at 13:46
  • $\begingroup$ @Feyre Corrected, Thanks ! $\endgroup$ – andre314 Oct 30 '16 at 14:58
5
$\begingroup$
data1 = Range[0, 1, 0.2]
data2 = Range[0, 1, 0.15]

 Graphics[{Circle[{0, 0}, 2], Line[{{0, 0.8}, {0, 1.2}}], 
  Arrow[Reverse@Table[{Cos[t], Sin[t]}, {t, -π, π/2, 0.1}]], 
  Red, Line[{{2 Cos[-(2 π # - π/2)], 2 Sin[-(2 π # - π/2)]}, 
        {2.2 Cos[-(2 π # - π/2)], 2.2 Sin[-(2 π # - π/2)]}}] & /@ data1,
  Blue, Line[{{1.8 Cos[-(2 π # - π/2)], 1.8 Sin[-(2 π # - π/2)]}, 
        {2 Cos[-(2 π # - π/2)], 2 Sin[-(2 π # - π/2)]}}] & /@ data2,
   Text[Style[0, Large], {0, 0.6}]}]

enter image description here

Other data

data1 = {0.0838886, 0.188029, 0.27299, 0.351457, 0.425728, 0.5, 
 0.574272, 0.648543, 0.722815, 0.801282, 0.886242, 0.990383}

data2 = {0, 0.0742716, 0.202914, 0.277185, 0.351457, 0.425728, 0.5, 
  0.574272, 0.648543, 0.722815, 0.797086, 0.871358}

enter image description here

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