Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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"]
share|improve this question
up vote 1 down vote accepted

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

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

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.