-
|
I want to change the way the values are shown visually, for example let's say the x axis displays 30 but I actually want to display that value divided by 3. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @ssalsinha, Manual LabelsThe best option you have today is to use manually-defined tick positions and labels: https://swharden.com/scottplot/cookbooks/4.1.14/category/advanced-axis-features/#manual-tick-labels var plt = new ScottPlot.Plot();
double[] yPositions = { -1, 0, 1, 2 };
string[] yLabels = { "a", "b", "c", "d" };
plt.YAxis.ManualTickPositions(yPositions, yLabels);Being able to write a custom function to transform a tick position/label into a different label based on custom logic came up recently (#926) and is a feature I hope to get to implementing eventually (#1028) Custom Function (new)plt.AddSignal(ScottPlot.DataGen.Sin(51));
plt.AddSignal(ScottPlot.DataGen.Cos(51));
static string customTickFormatter(double position)
{
if (position == 0)
return "zero";
else if (position > 0)
return $"+{position:F2}";
else
return $"({Math.Abs(position):F2})";
}
plt.XAxis.TickLabelFormat(customTickFormatter);
plt.YAxis.TickLabelFormat(customTickFormatter); |
Beta Was this translation helpful? Give feedback.

Hi @ssalsinha,
Manual Labels
The best option you have today is to use manually-defined tick positions and labels: https://swharden.com/scottplot/cookbooks/4.1.14/category/advanced-axis-features/#manual-tick-labels
Being able to write a custom function to transform a tick position/label into a different label based on custom logic came up recently (#926) and is a feature I hope to get to implementing eventually (#1028)
Custom Function (new)