haifengl / smile

Statistical Machine Intelligence & Learning Engine
https://haifengl.github.io
Other
6.05k stars 1.13k forks source link

smile.plot.swing.BarPlot works with smile-plot 3.0.2 but not with 3.1.0 #768

Closed appsofteng closed 7 months ago

appsofteng commented 7 months ago

With smile-plot 3.0.2 it works as I understand the API description, but with smile-plot 3.1.0 it throws an exception. I read there was a change:

BarPlot.getUpperBound() computes wrong bound. #752.

What should the code look like to work with smile-plot 3.1.0? Thank you.

new BarPlot(new Bar(new double[][] { { 1, 1 } }, 1, Color.RED),
    new Bar(new double[][] { { 2, 2 } }, 1, Color.BLUE)).canvas().window();

smile-plot 3.0.2 image

smile-plot 3.1.0

Exception in thread "main" java.lang.IllegalArgumentException: Lower bound is larger than upper bound.
    at smile.plot.swing.Base.<init>(Base.java:94)
    at smile.plot.swing.Canvas.initBase(Canvas.java:169)
    at smile.plot.swing.Canvas.<init>(Canvas.java:106)
    at smile.plot.swing.Canvas.<init>(Canvas.java:99)
    at smile.plot.swing.BarPlot.canvas(BarPlot.java:107)
haifengl commented 7 months ago

Thanks for reporting. The fix is in master branch now. Please have a try.

haifengl commented 6 months ago

v3.1.1 is released including the fix. Please let's know if it addresses the issue. Thanks!