Package elki.visualization.silhouette
Class SilhouettePlot
- java.lang.Object
-
- elki.visualization.silhouette.SilhouettePlot
-
public class SilhouettePlot extends java.lang.Object
Class to produce an Silhouette plot image.- Since:
- 0.8.0
- Author:
- Robert Gehde
-
-
Field Summary
Fields Modifier and Type Field Description (package private) StylingPolicy
colors
Color adapter to use(package private) int
height
Height of plotprivate static Logging
LOG
Loggerprivate static int
MAX_HEIGHT
Minimum and maximum vertical resolution.private static int
MIN_HEIGHT
Minimum and maximum vertical resolution.protected java.awt.image.RenderedImage
plot
The Silhouette plot.protected int
plotnum
The plot number for Batik(package private) double
ratio
Ratio of plot(package private) LinearScale
scale
Scale to use(package private) DoubleDBIDList[]
silhouettes
The silhouette values.(package private) int
width
Width of plot
-
Constructor Summary
Constructors Constructor Description SilhouettePlot(DoubleDBIDList[] silhouettes, StylingPolicy colors)
Constructor, with automatic distance adapter detection.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected LinearScale
computeScale(DoubleDBIDList[] silhouettes)
Compute the scale (value range)void
forgetRenderedImage()
Free memory used by rendered image.int
getHeight()
java.lang.String
getLongName()
java.awt.image.RenderedImage
getPlot()
Get the Silhouette plot.double
getRatio()
Get width-to-height ratio of image.LinearScale
getScale()
java.lang.String
getShortName()
java.lang.String
getSVGPlotURI()
Get the SVG registered plot numberint
getWidth()
static SilhouettePlot
plotForSilhouetteValues(DoubleDBIDList[] silhouettes, VisualizerContext context)
Static method to find a silhouette plot for a result, or to create a new one using the given context.void
replot()
Trigger a redraw of the Silhouette plotdouble
scaleFromPixel(double y)
Scale a pixel value to a silhouette valueint
scaleToPixel(double silhouette)
Scale a silhouette score to a pixel value.
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Logger
-
MIN_HEIGHT
private static final int MIN_HEIGHT
Minimum and maximum vertical resolution.- See Also:
- Constant Field Values
-
MAX_HEIGHT
private static final int MAX_HEIGHT
Minimum and maximum vertical resolution.- See Also:
- Constant Field Values
-
scale
LinearScale scale
Scale to use
-
width
int width
Width of plot
-
height
int height
Height of plot
-
ratio
double ratio
Ratio of plot
-
silhouettes
final DoubleDBIDList[] silhouettes
The silhouette values.
-
colors
final StylingPolicy colors
Color adapter to use
-
plot
protected java.awt.image.RenderedImage plot
The Silhouette plot.
-
plotnum
protected int plotnum
The plot number for Batik
-
-
Constructor Detail
-
SilhouettePlot
public SilhouettePlot(DoubleDBIDList[] silhouettes, StylingPolicy colors)
Constructor, with automatic distance adapter detection.- Parameters:
silhouettes
- silhouette values to plot.colors
- Coloring strategy
-
-
Method Detail
-
replot
public void replot()
Trigger a redraw of the Silhouette plot
-
scaleToPixel
public int scaleToPixel(double silhouette)
Scale a silhouette score to a pixel value.- Parameters:
silhouette
- silhouette- Returns:
- Pixel value.
-
scaleFromPixel
public double scaleFromPixel(double y)
Scale a pixel value to a silhouette value- Parameters:
y
- Pixel value- Returns:
- silhouette
-
computeScale
protected LinearScale computeScale(DoubleDBIDList[] silhouettes)
Compute the scale (value range)- Parameters:
silhouettes
- Silhouette values to process- Returns:
- Scale for value range of silhouette values
-
getScale
public LinearScale getScale()
- Returns:
- the scale
-
getWidth
public int getWidth()
- Returns:
- the width
-
getHeight
public int getHeight()
- Returns:
- the height
-
getRatio
public double getRatio()
Get width-to-height ratio of image.- Returns:
width / height
-
getPlot
public java.awt.image.RenderedImage getPlot()
Get the Silhouette plot.- Returns:
- plot image
-
forgetRenderedImage
public void forgetRenderedImage()
Free memory used by rendered image.
-
getSVGPlotURI
public java.lang.String getSVGPlotURI()
Get the SVG registered plot number- Returns:
- Plot URI
-
getLongName
public java.lang.String getLongName()
-
getShortName
public java.lang.String getShortName()
-
plotForSilhouetteValues
public static SilhouettePlot plotForSilhouetteValues(DoubleDBIDList[] silhouettes, VisualizerContext context)
Static method to find a silhouette plot for a result, or to create a new one using the given context.- Parameters:
silhouettes
- silhouette valuescontext
- Context (for colors and reference clustering)- Returns:
- New or existing silhouette plot
-
-