import java.util.Properties;
import java.util.Scanner;
import java.awt.*;
+import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import java.awt.image.ImageProducer;
}
private static void generateHeatMapImage(Species[] species) {
- /*
+
File output = new File("heatMap");
int heatMapHeight = 25*allClusterIDs.length;
}
}
-
+ int speciesNameLength = 200;
int chartWidth = heatMapWidth + 50;
- int chartHeight = heatMapHeight + 300;
+ int chartHeight = heatMapHeight + speciesNameLength;
BufferedImage chartImage = new BufferedImage(chartWidth, chartHeight, imageType);
Graphics2D chartGraphics = chartImage.createGraphics();
Color background = new Color(255, 255, 255);
chartGraphics.setColor(background);
chartGraphics.fillRect(0, 0, chartWidth, chartHeight);
- chartGraphics.drawImage(heatMapImage, 50, 300, null);
+ chartGraphics.drawImage(heatMapImage, 50, speciesNameLength, null);
chartGraphics.setColor(Color.black);
chartGraphics.drawString("Heat Map", 25, 25);
for (int c = 0; c < allClusterIDs.length; c ++) {
String clusterID = Integer.toString(allClusterIDs[c]);
- chartGraphics.drawString(clusterID, 5, (315 + c*25));
+ chartGraphics.drawString(clusterID, 5, (speciesNameLength + 15 + c*25));
}
+
+ for (int s = 0; s < species.length; s ++) {
+ int valueXPos = 70 + (s * 25);
+ int valueYPos = speciesNameLength - 5;
+ // Create 270 degree rotated transform.
+ AffineTransform transform = chartGraphics.getTransform();
+ AffineTransform originalTransform = (AffineTransform) transform.clone();
+ transform.rotate(Math.toRadians(270), valueXPos, valueYPos);
+ chartGraphics.setTransform(transform);
+
+ // Draw the string.
+ chartGraphics.drawString(species[s].name, valueXPos, valueYPos);
+
+ // Revert to original transform before rotation.
+ chartGraphics.setTransform(originalTransform);
+ }
+
try {
ImageIO.write((RenderedImage) chartImage, "gif", output);
} catch (IOException e) {
System.out.println("Unable to write Heat Map Image");
}
- */
-
+
+ /*
double[][] heatMapVals = new double[allClusterIDs.length][species.length];
for (int s = 0; s < species.length; s ++) {
for (int c = 0; c < allClusterIDs.length; c ++) {
} catch (IOException e) {
System.out.println("Unable to write image to file");
}
+ */
}