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

$\endgroup$

1 Answer 1

2
$\begingroup$

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}]
$\endgroup$
3
  • 1
    $\begingroup$ Could you please post actual Mathematica code instead of an image? Let's encourage newer users by good example. $\endgroup$
    – RunnyKine
    Feb 5, 2014 at 1:57
  • $\begingroup$ Your solution works. Thanks! $\endgroup$
    – dabd
    Feb 5, 2014 at 2:08
  • $\begingroup$ @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. $\endgroup$
    – Szabolcs
    Feb 5, 2014 at 2:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.