Qurak

Legend specific values

4 ステップを1つのセッション内で順に実行します。各ステップはエンジンで実行済みで、以下の出力は実際に生成されたものです。

ステップ 1
data = {0.3, 0.3, 1.2, 0.8, 3.1, 1, 4, 0.1};

出力なし - このステップは次のステップの準備をします。

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

出力なし - このステップは次のステップの準備をします。

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

出力なし - このステップは次のステップの準備をします。

ステップ 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"]]
出力
-Graphics-

使用する関数

関連レシピ

すべてのレシピ · 関数リファレンス · MCPクライアントから使う