haifengl / smile

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

QQPlotDemo creates window with 0 size. #468

Closed meawoppl closed 4 years ago

meawoppl commented 4 years ago

Expected behaviour

I run the QQPlotDemo.java example to learn about the Smile framework's plotting and visualization capabilities. I expected a plot/window to come up.

Actual behaviour

Plot window comes up, but has width and height of 0. This is pretty confusing, and I missed it the first time thinking the program had hung:

image ( ^^ note micro window in center of screenshot)

Code snippet

https://github.com/haifengl/smile/blob/master/demo/src/main/java/smile/demo/plot/QQPlotDemo.java

Input data

N/A

Information


Gradle 5.5.1

Build time: 2019-07-10 20:38:12 UTC Revision: 3245f748c7061472da4dc184991919810f7935a5

Kotlin: 1.3.31 Groovy: 2.5.4 Ant: Apache Ant(TM) version 1.9.14 compiled on March 12 2019 JVM: 11.0.4 (Ubuntu 11.0.4+11-post-Ubuntu-1ubuntu218.04.3) OS: Linux 4.15.0-58-generic amd64

meawoppl commented 4 years ago

As a little background, I came to this indirectly trying to get smile to export images of plots/graphs. I lost quite a bit of time to strange assertions in BufferedImage complaining about height/width of 0, and eventually tracked it down here.

Adding a call to frame.setSize(800, 600) in the main() call of the above linked seems to make the demo work as expected, but I am still struggling to get image export to work. Would you be open to my contribution of an example of export somewhere in the demos?

haifengl commented 4 years ago

Sorry for the trouble. Did you try to QQPlotDemo directly? We might miss setting frame size in some of demo classes. If you run the "demo" command from Smile shell, all the demo frame size should be set properly.

meawoppl commented 4 years ago

I don't know what the smile shell is. I just copy-pasted the demo code to see if I could get the library working in my local build/dev environment.

haifengl commented 4 years ago

I have updated demos with JFrame.setSize() in v2 branch.

meawoppl commented 4 years ago

Ty!

On Tue, Oct 1, 2019, 19:07 Haifeng Li notifications@github.com wrote:

Closed #468 https://github.com/haifengl/smile/issues/468.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/haifengl/smile/issues/468?email_source=notifications&email_token=AAENRRWHM2VRKNUIBA3GOP3QMP64RA5CNFSM4I23I52KYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOT6XWPOQ#event-2679072698, or mute the thread https://github.com/notifications/unsubscribe-auth/AAENRRW3HTR2NNSBF6NHW2LQMP64RANCNFSM4I23I52A .