Skip to content

SP4: Margin error between axis label & tick labels when using ManualTickPositions #2605

@szescxz

Description

@szescxz

Bug Report

Issue:

A.jpg B.jpg

Similar to #699? Seems like my issue is a duplicate of #2603. Right now I'm using suggestions at #699 (comment) as a workaround.

Reproducing:

using ScottPlot;
Plot plot;

plot = new Plot();
plot.Title("Automatic Tick Positions");
plot.LeftAxis.Label("Left Axis Label", size: 50);
plot.LeftAxis.TickLabelStyle(fontSize: 50);
plot.SaveFig("A.jpg");

plot = new Plot();
plot.Title("Manual Tick Positions");
plot.LeftAxis.Label("Left Axis Label", size: 50);
plot.LeftAxis.TickLabelStyle(fontSize: 50);
plot.LeftAxis.ManualTickPositions(new double[] { 10, 0, -10 }, new string[] { "10", "0", "-10" });
plot.SaveFig("B.jpg");

System Details

  • ScottPlot Version: 4.1.63
  • Operating System: Windows 11
  • Application Type: console
  • .NET Version: .NET 6.0

Another related bug that might also worth noting

If I comment out the second plot = new Plot(); then the margin is "correct", however I'm still feeling off about this:

using ScottPlot;
Plot plot;

plot = new Plot();
plot.Title("Automatic Tick Positions");
plot.LeftAxis.Label("Left Axis Label", size: 50);
plot.LeftAxis.TickLabelStyle(fontSize: 50);
plot.SaveFig("A.jpg");

//plot = new Plot();
plot.Title("Manual Tick Positions");
plot.LeftAxis.Label("Left Axis Label", size: 50);
plot.LeftAxis.TickLabelStyle(fontSize: 50);
plot.LeftAxis.ManualTickPositions(new double[] { 10, 0, -10 }, new string[] { "10", "0", "-10" });
plot.SaveFig("B.jpg");

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGunexpected behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions