List of usage examples for org.jfree.chart JFreeChart removeLegend
public void removeLegend()
From source file:gov.nih.nci.caintegrator.application.geneexpression.GeneExpressionPlotServiceImpl.java
private BoxAndWhiskerCoinPlotRenderer cusomtizeBoxWhiskerChart(JFreeChart chart) { customizeAxisMargin(chart);/* w w w . j a v a 2s.com*/ BoxAndWhiskerCoinPlotRenderer renderer = new BoxAndWhiskerCoinPlotRenderer(); renderer.setDisplayAllOutliers(true); renderer.setDisplayMean(false); renderer.setFillBox(false); renderer.setItemMargin(ITEM_MARGIN); chart.removeLegend(); return renderer; }
From source file:org.gephi.statistics.plugin.Degree.java
public String getDirectedReport() { //Distribution series XYSeries dSeries = ChartUtils.createXYSeries(degreeDist, "Degree Distribution"); XYSeries idSeries = ChartUtils.createXYSeries(inDegreeDist, "In-Degree Distribution"); XYSeries odSeries = ChartUtils.createXYSeries(outDegreeDist, "Out-Degree Distribution"); XYSeriesCollection dataset1 = new XYSeriesCollection(); dataset1.addSeries(dSeries);/*from w w w . j a va2s.c o m*/ XYSeriesCollection dataset2 = new XYSeriesCollection(); dataset2.addSeries(idSeries); XYSeriesCollection dataset3 = new XYSeriesCollection(); dataset3.addSeries(odSeries); JFreeChart chart1 = ChartFactory.createXYLineChart("Degree Distribution", "Value", "Count", dataset1, PlotOrientation.VERTICAL, true, false, false); chart1.removeLegend(); ChartUtils.decorateChart(chart1); ChartUtils.scaleChart(chart1, dSeries, false); String degreeImageFile = ChartUtils.renderChart(chart1, "degree-distribution.png"); JFreeChart chart2 = ChartFactory.createXYLineChart("In-Degree Distribution", "Value", "Count", dataset2, PlotOrientation.VERTICAL, true, false, false); chart2.removeLegend(); ChartUtils.decorateChart(chart2); ChartUtils.scaleChart(chart2, dSeries, false); String indegreeImageFile = ChartUtils.renderChart(chart2, "indegree-distribution.png"); JFreeChart chart3 = ChartFactory.createXYLineChart("Out-Degree Distribution", "Value", "Count", dataset3, PlotOrientation.VERTICAL, true, false, false); chart3.removeLegend(); ChartUtils.decorateChart(chart3); ChartUtils.scaleChart(chart3, dSeries, false); String outdegreeImageFile = ChartUtils.renderChart(chart3, "outdegree-distribution.png"); NumberFormat f = new DecimalFormat("#0.000"); String report = "<HTML> <BODY> <h1>Degree Report </h1> " + "<hr>" + "<br> <h2> Results: </h2>" + "Average Degree: " + f.format(avgDegree) + "<br /><br />" + degreeImageFile + "<br /><br />" + indegreeImageFile + "<br /><br />" + outdegreeImageFile + "</BODY></HTML>"; return report; }
From source file:org.gephi.statistics.plugin.dynamic.DynamicClusteringCoefficient.java
public String getReport() { //Transform to Map Map<Double, Double> map = new HashMap<Double, Double>(); for (Interval<Double> interval : averages.getIntervals()) { map.put(interval.getLow(), interval.getValue()); }/* w ww . j ava2 s.c o m*/ //Time series XYSeries dSeries = ChartUtils.createXYSeries(map, "Clustering Coefficient Time Series"); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(dSeries); JFreeChart chart = ChartFactory.createXYLineChart("Clustering Coefficient", "Time", "Average Clustering Coefficient", dataset, PlotOrientation.VERTICAL, true, false, false); chart.removeLegend(); ChartUtils.decorateChart(chart); ChartUtils.scaleChart(chart, dSeries, false); String coefficientImageFile = ChartUtils.renderChart(chart, "coefficient-ts.png"); NumberFormat f = new DecimalFormat("#0.000000"); String report = "<HTML> <BODY> <h1>Dynamic Clustering Coefficient Report </h1> " + "<hr>" + "<br> Bounds: from " + f.format(bounds.getLow()) + " to " + f.format(bounds.getHigh()) + "<br> Window: " + window + "<br> Tick: " + tick + "<br><br><h2> Average clustering cloefficient over time: </h2>" + "<br /><br />" + coefficientImageFile; /*for (Interval<Double> average : averages) { report += average.toString(dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) + "<br />"; }*/ report += "<br /><br /></BODY></HTML>"; return report; }
From source file:org.gephi.statistics.plugin.dynamic.DynamicDegree.java
public String getReport() { //Transform to Map Map<Double, Double> map = new HashMap<Double, Double>(); for (Interval<Double> interval : averages.getIntervals()) { map.put(interval.getLow(), interval.getValue()); }//from w w w . ja va 2 s.com //Time series XYSeries dSeries = ChartUtils.createXYSeries(map, "Degree Time Series"); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(dSeries); JFreeChart chart = ChartFactory.createXYLineChart("Degree Time Series", "Time", "Average Degree", dataset, PlotOrientation.VERTICAL, true, false, false); chart.removeLegend(); ChartUtils.decorateChart(chart); ChartUtils.scaleChart(chart, dSeries, false); String degreeImageFile = ChartUtils.renderChart(chart, "degree-ts.png"); NumberFormat f = new DecimalFormat("#0.000000"); String report = "<HTML> <BODY> <h1>Dynamic Degree Report </h1> " + "<hr>" + "<br> Bounds: from " + f.format(bounds.getLow()) + " to " + f.format(bounds.getHigh()) + "<br> Window: " + window + "<br> Tick: " + tick + "<br><br><h2> Average degrees over time: </h2>" + "<br /><br />" + degreeImageFile; /*for (Interval<Double> averages : averages) { report += averages.toString(dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) + "<br />"; }*/ report += "<br /><br /></BODY></HTML>"; return report; }
From source file:org.jax.haplotype.analysis.visualization.GenomicGraphFactory.java
/** * Create a snp interval histogram without any axes * @param intervals// w w w . jav a2s . c o m * the intervals to use * @param startInBasePairs * where should we start the graph? * @param extentInBasePairs * how far should the graph extend * @param visualInterval * the visual interval to use * @param xAxisLabel * the x axis title to use * @param yAxisLabel * the y axis title to use * @return * the histogram */ public JFreeChart createSnpIntervalHistogram(final List<? extends RealValuedBasePairInterval> intervals, final long startInBasePairs, final long extentInBasePairs, final HighlightedSnpInterval visualInterval, final String xAxisLabel, final String yAxisLabel) { // create the axes NumberAxis xAxis = new NumberAxis(); xAxis.setAutoRangeIncludesZero(false); xAxis.setRange(new Range(startInBasePairs, startInBasePairs + extentInBasePairs)); if (xAxisLabel != null) { xAxis.setLabel(xAxisLabel); } NumberAxis yAxis = new NumberAxis(); if (yAxisLabel != null) { yAxis.setLabel(yAxisLabel); } // create the plot XYPlot plot = this.createSnpIntervalHistogramPlot(intervals, visualInterval, xAxis, yAxis); // create the final chart JFreeChart histogram = new JFreeChart(plot); histogram.removeLegend(); return histogram; }
From source file:org.jax.haplotype.analysis.visualization.GenomicGraphFactory.java
/** * Create a snp interval histogram without any axes * @param intervals//from w w w . j a v a 2s . com * the intervals to use * @param startInBasePairs * where should we start the graph? * @param extentInBasePairs * how far should the graph extend * @param visualInterval * the visual interval to use * @return * the histogram */ public JFreeChart createSnpIntervalHistogram(final List<? extends RealValuedBasePairInterval> intervals, final long startInBasePairs, final long extentInBasePairs, final HighlightedSnpInterval visualInterval) { // create the axes NumberAxis xAxis = new NumberAxis(); xAxis.setAutoRangeIncludesZero(false); xAxis.setRange(new Range(startInBasePairs, startInBasePairs + extentInBasePairs)); NumberAxis yAxis = new NumberAxis(); // hide the axes xAxis.setVisible(false); yAxis.setVisible(false); // create the plot XYPlot plot = this.createSnpIntervalHistogramPlot(intervals, visualInterval, xAxis, yAxis); // more hiding plot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); // create the final chart JFreeChart histogram = new JFreeChart(plot); histogram.removeLegend(); return histogram; }
From source file:gui.DendrogramChart.java
ChartPanel getChartPanel(Dendrogram d, boolean log) { JFreeChart chart = ChartFactory.createXYLineChart(null, "Similarity", "No. of Groups", null, PlotOrientation.VERTICAL, true, true, false); setChartData(chart, log);//from ww w.j a va2 s. c o m RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); chart.setRenderingHints(rh); chart.removeLegend(); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(new Color(255, 255, 220)); plot.setDomainGridlinePaint(new Color(128, 128, 128)); plot.setRangeGridlinePaint(new Color(128, 128, 128)); if (log == false) { NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLowerBound(0); rangeAxis.setNumberFormatOverride(new DecimalFormat("0")); rangeAxis.setLabelFont(Prefs.labelFont); } else { // LogarithmicAxis logXAxis = new LogarithmicAxis("Similarity"); // logXAxis.setAllowNegativesFlag(true); LogarithmicAxis logYAxis = new LogarithmicAxis("No. Of Groups"); logYAxis.setAllowNegativesFlag(false); // plot.setDomainAxis(logXAxis); plot.setRangeAxis(logYAxis); } ChartPanel chartPanel = new ChartPanel(chart); // chartPanel.setPopupMenu(null); return chartPanel; }
From source file:org.gephi.statistics.plugin.EigenvectorCentrality.java
/** * /*from ww w . ja v a 2 s . co m*/ * @return */ @Override public String getReport() { //distribution of values Map<Double, Integer> dist = new HashMap<Double, Integer>(); for (int i = 0; i < centralities.length; i++) { Double d = centralities[i]; if (dist.containsKey(d)) { Integer v = dist.get(d); dist.put(d, v + 1); } else { dist.put(d, 1); } } //Distribution series XYSeries dSeries = ChartUtils.createXYSeries(dist, "Eigenvector Centralities"); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(dSeries); JFreeChart chart = ChartFactory.createScatterPlot("Eigenvector Centrality Distribution", "Score", "Count", dataset, PlotOrientation.VERTICAL, true, false, false); chart.removeLegend(); ChartUtils.decorateChart(chart); ChartUtils.scaleChart(chart, dSeries, true); String imageFile = ChartUtils.renderChart(chart, "eigenvector-centralities.png"); String report = "<HTML> <BODY> <h1>Eigenvector Centrality Report</h1> " + "<hr>" + "<h2> Parameters: </h2>" + "Network Interpretation: " + (isDirected ? "directed" : "undirected") + "<br>" + "Number of iterations: " + numRuns + "<br>" + "Sum change: " + sumChange + "<br> <h2> Results: </h2>" + imageFile + "</BODY></HTML>"; return report; }
From source file:org.gephi.statistics.plugin.GraphDistance.java
private String createImageFile(TempDir tempDir, double[] pVals, String pName, String pX, String pY) { //distribution of values Map<Double, Integer> dist = new HashMap<Double, Integer>(); for (int i = 0; i < N; i++) { Double d = pVals[i];/* w w w .j a va 2 s. co m*/ if (dist.containsKey(d)) { Integer v = dist.get(d); dist.put(d, v + 1); } else { dist.put(d, 1); } } //Distribution series XYSeries dSeries = ChartUtils.createXYSeries(dist, pName); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(dSeries); JFreeChart chart = ChartFactory.createXYLineChart(pName, pX, pY, dataset, PlotOrientation.VERTICAL, true, false, false); chart.removeLegend(); ChartUtils.decorateChart(chart); ChartUtils.scaleChart(chart, dSeries, isNormalized); return ChartUtils.renderChart(chart, pName + ".png"); }
From source file:edu.ucla.stat.SOCR.chart.demo.SpiderWebChartDemo1.java
/** * Creates a sample chart./* ww w . j a va 2 s. c o m*/ * * @param dataset the dataset. * * @return The chart. */ protected JFreeChart createChart(CategoryDataset dataset) { // get a reference to the plot for further customisation... SOCRSpiderWebPlot plot = new SOCRSpiderWebPlot(dataset); JFreeChart chart = new JFreeChart(chartTitle, TextTitle.DEFAULT_FONT, plot, false); LegendTitle legend = new LegendTitle(plot); legend.setPosition(RectangleEdge.BOTTOM); //renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); chart.addSubtitle(legend); setCategorySummary(dataset); if (legendPanelOn) chart.removeLegend(); return chart; }