本文整理汇总了Java中org.jfree.chart.plot.XYPlot.setForegroundAlpha方法的典型用法代码示例。如果您正苦于以下问题:Java XYPlot.setForegroundAlpha方法的具体用法?Java XYPlot.setForegroundAlpha怎么用?Java XYPlot.setForegroundAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.XYPlot
的用法示例。
在下文中一共展示了XYPlot.setForegroundAlpha方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GeneratePlot
import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
public void GeneratePlot(String pngfile) throws IOException {
String modelfile = FilenameUtils.getFullPath(pngfile) + "/" + FilenameUtils.getBaseName(pngfile) + "_ModelPoints.txt";
FileWriter writer = new FileWriter(modelfile);
double[] IDObs = new double[IDEmpiricalDist.getN()];
double[] DecoyObs = new double[DecoyEmpiricalDist.getN()];
for (int i = 0; i < IDEmpiricalDist.getN(); i++) {
IDObs[i] = IDEmpiricalDist.getObs(i);
}
for (int i = 0; i < DecoyEmpiricalDist.getN(); i++) {
DecoyObs[i] = DecoyEmpiricalDist.getObs(i);
}
XYSeries model1 = new XYSeries("Incorrect matches");
XYSeries model2 = new XYSeries("Correct matches");
XYSeries model3 = new XYSeries("All target hits");
writer.write("UScore\tModel\tCorrect\tDecoy\n");
for (int i = 0; i < NoBinPoints; i++) {
model1.add(model_kde_x[i], decoy_kde_y[i]);
model2.add(model_kde_x[i], correct_kde_y[i]);
model3.add(model_kde_x[i], model_kde_y[i]);
writer.write(model_kde_x[i] + "\t" + model_kde_y[i] + "\t" + correct_kde_y[i] + "\t" + decoy_kde_y[i] + "\n");
}
writer.close();
MixtureModelProb = new Float[NoBinPoints + 1][3];
float positiveaccu = 0f;
float negativeaccu = 0f;
MixtureModelProb[0][0] = (float) model2.getMaxX() + Float.MIN_VALUE;
MixtureModelProb[0][1] = 1f;
MixtureModelProb[0][2] = 1f;
for (int i = 1; i < NoBinPoints + 1; i++) {
double positiveNumber = correct_kde_y[NoBinPoints - i];
double negativeNumber = decoy_kde_y[NoBinPoints - i];
MixtureModelProb[i][0] = (float) model_kde_x[NoBinPoints - i];
positiveaccu += positiveNumber;
negativeaccu += negativeNumber;
MixtureModelProb[i][2] = 0.999999f * (float) (positiveNumber / (negativeNumber + positiveNumber));
MixtureModelProb[i][1] = 0.999999f * (float) (positiveaccu / (negativeaccu + positiveaccu));
}
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(model1);
dataset.addSeries(model2);
dataset.addSeries(model3);
HistogramDataset histogramDataset = new HistogramDataset();
histogramDataset.setType(HistogramType.SCALE_AREA_TO_1);
histogramDataset.addSeries("ID hits", IDObs, 100);
histogramDataset.addSeries("Decoy hits", DecoyObs, 100);
//histogramDataset.addSeries("Model hits", ModelObs, 100);
JFreeChart chart = ChartFactory.createHistogram(FilenameUtils.getBaseName(pngfile), "Score", "Hits", histogramDataset, PlotOrientation.VERTICAL, true, false, false);
XYPlot plot = chart.getXYPlot();
NumberAxis domain = (NumberAxis) plot.getDomainAxis();
domain.setRange(min, max);
plot.setBackgroundPaint(Color.white);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setForegroundAlpha(0.8f);
chart.setBackgroundPaint(Color.white);
XYLineAndShapeRenderer render = new XYLineAndShapeRenderer();
plot.setDataset(1, dataset);
plot.setRenderer(1, render);
plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
try {
ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600);
} catch (IOException e) {
}
}