[BUG]: Create more spacing between chart scale lines
Description
The vertical and horizontal scale lines have different spacing between their values.
The horizontal ones need significantly more spacing between the label and the line. And the vertical ones could use some more space as well
Screenshots/Video
Steps to reproduce
This happens on every chart
Which one of these are you referring to?
- A difference between the values (0 to 10 vs 0 to 100)
- A difference in the pixel spacing between values
- The pixel spacing between the end of the number and the start of the line for the vertical axis
The pixel spacing between the end of the number and the start of the line for the vertical axis
I'm assuming it's this one @hatched is talking about. A couple things to note:
- The difference between horizontal and vertical comes from the bounding box browsers report for text, that in most cases has some extra padding on top and bottom, so that all characters have the same height bounding box even though some extend higher or lower than most. We probably don't want to assume anything about this, since not all tick labels are numbers.
- If you turn on ticks we add a little bit more space between the tick and label than we by default add just between labels and the edge of the plot area (which in this case is where the gridline ends, but it's also the farthest data points will be drawn). For example set
yaxis.ticklen=0.01, you won't see the tick but the labels will move away a few pixels. I don't recall anymore the logic behind that decision (which was probably made on the order of 12 years ago) but it seems reasonable to use the same offset whether ticks are shown or not.
Also note that in the meantime as a workaround you can use axis.ticklabelstandoff to add any extra padding you want.
Sorry the photo wasn't clear, For the circle there is a horizontal line that runs to the right of every value on the vertical axis.... that line is touching the last 0 in 100, 200, 300, etc...
The arrow is pointing how the horizontal axis does not have the vertical line touching it, but the vertical axis does have the line touching it.
I feel both of these should have a little more default space between the values and those horizontal and vertical rules.
As an aside, the horizontal rule sticks out further past the chart than the vertical rule does.... with these 3 things fixed it would look more polished out of the box. Thanks for the workaround @alexcjohnson !
the horizontal rule sticks out further past the chart than the vertical rule does
I don't think the gridlines extend past the chart at all - set some other plot_bgcolor if you want to see. Maybe what you're reacting to is that on certain charts (like the scatter plot you screenshotted) we pad the axis range by 5% in both x and y, and since most charts are wider than they are tall this results in more pixels of padding in the width than in height. This is very chart-type specific, some like line charts have no horizontal padding. We've long thought it would be nice to expose options to customize this padding, though it has yet to bubble up to the top of the heap. I suppose we could come up with some more nuanced default than just 5% - make a really huge chart for example and this feels excessive - but I also don't think equal pixels in x and y is the right answer, the larger dimension still probably wants more padding to look "right", even if linear scaling isn't the ideal.