Qurak

Legend specific values

Esempio 4 passi, eseguiti in ordine in una sola sessione. Ogni passo è stato eseguito sul motore e l'output qui sotto è ciò che ha prodotto.

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

Nessun output - questo passo prepara qualcosa per il successivo.

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

Nessun output - questo passo prepara qualcosa per il successivo.

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

Nessun output - questo passo prepara qualcosa per il successivo.

Passo 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-

Funzioni usate

Ricette correlate

Tutte le ricette · Guida delle funzioni · Usa questo da un client MCP