Closed arctic-alpaca closed 2 years ago
Hi, thanks for reporting this. I've looked into it, I feel this is a bug which caused by a 1px offset of plotting area. This is most likely link to issue #165
The reason why this is happening is Plotters actually checks if the label is out of change of the subplot
But at this point, the relative position is -1 (which should be 0) that causes Plotters drop the top label - but previously I haven't realize this is actually a bug.
Meanwhile a temporary workaround would be instead of using 0..10
, use 0..11
with the same key point vec.
Thanks again for reporting this!
Hi there, just verified this is fixed by the commit I pushed. Close the issue for now.
I tried this method and find that it worked for integer coord, but didn't work for f64 coord. The error occured:
The following is the code I used:
evcxr_figure((640, 240), |root| {
let mut chart = ChartBuilder::on(&root).x_label_area_size(40).y_label_area_size(40)
.build_cartesian_2d(
(0.0..100.0).with_key_points(vec![-5.0, 0.0, 10.0,20.0,50.0,90.0]), // <= This line will make the plot shows 4 tick marks at 1, 20, 50, 90
0..10
).unwrap();
chart.configure_mesh()
.x_desc("X")
.y_desc("Y")
.y_labels(10)
.light_line_style(&TRANSPARENT)
.label_style(("sans-serif", 15, &BLACK).into_text_style(&root)) // εζ ζ ηΎε±ζ§
//.x_label_formatter(&|v| format!("{:.1}", v))
//.y_label_formatter(&|v| format!("{:.1}", v))
.disable_x_mesh()
.draw().unwrap();
Ok(())
}).style("width:60%")
Hello, I couldn't find a way to draw the top most label on the y axis. The
.with_key_points
method seems to ignore the top most label. When usingin the histogram example , 10 still doesn't get printed on the y axis. Is this a current limitation of the library or did I miss something?