List of usage examples for org.jfree.chart.plot CombinedRangeXYPlot CombinedRangeXYPlot
public CombinedRangeXYPlot(ValueAxis rangeAxis)
From source file:org.gwaspi.reports.PlinkReportLoaderCombined.java
public static CombinedRangeXYPlot loadAssocUnadjLogPvsPos(File plinkReport, Set<String> redMarkers) throws IOException { NumberAxis sharedAxis = new NumberAxis("-log?(P)"); sharedAxis.setTickMarkInsideLength(3.0f); CombinedRangeXYPlot combinedPlot = new CombinedRangeXYPlot(sharedAxis); combinedPlot.setGap(0);//from w w w .j av a 2 s . c o m XYSeries series1 = null; XYSeries series2 = null; FileReader inputFileReader = null; BufferedReader inputBufferReader = null; try { inputFileReader = new FileReader(plinkReport); inputBufferReader = new BufferedReader(inputFileReader); // Getting data from file and subdividing to series all points by chromosome String l; String tempChr = ""; // read but ignore the header /*String header = */inputBufferReader.readLine(); int count = 0; while ((l = inputBufferReader.readLine()) != null) { if (count % 10000 == 0) { log.info("loadAssocUnadjLogPvsPos -> reader count: {}", count); } count++; l = l.trim().replaceAll("\\s+", ","); String[] cVals = l.split(","); String markerId = cVals[1]; int position = Integer.parseInt(cVals[2]); String s_pVal = cVals[8]; if (!s_pVal.equals("NA")) { double pValue = Double.parseDouble(s_pVal); // P value if (cVals[0].toString().equals(tempChr)) { if (redMarkers.contains(markerId)) { // Insert in alternate color series series2.add(position, pValue); } else { series1.add(position, pValue); } // series1.add(position, logPValue); } else { if (!tempChr.isEmpty()) { // Not the first time round! XYSeriesCollection tempChrData = new XYSeriesCollection(); tempChrData.addSeries(series1); tempChrData.addSeries(series2); appendToCombinedRangePlot(combinedPlot, tempChr, tempChrData, false); } tempChr = cVals[0]; series1 = new XYSeries("Imputed"); series2 = new XYSeries("Observed"); // Alternate color series if (redMarkers.contains(markerId)) { // Insert inlternate color series series2.add(position, pValue); } else { series1.add(position, pValue); } // series1 = new XYSeries(cVals[0]); // series1.add(position, logPValue); } } } // Append last chromosome to combined plot XYSeriesCollection tempChrData = new XYSeriesCollection(); tempChrData.addSeries(series1); tempChrData.addSeries(series2); appendToCombinedRangePlot(combinedPlot, tempChr, tempChrData, true); } finally { try { if (inputBufferReader != null) { inputBufferReader.close(); } else if (inputFileReader != null) { inputFileReader.close(); } } catch (Exception ex) { log.warn(null, ex); } } return combinedPlot; }
From source file:org.gwaspi.reports.PlinkReportLoader.java
public static CombinedRangeXYPlot loadAssocUnadjLogPvsPos(File plinkReport, Set<String> redMarkersHS) throws IOException { XYSeriesCollection chrData = new XYSeriesCollection(); NumberAxis sharedAxis = new NumberAxis("-log?(P)"); CombinedRangeXYPlot combinedPlot = new CombinedRangeXYPlot(sharedAxis); combinedPlot.setGap(0);/*from w w w . j av a2s .c om*/ XYSeries series1 = null; XYSeries series2 = null; FileReader inputFileReader = null; BufferedReader inputBufferReader = null; String tempChr = null; try { inputFileReader = new FileReader(plinkReport); inputBufferReader = new BufferedReader(inputFileReader); // Getting data from file and subdividing to series all points by chromosome String l; tempChr = ""; String header = inputBufferReader.readLine(); int count = 0; while ((l = inputBufferReader.readLine()) != null) { if (count % 10000 == 0) { log.info("loadAssocUnadjLogPvsPos -> reader count: {}", count); } count++; l = l.trim().replaceAll("\\s+", ","); String[] cVals = l.split(","); String markerId = cVals[1]; int position = Integer.parseInt(cVals[2]); String s_pVal = cVals[8]; if (!s_pVal.equals("NA")) { double logPValue = Math.abs(Math.log(Double.parseDouble(s_pVal)) / Math.log(10)); if (cVals[0].toString().equals(tempChr)) { if (redMarkersHS.contains(markerId)) { series2.add(position, logPValue); } else { series1.add(position, logPValue); } labeler.put(tempChr + "_" + position, markerId); } else { if (!tempChr.isEmpty()) { // SKIP FIRST TIME (NO DATA YET!) chrData.addSeries(series1); chrData.addSeries(series2); appendToCombinedRangePlot(combinedPlot, tempChr, chrData); } tempChr = cVals[0]; series1 = new XYSeries("Imputed"); series2 = new XYSeries("Observed"); labeler.put(tempChr + "_" + position, markerId); if (redMarkersHS.contains(markerId)) { series2.add(position, logPValue); } else { series1.add(position, logPValue); } } } } } finally { if (inputBufferReader != null) { inputBufferReader.close(); } else if (inputFileReader != null) { inputFileReader.close(); } } chrData.addSeries(series1); chrData.addSeries(series2); appendToCombinedRangePlot(combinedPlot, tempChr, chrData); // ADD LAST CHR TO PLOT return combinedPlot; }
From source file:org.jax.haplotype.analysis.visualization.GenomicGraphFactory.java
/** * Creates a plot which contains multiple chromosome histograms * @param chromosomeHistograms//from ww w . ja v a 2s . c o m * the chromosome histograms * @param xAxisLabel * the X axis label * @param yAxisLabel * the Y axis label * @return * the object for the multiple chromosome plots */ public JFreeChart createMultiChromosomeHistogram( final List<? extends ChromosomeHistogramValues> chromosomeHistograms, final String xAxisLabel, final String yAxisLabel) { // create the y-axis that is shared by all of the chromosomes NumberAxis yAxis = new NumberAxis(); if (yAxisLabel != null) { yAxis.setLabel(yAxisLabel); } // the combined plot makes all of the chromosomes to share the same // y-axis but to have thier own x-axis CombinedRangeXYPlot combinedChromosomePlot = new CombinedRangeXYPlot(yAxis); combinedChromosomePlot.setGap(4.0); // iterate through the chromosomes adding a new plot for each one for (ChromosomeHistogramValues currChromHist : chromosomeHistograms) { // use a weight to ensure that the amount of space that the // subgraph gets on the x-axis is proportional to the chromosome's // extent final int currWeight = (int) (currChromHist.getExtentInBasePairs() / 1000 + 1); final NumberAxis currXAxis = new NumberAxis(); currXAxis.setAutoRangeIncludesZero(false); currXAxis.setTickLabelsVisible(false); currXAxis.setTickMarksVisible(false); currXAxis.setLabel(Integer.toString(currChromHist.getChromosomeNumber())); final XYPlot currPlot = this.createSnpIntervalHistogramPlot(currChromHist.getIntervals(), currChromHist.getVisualInterval(), currXAxis, null); combinedChromosomePlot.add(currPlot, currWeight); } JFreeChart multiChromosomeChart = new JFreeChart(combinedChromosomePlot); multiChromosomeChart.removeLegend(); return multiChromosomeChart; }
From source file:org.jfree.chart.demo.CombinedXYPlotDemo3.java
/** * Creates a combined XYPlot chart.//www .j a v a 2 s.c om * * @return the combined chart. */ private JFreeChart createCombinedChart() { // create a default chart based on some sample data... final TimeSeriesCollection dataset0 = new TimeSeriesCollection(); final TimeSeries eur = DemoDatasetFactory.createEURTimeSeries(); dataset0.addSeries(eur); final TimeSeriesCollection dataset1 = new TimeSeriesCollection(); final TimeSeries mav = MovingAverage.createMovingAverage(eur, "EUR/GBP (30 Day MA)", 30, 30); dataset1.addSeries(eur); dataset1.addSeries(mav); final TimeSeriesCollection dataset2 = new TimeSeriesCollection(); dataset2.addSeries(eur); JFreeChart chart = null; // make a common vertical axis for all the sub-plots final NumberAxis valueAxis = new NumberAxis("Value"); valueAxis.setAutoRangeIncludesZero(false); // override default // make a horizontally combined plot final CombinedRangeXYPlot parent = new CombinedRangeXYPlot(valueAxis); // add subplot 1... final XYPlot subplot1 = new XYPlot(dataset0, new DateAxis("Date 1"), null, new StandardXYItemRenderer()); parent.add(subplot1, 1); // add subplot 2... final XYPlot subplot2 = new XYPlot(dataset1, new DateAxis("Date 2"), null, new StandardXYItemRenderer()); parent.add(subplot2, 1); // add subplot 3... final XYPlot subplot3 = new XYPlot(dataset2, new DateAxis("Date 3"), null, new XYBarRenderer(0.20)); parent.add(subplot3, 1); // now make the top level JFreeChart chart = new JFreeChart("Demo Chart", JFreeChart.DEFAULT_TITLE_FONT, parent, true); // then customise it a little... final TextTitle subtitle = new TextTitle("This is a subtitle", new Font("SansSerif", Font.BOLD, 12)); chart.addSubtitle(subtitle); chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue)); return chart; }
From source file:org.jfree.chart.demo.CombinedXYPlotDemo2.java
/** * Creates a combined XYPlot chart./* w w w . ja va 2 s . c o m*/ * * @return the combined chart. */ private JFreeChart createCombinedChart() { // create subplot 1... final IntervalXYDataset data1 = createDataset1(); final XYItemRenderer renderer1 = new XYBarRenderer(0.20); renderer1.setToolTipGenerator( new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0,000.0"))); final XYPlot subplot1 = new XYPlot(data1, new DateAxis("Date"), null, renderer1); // create subplot 2... final XYDataset data2 = createDataset2(); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setToolTipGenerator( new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0,000.0"))); final XYPlot subplot2 = new XYPlot(data2, new DateAxis("Date"), null, renderer2); // create a parent plot... final CombinedRangeXYPlot plot = new CombinedRangeXYPlot(new NumberAxis("Value")); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); // return a new chart containing the overlaid plot... return new JFreeChart("Combined (Range) XY Plot", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
From source file:org.optaplanner.examples.cheaptime.swingui.CheapTimePanel.java
private JFreeChart createChart(CheapTimeSolution solution) { TangoColorFactory tangoColorFactory = new TangoColorFactory(); NumberAxis rangeAxis = new NumberAxis("Period"); rangeAxis.setRange(-0.5, solution.getGlobalPeriodRangeTo() + 0.5); XYPlot taskAssignmentPlot = createTaskAssignmentPlot(tangoColorFactory, solution); XYPlot periodCostPlot = createPeriodCostPlot(tangoColorFactory, solution); XYPlot capacityPlot = createAvailableCapacityPlot(tangoColorFactory, solution); CombinedRangeXYPlot combinedPlot = new CombinedRangeXYPlot(rangeAxis); combinedPlot.add(taskAssignmentPlot, 5); combinedPlot.add(periodCostPlot, 1); combinedPlot.add(capacityPlot, 1);/* ww w. java2s. c o m*/ combinedPlot.setOrientation(PlotOrientation.HORIZONTAL); return new JFreeChart("Cheap Power Time Scheduling", JFreeChart.DEFAULT_TITLE_FONT, combinedPlot, true); }
From source file:org.jfree.chart.demo.CombinedXYPlotDemo5.java
/** * Creates a combined XYPlot chart./*from w w w . j a v a 2 s. c o m*/ * * @return the combined chart. */ private JFreeChart createCombinedChart() { // create a default chart based on some sample data... final TimeSeriesCollection dataset0 = new TimeSeriesCollection(); final TimeSeries eur = DemoDatasetFactory.createEURTimeSeries(); dataset0.addSeries(eur); final TimeSeriesCollection dataset1 = new TimeSeriesCollection(); final TimeSeries mav = MovingAverage.createMovingAverage(eur, "EUR/GBP (30 Day MA)", 30, 30); dataset1.addSeries(eur); dataset1.addSeries(mav); final TimeSeriesCollection dataset2 = new TimeSeriesCollection(); dataset2.addSeries(eur); JFreeChart chart = null; // make a common vertical axis for all the sub-plots final NumberAxis valueAxis = new NumberAxis("Value"); valueAxis.setAutoRangeIncludesZero(false); // override default // make a horizontally combined plot final CombinedRangeXYPlot parent = new CombinedRangeXYPlot(valueAxis); // add subplot 1... final XYPlot subplot1 = new XYPlot(dataset0, new DateAxis("Date 1"), null, new StandardXYItemRenderer()); subplot1.setDomainCrosshairVisible(true); subplot1.setRangeCrosshairVisible(true); parent.add(subplot1, 1); // add subplot 2... final XYPlot subplot2 = new XYPlot(dataset1, new DateAxis("Date 2"), null, new StandardXYItemRenderer()); subplot2.setDomainCrosshairVisible(true); subplot2.setRangeCrosshairVisible(true); parent.add(subplot2, 1); // add subplot 3... final XYPlot subplot3 = new XYPlot(dataset2, new DateAxis("Date 3"), null, new XYBarRenderer(0.20)); subplot3.setDomainCrosshairVisible(true); subplot3.setRangeCrosshairVisible(true); parent.add(subplot3, 1); // now make the top level JFreeChart chart = new JFreeChart("Demo Chart", JFreeChart.DEFAULT_TITLE_FONT, parent, true); // then customise it a little... final TextTitle subtitle = new TextTitle("This is a subtitle", new Font("SansSerif", Font.BOLD, 12)); chart.addSubtitle(subtitle); chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue)); return chart; }
From source file:org.jfree.chart.demo.CombinedTimeSeriesDemo1.java
public static JPanel createDemoPanel() { TimeSeries timeseries = new TimeSeries("Annual"); timeseries.add(new Year(1998), 80D); timeseries.add(new Year(1999), 85D); timeseries.add(new Year(2000), 87.599999999999994D); TimeSeriesCollection dataset1 = new TimeSeriesCollection(timeseries); TimeSeries timeseries1 = new TimeSeries("Monthly A"); timeseries1.add(new Month(7, 2000), 85.799999999999997D); timeseries1.add(new Month(8, 2000), 85.799999999999997D); timeseries1.add(new Month(9, 2000), 85.799999999999997D); timeseries1.add(new Month(10, 2000), 86.5D); timeseries1.add(new Month(11, 2000), 86.5D); timeseries1.add(new Month(12, 2000), 86.5D); timeseries1.add(new Month(1, 2001), 87.700000000000003D); timeseries1.add(new Month(2, 2001), 87.700000000000003D); timeseries1.add(new Month(3, 2001), 87.700000000000003D); timeseries1.add(new Month(4, 2001), 88.5D); timeseries1.add(new Month(5, 2001), 88.5D); timeseries1.add(new Month(6, 2001), 88.5D); timeseries1.add(new Month(7, 2001), 90D); timeseries1.add(new Month(8, 2001), 90D); timeseries1.add(new Month(9, 2001), 90D); timeseries1.add(new Month(10, 2001), 90D); timeseries1.add(new Month(11, 2001), 90D); timeseries1.add(new Month(12, 2001), 90D); timeseries1.add(new Month(1, 2002), 90D); timeseries1.add(new Month(2, 2002), 90D); timeseries1.add(new Month(3, 2002), 90D); timeseries1.add(new Month(4, 2002), 90D); timeseries1.add(new Month(5, 2002), 90D); timeseries1.add(new Month(6, 2002), 90D); TimeSeries timeseries2 = new TimeSeries("Monthly B"); timeseries2.add(new Month(7, 2000), 83.799999999999997D); timeseries2.add(new Month(8, 2000), 83.799999999999997D); timeseries2.add(new Month(9, 2000), 83.799999999999997D); timeseries2.add(new Month(10, 2000), 84.5D); timeseries2.add(new Month(11, 2000), 84.5D); timeseries2.add(new Month(12, 2000), 84.5D); timeseries2.add(new Month(1, 2001), 85.700000000000003D); timeseries2.add(new Month(2, 2001), 85.700000000000003D); timeseries2.add(new Month(3, 2001), 85.700000000000003D); timeseries2.add(new Month(4, 2001), 86.5D); timeseries2.add(new Month(5, 2001), 86.5D); timeseries2.add(new Month(6, 2001), 86.5D); timeseries2.add(new Month(7, 2001), 88D); timeseries2.add(new Month(8, 2001), 88D); timeseries2.add(new Month(9, 2001), 88D); timeseries2.add(new Month(10, 2001), 88D); timeseries2.add(new Month(11, 2001), 88D); timeseries2.add(new Month(12, 2001), 88D); timeseries2.add(new Month(1, 2002), 88D); timeseries2.add(new Month(2, 2002), 88D); timeseries2.add(new Month(3, 2002), 88D); timeseries2.add(new Month(4, 2002), 88D); timeseries2.add(new Month(5, 2002), 88D); timeseries2.add(new Month(6, 2002), 88D); TimeSeriesCollection dataset21 = new TimeSeriesCollection(); dataset21.addSeries(timeseries1);/* w w w .j a v a 2 s. co m*/ dataset21.addSeries(timeseries2); TimeSeries timeseries3 = new TimeSeries("XXX"); timeseries3.add(new Month(7, 2000), 81.5D); timeseries3.add(new Month(8, 2000), 86D); timeseries3.add(new Month(9, 2000), 82D); timeseries3.add(new Month(10, 2000), 89.5D); timeseries3.add(new Month(11, 2000), 88D); timeseries3.add(new Month(12, 2000), 88D); timeseries3.add(new Month(1, 2001), 90D); timeseries3.add(new Month(2, 2001), 89.5D); timeseries3.add(new Month(3, 2001), 90.200000000000003D); timeseries3.add(new Month(4, 2001), 90.599999999999994D); timeseries3.add(new Month(5, 2001), 87.5D); timeseries3.add(new Month(6, 2001), 91D); timeseries3.add(new Month(7, 2001), 89.700000000000003D); timeseries3.add(new Month(8, 2001), 87D); timeseries3.add(new Month(9, 2001), 91.200000000000003D); timeseries3.add(new Month(10, 2001), 84D); timeseries3.add(new Month(11, 2001), 90D); timeseries3.add(new Month(12, 2001), 92D); TimeSeriesCollection dataset22 = new TimeSeriesCollection(timeseries3); // XYBarRenderer renderer1 = new XYBarRenderer(0.20000000000000001D); renderer1.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0} ({1}, {2})", new SimpleDateFormat("yyyy"), new DecimalFormat("0.00"))); XYPlot plot1 = new XYPlot(dataset1, new DateAxis("Date"), null, renderer1); // XYAreaRenderer renderer21 = new XYAreaRenderer(); XYPlot plot2 = new XYPlot(dataset21, new DateAxis("Date"), null, renderer21); StandardXYItemRenderer renderer22 = new StandardXYItemRenderer(3); renderer22.setBaseShapesFilled(true); plot2.setDataset(1, dataset22); plot2.setRenderer(1, renderer22); plot2.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // NumberAxis valueAxis = new NumberAxis("Value"); valueAxis.setAutoRangeIncludesZero(false); CombinedRangeXYPlot combinedPlot = new CombinedRangeXYPlot(valueAxis); combinedPlot.add(plot1, 1); combinedPlot.add(plot2, 4); //chart JFreeChart jfreechart = new JFreeChart("Sample Combined Plot", JFreeChart.DEFAULT_TITLE_FONT, combinedPlot, true); ChartPanel chartpanel = new ChartPanel(jfreechart); chartpanel.setPreferredSize(new Dimension(500, 270)); chartpanel.addChartMouseListener(new ChartMouseListener() { public void chartMouseClicked(ChartMouseEvent chartmouseevent) { System.out.println(chartmouseevent.getEntity()); } public void chartMouseMoved(ChartMouseEvent chartmouseevent) { System.out.println(chartmouseevent.getEntity()); } }); return chartpanel; }
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);/* ww w .j a v a2s. 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; }
From source file:org.jfree.chart.demo.SymbolicYPlotDemo.java
/** * Create and display a multi XY plot with horizontal layout. * //from w w w .j av a 2 s. c o m * @param frameTitle * the frame title. * @param data1 * dataset1. * @param data2 * dataset2. */ private static void displayYSymbolicCombinedHorizontally(final String frameTitle, final SampleYSymbolicDataset data1, final SampleYSymbolicDataset data2) { final String title = "Animals Horizontally Combined"; final String xAxisLabel = "Miles"; final String yAxisLabel = null; // combine the y symbolic values of the two data sets final String[] combinedYSymbolicValues = SampleYSymbolicDataset.combineYSymbolicDataset(data1, data2); // make master dataset... final CombinedDataset data = new CombinedDataset(); data.add(data1); data.add(data2); // decompose data... final XYDataset series0 = new SubSeriesDataset(data, 0); final XYDataset series1 = new SubSeriesDataset(data, 1); final XYDataset series2 = new SubSeriesDataset(data, 2); final XYDataset series3 = new SubSeriesDataset(data, 3); final XYDataset series4 = new SubSeriesDataset(data, 4); final XYDataset series5 = new SubSeriesDataset(data, 5); final XYDataset series6 = new SubSeriesDataset(data, 6); final XYDataset series7 = new SubSeriesDataset(data, 7); // create axes... final ValueAxis valueAxis0 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis1 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis2 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis3 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis4 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis5 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis6 = new NumberAxis(xAxisLabel); final ValueAxis valueAxis7 = new NumberAxis(xAxisLabel); final SymbolicAxis symbolicAxis = new SymbolicAxis(yAxisLabel, combinedYSymbolicValues); // make a combined plot final CombinedRangeXYPlot mainPlot = new CombinedRangeXYPlot(symbolicAxis); // add the sub-plots final XYItemRenderer renderer0 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot0 = new XYPlot(series0, valueAxis0, null, renderer0); final XYItemRenderer renderer1 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot1 = new XYPlot(series1, valueAxis1, null, renderer1); final XYItemRenderer renderer2 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot2 = new XYPlot(series2, valueAxis2, null, renderer2); final XYItemRenderer renderer3 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot3 = new XYPlot(series3, valueAxis3, null, renderer3); final XYItemRenderer renderer4 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot4 = new XYPlot(series4, valueAxis4, null, renderer4); final XYItemRenderer renderer5 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot5 = new XYPlot(series5, valueAxis5, null, renderer5); final XYItemRenderer renderer6 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot6 = new XYPlot(series6, valueAxis6, null, renderer6); final XYItemRenderer renderer7 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, null); final XYPlot subplot7 = new XYPlot(series7, valueAxis7, null, renderer7); mainPlot.add(subplot0, 1); mainPlot.add(subplot1, 1); mainPlot.add(subplot2, 1); mainPlot.add(subplot3, 1); mainPlot.add(subplot4, 1); mainPlot.add(subplot5, 1); mainPlot.add(subplot6, 1); mainPlot.add(subplot7, 1); // make the top level JFreeChart object final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, mainPlot, true); // then customise it a little... chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue)); // and present it in a frame... final JFrame ySymbolicFrame = new ChartFrame(frameTitle, chart); ySymbolicFrame.pack(); RefineryUtilities.positionFrameRandomly(ySymbolicFrame); ySymbolicFrame.show(); }