I am trying to obtain a thin frame around the bars in this chart but it's proving rather tricky. Can anyone suggest a solution?
size = {3, 12, 8, 0.5, 7, 5, 6, 7, 3, 4, 2};
bar[i_] := Inset[Graphics[{EdgeForm[{Thin, Black}],
FaceForm@LightBlue, Rectangle[{0, -1/2}, {size[[i]], 1/2}]},
PlotRange -> {{0, size[[i]]}, {(-1/2), 1/2}}],
{1, -(Length[size] - i + .5)}, {Left, Center}, size[[i]]];
Graphics[{LightYellow, Rectangle[{0, 0}, {15, -(Length[size] + 1)}],
Array[bar, Length[size]]},
PlotRange -> {{0, 15}, {0, -(Length[size] + 1)}}]
A second version has the same problem:
bar[i_] := Inset[Graphics[{LightBlue,
Rectangle[{0, -1/2}, {size[[i]], 1/2}]},
PlotRange -> {{0, size[[i]]}, {(-1/2), 1/2}},
Frame -> True, FrameTicks -> None, ImagePadding -> 0],
{1, -(Length[size] - i + .5)}, {Left, Center}, size[[i]]];
Edit
Thanks to Heike's comment I have something I can use:
size = {3, 12, 8, 0.5, 7, 5, 6, 7, 3, 4, 2};
bar[i_] := Rectangle[{1, -(i - 1)}, {size[[Length[size] + 1 - i]] + 1, -i}];
Graphics[{LightYellow, Rectangle[{0, 0}, {15, -(Length[size] + 1)}],
EdgeForm[{Thin, Black}], FaceForm@LightBlue,
Array[bar, Length[size]]},
PlotRange -> {{0, 15}, {0, -(Length[size] + 1)}}]
Inset
to place the individual bars in the yellow rectangle instead of usingRectangle
s directly? $\endgroup$