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

スケールをロックした円

円が常に円形に表示されるようにするには、座標系で常に正方形のピクセルを表示するよう強制する必要があります。これは、軸スケールのロックを有効にすることで実現できます。

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

Random rand = new(0);
for (int i = 0; i < 5; i++)
{
    myPlot.Add.Circle(
        xCenter: rand.Next(-10, 10),
        yCenter: rand.Next(-10, 10),
        radius: rand.Next(1, 7));
}

// ピクセルのスケール比を 1:1 に強制する
myPlot.Axes.SquareUnits();

myPlot.SavePng("demo.png", 400, 300);
このレシピは、Ellipse カテゴリにある多数のレシピの 1 つです