Qurak

Legend specific values

Example 4 steps, run in order in one session. Every step was executed against the engine and the output below is what it produced.

Step 1
data = {0.3, 0.3, 1.2, 0.8, 3.1, 1, 4, 0.1};

No output - this step sets something up for the next one.

Step 2
newdata = MapIndexed[If[# > Mean[data], Style[
	Legended[#, Row[{"bar", First[#2]}]], ColorData[63, First[#2]]], #]&, data];

No output - this step sets something up for the next one.

Step 3
styles = Sequence@@{ImageSize -> 400, ChartStyle -> Gray, GridLinesStyle -> Directive[AbsoluteThickness[3], LightGray]};

No output - this step sets something up for the next one.

Step 4
BarChart[newdata, ChartElementFunction -> "FadingRectangle", GridLines -> {None, {Mean[data]}}, Evaluate@styles, ChartLegends -> SwatchLegend[None, LegendMarkerSize -> 20, LegendMarkers -> "FadingRectangle", LabelStyle -> {Gray, Bold, 18}, LegendLabel -> "above mean"]]
Output
-Graphics-

Functions used

Related recipes

All recipes · Function reference · Use this from an MCP client