-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Description
Suggestion:
A multi-line title works fine. But a multi-line X-axis label does not work.
Here is what I have tried:
ScottPlot.Plot plt = new();
plt.ScaleFactor = 2;
plt.Clear();
double[] xs = new double[] { 1, 2, 3, 4, 5, 6, 7 };
double[] ys = new double[] { 2, 2, 3, 3, 3.8, 4.2, 4 };
// plot original data as a scatter plot
var scatter = plt.Add.Scatter(xs, ys);
scatter.LineWidth = 0;
scatter.MarkerSize = 10;
scatter.Axes.YAxis = plt.Axes.Right;
// calculate the regression line
ScottPlot.Statistics.LinearRegression reg = new(xs, ys);
// plot the regression line
Coordinates pt1 = new(xs.First(), reg.GetValue(xs.First()));
Coordinates pt2 = new(xs.Last(), reg.GetValue(xs.Last()));
var line = plt.Add.Line(pt1, pt2);
line.Color = Colors.Orange;
line.MarkerSize = 0;
line.LineWidth = 4;
line.LinePattern = LinePattern.Dashed;
line.Axes.YAxis = plt.Axes.Right;
var titleString = $"This is a three line title.\nAnd here is line two.\nAnd here is line three.";
plt.Title(titleString);
plt.Axes.Title.Label.FontName = "Verdana";
plt.Axes.Title.Label.FontSize = 12;
plt.Axes.Title.Label.Bold = false;
var descriptionString = $"But sadly a three line description does not work.\nAnd here is line 2.\nAnd here is line 3.";
plt.XLabel(descriptionString);
plt.Axes.Bottom.Label.FontName = "Verdana";
plt.Axes.Bottom.Label.FontSize = 12;
plt.Axes.Bottom.Label.Bold = false;
// Render the plot
plt.SavePng("../../../scatter_with_limit.png", 800, 800);Charles
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
