Search in sources :

Example 1 with StackedXYBarRenderer

use of org.jfree.chart.renderer.xy.StackedXYBarRenderer in project hmftools by hartwigmedical.

the class CopyNumberCharts method somaticPloidyPDF.

@NotNull
static JFreeChart somaticPloidyPDF(@NotNull final List<PurityAdjustedSomaticVariant> variants) {
    final CategoryTableXYDataset dataset = variants(variants);
    final JFreeChart chart = ChartFactory.createXYBarChart("Somatic Variant Ploidy PDF", "Ploidy", false, "Count", dataset, PlotOrientation.VERTICAL, true, false, false);
    StackedXYBarRenderer renderer = new StackedXYBarRenderer();
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setShadowVisible(false);
    XYPlot xyPlot = (XYPlot) chart.getPlot();
    xyPlot.setRenderer(renderer);
    for (int i = 0; i < dataset.getSeriesCount(); i++) {
        renderer.setSeriesPaint(i, copyNumberColor(String.valueOf(dataset.getSeriesKey(i))));
    }
    return chart;
}
Also used : CategoryTableXYDataset(org.jfree.data.xy.CategoryTableXYDataset) XYPlot(org.jfree.chart.plot.XYPlot) StackedXYBarRenderer(org.jfree.chart.renderer.xy.StackedXYBarRenderer) StandardXYBarPainter(org.jfree.chart.renderer.xy.StandardXYBarPainter) JFreeChart(org.jfree.chart.JFreeChart) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with StackedXYBarRenderer

use of org.jfree.chart.renderer.xy.StackedXYBarRenderer in project hmftools by hartwigmedical.

the class CopyNumberCharts method minorAllelePDF.

@NotNull
static JFreeChart minorAllelePDF(@NotNull final List<PurpleCopyNumber> variants) {
    final CategoryTableXYDataset dataset = minorAllele(variants);
    final JFreeChart chart = ChartFactory.createXYBarChart("Minor Allele Ploidy PDF", "Ploidy", false, "BAF Count", dataset, PlotOrientation.VERTICAL, true, false, false);
    StackedXYBarRenderer renderer = new StackedXYBarRenderer();
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setShadowVisible(false);
    XYPlot xyPlot = (XYPlot) chart.getPlot();
    xyPlot.setRenderer(renderer);
    xyPlot.getDomainAxis().setRange(-1.1, 5.1);
    for (int i = 0; i < dataset.getSeriesCount(); i++) {
        renderer.setSeriesPaint(i, copyNumberColor(String.valueOf(dataset.getSeriesKey(i))));
    }
    return chart;
}
Also used : CategoryTableXYDataset(org.jfree.data.xy.CategoryTableXYDataset) XYPlot(org.jfree.chart.plot.XYPlot) StackedXYBarRenderer(org.jfree.chart.renderer.xy.StackedXYBarRenderer) StandardXYBarPainter(org.jfree.chart.renderer.xy.StandardXYBarPainter) JFreeChart(org.jfree.chart.JFreeChart) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

NotNull (org.jetbrains.annotations.NotNull)2 JFreeChart (org.jfree.chart.JFreeChart)2 XYPlot (org.jfree.chart.plot.XYPlot)2 StackedXYBarRenderer (org.jfree.chart.renderer.xy.StackedXYBarRenderer)2 StandardXYBarPainter (org.jfree.chart.renderer.xy.StandardXYBarPainter)2 CategoryTableXYDataset (org.jfree.data.xy.CategoryTableXYDataset)2