1
$\begingroup$

I would like to align the text in the gauge such as the label "AKs" is in the center of the gauge and the value (60) is in the upper right corner with a smaller font. How can I achieve this? I tried playing with the Alignment option and SpanFromLeft and related functions with no success.

Thanks.

bar = VerticalGauge[#1, {0, 100}, GaugeMarkers -> "ScaleRange", 
    GaugeStyle -> {Green, GrayLevel[1]}, 
    TicksStyle -> None, GaugeFrameSize -> None, ScalePadding -> None, 
    ImageSize -> 50, AspectRatio -> 1, LabelStyle -> None, 
    Epilog -> 
     Text[Grid[{{"", Style[#1, Italic, Small]}, {Style[#2, Bold], 
         ""}}], Scaled[{0.5, 0.5}]], ImagePadding -> 0, 
    PlotRangePadding -> 0, Frame -> True, FrameTicks -> False] &;
bar[60, "AKs"]
$\endgroup$
1
$\begingroup$

Is this what you are after?

bar = VerticalGauge[#1, {0, 100}, GaugeMarkers -> "ScaleRange", TicksStyle -> None, 
                        GaugeFrameSize -> None, ScalePadding -> None, ImageSize -> 150, 
                        AspectRatio -> 1, LabelStyle -> None, ImagePadding -> 0, 
                        PlotRangePadding -> 0, Frame -> True, FrameTicks -> False,
                        Epilog -> {Text[Style[#2, 25, Bold], Center], 
                                   Text[Style[#, 15], {Right, Top}, {Right, Top}]}, 
       ] &;
bar[50, "AKs"]

enter image description here

$\endgroup$
  • $\begingroup$ Yes perfect! Thanks. I didn't know how to specify the Epilog. $\endgroup$ – dabd Feb 6 '14 at 4:05
  • $\begingroup$ @dabd Think about Epilog->stuff like it is just Graphics[stuff]. Good luck. $\endgroup$ – Kuba Feb 6 '14 at 7:42

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.