■ Axis 클래스의 ManualTickPositions 메소드를 사용해 비 선형 눈금 간격을 설정하는 방법을 보여준다.
▶ MainForm.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
using System.Linq; using System.Windows.Forms; using ScottPlot; namespace TestProject { /// <summary> /// 메인 폼 /// </summary> public partial class MainForm : Form { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainForm() /// <summary> /// 생성자 /// </summary> public MainForm() { InitializeComponent(); Plot plot = new Plot(800, 600); double[] frequencyArray = { 50 , 63 , 80 , 100 , 125 , 160 , 200 , 250 , 315 , 400 , 500 , 630 , 800 , 1000, 1250, 1600, 2000, 2500, 3150, 4000, 5000 }; double[] positionArray = DataGen.Consecutive(frequencyArray.Length); string[] labelArray = frequencyArray.Select(x => x.ToString()).ToArray(); double[] amplitudeArray = { 23.9, 24.2, 24.3, 24.5, 25.3, 26.3, 27.6, 31.4, 33.7, 36 , 38.4, 42 , 43.5, 46.1, 48.8, 51.5, 53.2, 55 , 56.9, 58.7, 60.6 }; plot.AddScatter(positionArray, amplitudeArray); plot.XAxis.ManualTickPositions(positionArray, labelArray); plot.XAxis.TickLabelStyle(rotation : 90); plot.XAxis.SetSizeLimit(min : 50); plot.Title("진동 커플링"); plot.YLabel("진폭(dB)"); plot.XLabel("주파수(Hz)"); this.formsPlot.Reset(plot); this.formsPlot.Refresh(); } #endregion } } |