Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

範囲チャート

範囲チャートは、名前付きの値範囲の離散集合を表示します

Bar.cs
ScottPlot.Plot myPlot = new();

List<(string name, CoordinateRange range)> ranges =
[
    ("アフリカ", new(-35, 37)),
    ("南極大陸", new(-90, -60)),
    ("アジア", new(-11, 81)),
    ("ヨーロッパ", new(-36, 71)),
    ("北アメリカ", new(-7, 83)),
    ("南アメリカ", new(-56, 13)),
    ("オーストラリア", new(-47, -28)),
];
myPlot.Add.Ranges(ranges);

// 軸のスタイルを設定する
myPlot.Title("大陸の緯度範囲");
myPlot.Axes.Bottom.TickLabelStyle.Rotation = -45;
myPlot.Axes.Bottom.TickLabelStyle.Alignment = Alignment.MiddleRight;
myPlot.Axes.Bottom.MinimumSize = 100;

// 度記号付きの目盛りラベルを使用する
ScottPlot.TickGenerators.NumericAutomatic tickGen = new();
myPlot.Axes.Left.TickGenerator = tickGen;
tickGen.LabelFormatter = (x) => $"{x}º";

// 0 の位置に水平線を追加し、範囲プロットの背面へ移動する
var hl = myPlot.Add.HorizontalLine(0, 1, Colors.Black, LinePattern.DenselyDashed);
myPlot.MoveToBack(hl);

myPlot.SavePng("demo.png", 400, 300);
このレシピは、棒プロットカテゴリに含まれる多数のレシピの 1 つです