|
Bugzilla – Bug 18 |
Can't add text label to ij.gui.Plot instance |
Last modified: 2008-12-15 11:26:14 CST |
| ⚠ |
NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug. The Fiji project now uses GitHub Issues for issue tracking. Please file all new issues there. |
|
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
This code generates a plot with random values: (import '(ij.gui Plot)) (let [plot (Plot. "The plot" "The X" "The Y" (float-array (range 30)) (float-array (map (fn [x] (rand)) (range 30))))] (doto plot (setSize 700 300) (setLimits 0 30 0 1) (setLineWidth 2) (show))) This other block does so but adding a text label: FAILS (import '(ij.gui Plot)) (let [plot (Plot. "The plot" "The X" "The Y" (float-array (range 30)) (float-array (map (fn [x] (rand)) (range 30))))] (doto plot (setSize 700 300) (setLimits 0 30 0 1) (setLineWidth 2) (addLabel 10 295 "Some label") (show))) ... with this exception: java.lang.IllegalArgumentException: Width (0) and height (0) must be > 0 (NO_SOURCE_FILE:0) at clojure.lang.Compiler.eval(Compiler.java:4008) at Clojure.Clojure_Interpreter$LispThread.parse(Clojure_Interpreter.java:331) at Clojure.Clojure_Interpreter$LispThread.run(Clojure_Interpreter.java:273) Caused by: java.lang.IllegalArgumentException: Width (0) and height (0) must be > 0 at java.awt.image.SampleModel.<init>(SampleModel.java:108) at java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:128) at java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:69) at java.awt.image.PixelInterleavedSampleModel.createCompatibleSampleModel(PixelInterleavedSampleModel.java:126) at ij.process.ImageProcessor.getIndexSampleModel(ImageProcessor.java:1724) at ij.process.ByteProcessor.createBufferedImage(ByteProcessor.java:98) at ij.process.ByteProcessor.createImage(ByteProcessor.java:82) at ij.process.ImageProcessor.drawString2(ImageProcessor.java:1007) at ij.process.ImageProcessor.drawString(ImageProcessor.java:978) at ij.process.ImageProcessor.drawString(ImageProcessor.java:1045) at ij.gui.Plot.addLabel(Plot.java:263) at user.eval__2477.invoke(Unknown Source) at clojure.lang.Compiler.eval(Compiler.java:3997) ... 2 more From outside Clojure, same behaviour. Trying to add the label after calling 'show' on the plot has the same behaviour.