
To create hatched rectangle primitives we can use the function hatchF
(from this answer and this answer to closely related questions).
ClearAll[hatchF]
hatchF[mf_List: {# &, #2 &}, mesh_List: {50, 50}, style_: GrayLevel[.5],
opts : OptionsPattern[]] := ParametricPlot[{x, y}, {x, 0, 1}, {y, 0, 1}, Mesh -> mesh,
MeshFunctions -> mf, MeshStyle -> style, BoundaryStyle -> None,
opts, Frame -> False, PlotRangePadding -> 0, ImagePadding -> 0, Axes -> False]
Use hatchF
to create two Graphics
objects
t1 = hatchF[{# - #2 &}, {30}, White, MeshShading -> {GrayLevel[.8], GrayLevel[.5]}];
t2 = hatchF[{# - #2 &, #2 + # &}, {30}, Directive[Thick, White],
MeshShading -> {{GrayLevel[.6], GrayLevel[.8]}}];
and take an image from ExampleData[]
t3 = ExampleData[{"ColorTexture", "Metal4"}];
We can use Texture[t1]
, Texture[t2]
, etc. as directives for styling individual data elements using Style[element1, Texture[t1]]
, Style[element2, Texture[t2]]
etc. Together with the built-in (but undocumented) function System`BarFunctionDump`TextureBar
used as the setting for ChartElementFunction
we get the desired styles for selected data elements.
BarChart[{{Style[0.25, Texture@ t1], 0.4, 0.15},
{0.172, Style[0.25, Texture@t3], Style[0.18, Texture@t2]}, {0.101, .26, 0.17}},
BarSpacing -> {0.15, 1},
ChartLegends -> {Text[Style["BXE", 12]], Text[Style["CXE", 12]],
Text[Style["TQ", 12]]}, ChartStyle -> "GrayTones",
LabelingFunction -> Above,
ChartLabels -> {{"Large", "Small", "Overall"}, None},
BaseStyle -> Directive[FontSize -> 11],
PlotLabel -> Style["Volume", FontSize -> 15],
ChartElementFunction -> System`BarFunctionDump`TextureBar]
gives the picture above.
ChartElementFunction
. $\endgroup$