You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PlotUi::set_plot_bounds and PlotUi::translate_bounds do not change Plot bounds properly.
To Reproduce
Steps to reproduce the behavior:
Run the following code without persistence (which tends to hide the problem):
let sin:PlotPoints = (0..1000).map(|i| {let x = i asf64*0.01;[x, x.sin()]}).collect();let line = Line::new(sin);Plot::new("my_plot").view_aspect(2.0).allow_boxed_zoom(false).allow_double_click_reset(false).allow_drag(false).allow_scroll(false).allow_zoom(false).show(ui, |plot_ui| {
plot_ui.set_plot_bounds(PlotBounds::from_min_max([-1., -1.],[1.,1.]));
plot_ui.line(line)});
Expected behavior
I'd expect the plot to have [-1., -1.], [1., 1.] bounds, however it defaults to showing the whole line as is the default behavior.
Screenshots
Desktop:
OS: Ubuntu
Version: 22.04
Additional context
After some digging, I found out that the PlotUi::set_plot_bounds and PlotUi::translate_bounds do not enable the bounds_modified variable, which then makes PlotUi fall back to min_auto_bounds. (see here)
I have a fix that I will share with a PR.
The text was updated successfully, but these errors were encountered:
Bug still present in latest master ✅
Describe the bug
PlotUi::set_plot_bounds
andPlotUi::translate_bounds
do not change Plot bounds properly.To Reproduce
Steps to reproduce the behavior:
Expected behavior
I'd expect the plot to have
[-1., -1.], [1., 1.]
bounds, however it defaults to showing the whole line as is the default behavior.Screenshots
Desktop:
Additional context
After some digging, I found out that the
PlotUi::set_plot_bounds
andPlotUi::translate_bounds
do not enable thebounds_modified
variable, which then makesPlotUi
fall back tomin_auto_bounds
. (see here)I have a fix that I will share with a PR.
The text was updated successfully, but these errors were encountered: