plotters-rs/plotters

[BUG] Labels in histogram seems to have their anchor set to Center and don't accept new values

jbiason opened this issue · 3 comments

Describe the bug
I'm trying to make an histogram with some large number of data entries, and I feel rotating the text would suffice.

The initial problem is that the text gets centered around the bottom of the graph, like this:

image

I'd expect moving the x_label_style would work, but no matter what options I use for the positioning, the label always appear in the same place.

As a test, I tried to plot the labels without the rotation, with the anchor set to HPos:Left. I'd expect that the text would start at the rectangle position and expand to the right; my understanding is that I have a "position" for the label that it is in the same position of the X Mesh point and if the text anchor is Left, it should start there and move to the right (Center would put the label text centered in the X mesh position), but I actually get this:

image

While the labels are overlapping, one can see that the labels goes to the left to the initial point, which shouldn't be possible.

To Reproduce
I have the whole thing -- with lots of entries -- here: https://github.com/jbiason/random/blob/master/plotterstest/src/main.rs

Version Information
0.3.4

Hello @jbiason, have you been able to resolve this? I also tried different anchor position‒Left, Center, Right‒and the result doesn't change.

I skimmed over the code to figure out why it doesn't respect the anchor, but it's a bit too complex to understand in less than 15 minutes :)

Same here: I have pretty long X labels and rotating even a built-in 30 or 45 degrees would be great 👍