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.
bar = VerticalGauge[#, {0, 100}, GaugeMarkers -> "ScaleRange", 
    GaugeStyle -> {Darker@Green, GrayLevel[0.95]}, TicksStyle -> None,
     GaugeFrameSize -> None, ScalePadding -> 0, ImageSize -> 50, 
    AspectRatio -> 1, LabelStyle -> None, 
    Epilog -> Text[Style[#, FontSize -> 15], Scaled[{0.5, 0.5}]]] &;

Grid[Map[bar, RandomInteger[{10, 90}, {4, 4}], {2}], Frame -> All, 
 Spacings -> {0, 0}]

How can I remove the tiny space visible around each cell? Using Spacings -> {0, 0} does not seem to work.

Thanks.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

This is my first time using VerticalGauge, but I notice it's Graphics-based.

Add ImagePadding -> 0 and PlotRangePadding -> 0 as options to it and all the space will be gone.

As a downside, the grid cell contents will cover up the frame too. You could use Frame -> True and FrameTicks -> False in VerticalGauge to work around this.

enter image description here


bar = VerticalGauge[#, {0, 100}, GaugeMarkers -> "ScaleRange", 
    GaugeStyle -> {Darker@Green, GrayLevel[0.95]}, TicksStyle -> None,
     GaugeFrameSize -> None, ScalePadding -> 0, ImageSize -> 50, 
    AspectRatio -> 1, LabelStyle -> None, 
    Epilog -> Text[Style[#, FontSize -> 15], Scaled[{0.5, 0.5}]],
    ImagePadding -> 0, PlotRangePadding -> 0] &;

Grid[Map[bar, RandomInteger[{10, 90}, {4, 4}], {2}], Spacings -> {0, 0}]
share|improve this answer
1  
Could you please post actual Mathematica code instead of an image? Let's encourage newer users by good example. –  RunnyKine Feb 5 at 1:57
    
Your solution works. Thanks! –  dabd Feb 5 at 2:08
    
@RunnyKine The image was an afterthought. I didn't post any code initially. I think sometimes it's better to focus on the actual changes than re-post a large block of already available complex code which distracts from the point. –  Szabolcs Feb 5 at 2:29

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.