Skip to content

Vertical Tick labels with new lines render on top of each other #3673

@aespitia

Description

@aespitia

Vertical Tick labels with new lines render on top of each other.

ScottPlot Version: 5.0.26

ScottPlot.Plot myPlot = new();

myPlot.Add.Bar(position: 1, value: 5);
myPlot.Add.Bar(position: 2, value: 7);
myPlot.Add.Bar(position: 3, value: 6);
myPlot.Add.Bar(position: 4, value: 8);

Tick[] ticks =
{
	new(1, "Apple\nNewLine\nGoes here"),
	new(2, "Orange"),
	new(3, "Pear"),
	new(4, "Banana"),
};

myPlot.Axes.Bottom.TickGenerator = new ScottPlot.TickGenerators.NumericManual(ticks);
myPlot.Axes.Bottom.MajorTickStyle.Length = 0;
myPlot.Axes.Bottom.TickLabelStyle.Rotation = 90;
myPlot.HideGrid();

// tell the plot to autoscale with no padding beneath the bars
myPlot.Axes.Margins(bottom: 0);

myPlot.SavePng("demo.png", 400, 300);

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions