2
$\begingroup$

enter image description hereI wonder how to create a clock-model in Mathematica. I got this model image from a maths group, I am posting this for reference. I wish to create a clock model like this with any numbers. Any help would be appreciated. Thanks in advance

$\endgroup$
3
  • $\begingroup$ Point+Circle+Table+Text. Where are you stuck? $\endgroup$
    – Kuba
    Jun 16 '20 at 7:26
  • $\begingroup$ I am new to Mathematica coding, please help me. $\endgroup$
    – Shivam K
    Jun 16 '20 at 7:34
  • $\begingroup$ Take a look at mentioned symbols and Graphics and hit F1 for a start. $\endgroup$
    – Kuba
    Jun 16 '20 at 7:40
4
$\begingroup$

If you are lazy like me, you may consider ClockGauge:

SeedRandom[1]
labels = RandomInteger[50, 12]

labeling = AssociationThread[Range[12], labels]; 

ClockGauge[PlotTheme -> "Business", ImageSize -> Large, GaugeMarkers -> None, 
  LabelStyle -> Directive[FontColor -> Cyan, FontSize -> Scaled[.075]]] /. 
 Text[t_Integer, a___] :> Text[labeling @t, a]

![enter image description here

If you need a more/less serious look/feel consider

ClockGauge[PlotTheme -> "Scientific", ImageSize -> Large, 
  GaugeMarkers -> None,  GaugeLabels -> None, LabelStyle -> FontSize -> Scaled[.075]] /. 
 Text[t_Integer, a___] :> Text[labeling @ t, a]

enter image description here

ClockGauge[PlotTheme -> "Marketing", ImageSize -> Large, 
  GaugeMarkers -> None, LabelStyle -> FontSize -> Scaled[.075]] /. 
 Text[t_Integer, a___] :> Text[labeling @ t, a]

enter image description here

$\endgroup$
3
$\begingroup$
clock[radius_?NumericQ, innerFraction_?NumericQ, labels_?ListQ, fontStyles_?ListQ] := 
 Block[{points = RotationTransform[π - π/Length[labels]][
                  CirclePoints[Length@labels]*innerFraction]},
  Graphics[{
    Thick,
    Circle[{0, 0}, radius],
    MapThread[
     Style[Text[ToString[#1], #2], Sequence[fontStyles]] &,
     {Reverse@labels, points}],
    Disk[{0, 0}, radius/30]
  }]]

(* create a clock with some prime numbers *)
clock[1, 0.8, Prime /@ Range[12],
  {FontFamily -> "Courier", FontSize -> 18, FontWeight -> Bold}]

clock

$\endgroup$
1
  • $\begingroup$ This is very useful, thanks much. $\endgroup$
    – Shivam K
    Jun 16 '20 at 17:07

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.