plotters-rs / plotters

A rust drawing library for high quality data plotting for both WASM and native, statically and realtimely 🦀 📈🚀
https://plotters-rs.github.io/home/
MIT License
3.88k stars 281 forks source link

[BUG] `split_horizontally` & `split_vertically` produce wrong subplots positions when used in `evcxr` #486

Closed wiseaidev closed 10 months ago

wiseaidev commented 1 year ago

Describe the bug

Hello, friends! Well, first of all, thanks for this awesome crate. While building this notebook, I noticed that split_horizontally produces wrong subplots positions.

To Reproduce

Go to this notebook and scroll all the way to the 2. Using split_horizontally section. The split_horizontally function is supposed to produce the same image as split_evenly((1,2)), amirite? However, it is not the case. Take a look at the screenshot below. Screenshot from 2023-07-18 19-16-46

Version Information

:dep plotters = { version = "^0.3.5", default_features = false, features = ["evcxr", "all_series", "all_elements"] }
AliMMehr commented 1 year ago

.split_horizontally() receives the size of the left section in pixels. That's why calling .split_horizontally() with a value of 2 doesn't really make sense. In your case, you want to do something like .split_horizontally(320).

wiseaidev commented 10 months ago

Thanks for the help @AliMMehr! I first thought the argument is the number of columns in the graph, 2.