List of usage examples for org.jfree.chart.plot CombinedRangeXYPlot setFixedLegendItems
public void setFixedLegendItems(LegendItemCollection items)
From source file:org.gwaspi.reports.GenericReportGenerator.java
public static CombinedRangeXYPlot buildManhattanPlot(OperationKey testOpKey) throws IOException { // PLOT DEFAULTS final Config config = Config.getSingleton(); final double threshold = config.getDouble(PLOT_MANHATTAN_THRESHOLD_CONFIG, PLOT_MANHATTAN_THRESHOLD_DEFAULT); final Color background = config.getColor(PLOT_MANHATTAN_BACKGROUND_CONFIG, PLOT_MANHATTAN_BACKGROUND_DEFAULT); final Color backgroundAlternative = config.getColor(PLOT_MANHATTAN_BACKGROUND_ALTERNATIVE_CONFIG, PLOT_MANHATTAN_BACKGROUND_ALTERNATIVE_DEFAULT); final Color main = config.getColor(PLOT_MANHATTAN_MAIN_CONFIG, PLOT_MANHATTAN_MAIN_DEFAULT); Map<MarkerKey, MarkerManhattenData> markerKeyChrPosPVal = assembleManhattenPlotData(testOpKey); XYSeriesCollection currChrSC = new XYSeriesCollection(); NumberAxis sharedAxis = new NumberAxis("-log?(P)"); CombinedRangeXYPlot combinedPlot = new CombinedRangeXYPlot(sharedAxis); combinedPlot.setGap(0);/*from w w w . ja v a2 s . c o m*/ XYSeries currChrS = null; // Subdividing points into sub-XYSeries, per chromosome String currChr = ""; Map<String, MarkerKey> labeler = new LinkedHashMap<String, MarkerKey>(); // FIXME This is unused, was a global static var before (also private though), was the data added here actually used somewhere? (i think not) for (Map.Entry<MarkerKey, MarkerManhattenData> entry : markerKeyChrPosPVal.entrySet()) { MarkerKey markerKey = entry.getKey(); MarkerManhattenData data = entry.getValue(); if (data.getPValue() != null) { final double pVal = data.getPValue(); // Is allready free of NaN and infinity if (pVal < 1) { if (data.getChromosome().equals(currChr)) { currChrS.add(data.getPosition(), pVal); labeler.put(currChr + "_" + data.getPosition(), markerKey); } else { if (!currChr.isEmpty()) { // SKIP FIRST TIME (NO DATA YET!) // add the last (now compleeted) chromosomes data-set, // before starting the new one currChrSC.addSeries(currChrS); appendToCombinedRangeManhattanPlot(combinedPlot, currChr, currChrSC, false, threshold, background, backgroundAlternative, main); } currChr = data.getChromosome(); currChrSC = new XYSeriesCollection(); currChrS = new XYSeries(currChr); labeler.put(currChr + "_" + data.getPosition(), markerKey); currChrS.add(data.getPosition(), pVal); } } } } if (currChrS != null) { currChrSC.addSeries(currChrS); // ADD LAST CHR TO PLOT appendToCombinedRangeManhattanPlot(combinedPlot, currChr, currChrSC, true, threshold, background, backgroundAlternative, main); } // Remove Legend from the bottom of the chart combinedPlot.setFixedLegendItems(new LegendItemCollection()); return combinedPlot; }