[
https://issues.apache.org/jira/browse/MAHOUT-1842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15265605#comment-15265605
]
ASF GitHub Bot commented on MAHOUT-1842:
----------------------------------------
Github user andrewpalumbo commented on a diff in the pull request:
https://github.com/apache/mahout/pull/230#discussion_r61679453
--- Diff:
math-scala/src/main/scala/org/apache/mahout/visualization/MahoutPlot.scala ---
@@ -18,7 +18,36 @@
package org.apache.mahout.visualization
+import java.awt.Graphics2D
+import java.awt.image.BufferedImage
+import java.io.File
+import javax.imageio.ImageIO
+import javax.swing.JFrame
-trait mlpot {
+import org.apache.mahout.math.Matrix
+import smile.plot.{PlotCanvas, PlotPanel}
+
+
+trait MahoutPlot {
+
+ var canvas : PlotCanvas = _
+ var plotPanel: PlotPanel = _
+ var plotFrame: JFrame = _
+ var mPlotMatrix: Matrix = _
+ def contentPane = canvas
+
+ // export a PNG of the plot to /tmp/test.png
+ def exportPNG(path: String ="/tmp/test.png") = {
+ val bi: BufferedImage =
+ new BufferedImage(contentPane.getWidth, contentPane.getHeight,
BufferedImage.TYPE_INT_ARGB)
+
+ val g2d: Graphics2D = bi.createGraphics
+
+ contentPane.printAll(g2d)
+
+ val file: File = new File(path)
+
+ ImageIO.write(bi, "PNG", file)
+ }
--- End diff --
@pferrel Setup to easily export plot PNGs to the Filesystem. Maybe we can
we can pipe these to the Zeppelin server via JSON?
> SImple 3d surface plots
> -----------------------
>
> Key: MAHOUT-1842
> URL: https://issues.apache.org/jira/browse/MAHOUT-1842
> Project: Mahout
> Issue Type: Sub-task
> Affects Versions: 0.12.0
> Reporter: Andrew Palumbo
> Fix For: 0.13
>
>
> Create a class {{msurf}} which will fit accept a mx3 DRM and a sample
> percentage and create a 3d surface plot of the sampled points.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)