Java Code Examples for org.jfree.chart.axis.NumberAxis#setMinorTickCount()
The following examples show how to use
org.jfree.chart.axis.NumberAxis#setMinorTickCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpectrumChartFactory.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public static JFreeChart createChart(PseudoSpectrumDataSet dataset, boolean showTitle, boolean showLegend, double rt, double precursorMZ) { // if (dataset == null) return null; // NumberFormat mzForm = MZmineCore.getConfiguration().getMZFormat(); NumberFormat rtForm = MZmineCore.getConfiguration().getRTFormat(); NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); String title = ""; if (precursorMZ == 0) title = "RT=" + mzForm.format(precursorMZ); else title = MessageFormat.format("MSMS for m/z={0} RT={1}", mzForm.format(precursorMZ), rtForm.format(rt)); JFreeChart chart = ChartFactory.createXYLineChart(title, // title "m/z", // x-axis label "Intensity", // y-axis label dataset, // data set PlotOrientation.VERTICAL, // orientation true, // isotopeFlag, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); chart.getTitle().setVisible(false); // set the plot properties XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(RectangleInsets.ZERO_INSETS); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); // set the X axis (retention time) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setNumberFormatOverride(mzForm); xAxis.setUpperMargin(0.08); xAxis.setLowerMargin(0.00); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); xAxis.setAutoRangeIncludesZero(true); xAxis.setMinorTickCount(5); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setNumberFormatOverride(intensityFormat); yAxis.setUpperMargin(0.20); PseudoSpectraRenderer renderer = new PseudoSpectraRenderer(Color.BLACK, false); plot.setRenderer(0, renderer); plot.setRenderer(1, renderer); plot.setRenderer(2, renderer); renderer.setSeriesVisibleInLegend(1, false); renderer.setSeriesPaint(2, Color.ORANGE); // chart.getTitle().setVisible(showTitle); chart.getLegend().setVisible(showLegend); // if (precursorMZ != 0) addPrecursorMarker(chart, precursorMZ); return chart; }
Example 2
Source File: PseudoSpectrum.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public static JFreeChart createChart(PseudoSpectrumDataSet dataset, RawDataFile raw, boolean sum, String title) { // JFreeChart chart = ChartFactory.createXYLineChart(title, // title "m/z", // x-axis label "Intensity", // y-axis label dataset, // data set PlotOrientation.VERTICAL, // orientation true, // isotopeFlag, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); chart.getTitle().setVisible(false); // set the plot properties XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(RectangleInsets.ZERO_INSETS); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat(); NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); // set the X axis (retention time) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setNumberFormatOverride(mzFormat); xAxis.setUpperMargin(0.08); xAxis.setLowerMargin(0.00); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); xAxis.setAutoRangeIncludesZero(true); xAxis.setMinorTickCount(5); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setNumberFormatOverride(intensityFormat); yAxis.setUpperMargin(0.20); PseudoSpectraRenderer renderer = new PseudoSpectraRenderer(Color.BLACK, false); plot.setRenderer(0, renderer); plot.setRenderer(1, renderer); plot.setRenderer(2, renderer); renderer.setSeriesVisibleInLegend(1, false); renderer.setSeriesPaint(2, Color.ORANGE); // return chart; }
Example 3
Source File: HistogramChart.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public HistogramChart() { super(ChartFactory.createHistogram("", // title "", // x-axis label "", // y-axis label null, // data set PlotOrientation.VERTICAL, // orientation true, // create legend false, // generate tooltips false // generate URLs )); // initialize the chart by default time series chart from factory chart = getChart(); // title chartTitle = chart.getTitle(); chartTitle.setFont(titleFont); chartTitle.setMargin(5, 0, 0, 0); chartSubTitle = new TextTitle(); chartSubTitle.setFont(subTitleFont); chartSubTitle.setMargin(5, 0, 0, 0); chart.addSubtitle(chartSubTitle); // legend constructed by ChartFactory LegendTitle legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); chart.setBackgroundPaint(Color.white); // disable maximum size (we don't want scaling) // setMaximumDrawWidth(Integer.MAX_VALUE); // setMaximumDrawHeight(Integer.MAX_VALUE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(true); // set the logarithmic axis NumberAxis axisDomain = new HistogramDomainAxis(); axisDomain.setMinorTickCount(1); axisDomain.setAutoRange(true); NumberAxis axisRange = new NumberAxis(); axisRange.setMinorTickCount(1); axisRange.setAutoRange(true); plot.setDomainAxis(axisDomain); plot.setRangeAxis(axisRange); ClusteredXYBarRenderer renderer = new ClusteredXYBarRenderer(); renderer.setMargin(marginSize); renderer.setShadowVisible(false); plot.setRenderer(renderer); // this.setMinimumSize(new Dimension(400, 400)); // this.setDismissDelay(Integer.MAX_VALUE); // this.setInitialDelay(0); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }
Example 4
Source File: MirrorChartFactory.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
private static JFreeChart createMirrorChart(String labelA, double precursorMZA, double rtA, DataPoint[] dpsA, String labelB, double precursorMZB, double rtB, DataPoint[] dpsB, boolean showTitle, boolean showLegend) { PseudoSpectrumDataSet data = dpsA == null ? null : createMSMSDataSet(precursorMZA, rtA, dpsA, labelA); PseudoSpectrumDataSet dataMirror = dpsB == null ? null : createMSMSDataSet(precursorMZB, rtB, dpsB, labelB); NumberFormat mzForm = MZmineCore.getConfiguration().getMZFormat(); NumberFormat intensityFormat = new DecimalFormat("0.#"); // set the X axis (retention time) properties NumberAxis xAxis = new NumberAxis("m/z"); xAxis.setNumberFormatOverride(mzForm); xAxis.setUpperMargin(0.08); xAxis.setLowerMargin(0.00); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); xAxis.setAutoRangeIncludesZero(false); xAxis.setMinorTickCount(5); PseudoSpectraRenderer renderer1 = new PseudoSpectraRenderer(Color.BLACK, false); PseudoSpectraRenderer renderer2 = new PseudoSpectraRenderer(Color.BLACK, false); // create subplot 1... final NumberAxis rangeAxis1 = new NumberAxis("rel. intensity [%]"); final XYPlot subplot1 = new XYPlot(data, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); rangeAxis1.setNumberFormatOverride(intensityFormat); rangeAxis1.setAutoRangeIncludesZero(true); rangeAxis1.setAutoRangeStickyZero(true); // create subplot 2... final NumberAxis rangeAxis2 = new NumberAxis("rel. intensity [%]"); rangeAxis2.setNumberFormatOverride(intensityFormat); rangeAxis2.setAutoRangeIncludesZero(true); rangeAxis2.setAutoRangeStickyZero(true); rangeAxis2.setInverted(true); final XYPlot subplot2 = new XYPlot(dataMirror, null, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(xAxis); plot.setGap(0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // set the plot properties plot.setBackgroundPaint(Color.white); plot.setAxisOffset(RectangleInsets.ZERO_INSETS); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); // return a new chart containing the overlaid plot... JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(Color.white); chart.getTitle().setVisible(false); chart.getXYPlot().setRangeZeroBaselineVisible(true); chart.getTitle().setVisible(showTitle); chart.getLegend().setVisible(showLegend); return chart; }
Example 5
Source File: SpectrumChartFactory.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public static EChartPanel createMirrorChartPanel(String labelA, double precursorMZA, double rtA, DataPoint[] dpsA, String labelB, double precursorMZB, double rtB, DataPoint[] dpsB, boolean showTitle, boolean showLegend) { PseudoSpectrumDataSet data = dpsA == null ? null : createMSMSDataSet(precursorMZA, rtA, dpsA, labelA); PseudoSpectrumDataSet dataMirror = dpsB == null ? null : createMSMSDataSet(precursorMZB, rtB, dpsB, labelB); NumberFormat mzForm = MZmineCore.getConfiguration().getMZFormat(); NumberFormat intensityFormat = new DecimalFormat("0.#"); // set the X axis (retention time) properties NumberAxis xAxis = new NumberAxis("m/z"); xAxis.setNumberFormatOverride(mzForm); xAxis.setUpperMargin(0.08); xAxis.setLowerMargin(0.00); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); xAxis.setAutoRangeIncludesZero(false); xAxis.setMinorTickCount(5); PseudoSpectraRenderer renderer1 = new PseudoSpectraRenderer(Color.BLACK, false); PseudoSpectraRenderer renderer2 = new PseudoSpectraRenderer(Color.BLACK, false); // create subplot 1... final NumberAxis rangeAxis1 = new NumberAxis("rel. intensity [%]"); final XYPlot subplot1 = new XYPlot(data, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); rangeAxis1.setNumberFormatOverride(intensityFormat); rangeAxis1.setAutoRangeIncludesZero(true); rangeAxis1.setAutoRangeStickyZero(true); // create subplot 2... final NumberAxis rangeAxis2 = new NumberAxis("rel. intensity [%]"); rangeAxis2.setNumberFormatOverride(intensityFormat); rangeAxis2.setAutoRangeIncludesZero(true); rangeAxis2.setAutoRangeStickyZero(true); rangeAxis2.setInverted(true); final XYPlot subplot2 = new XYPlot(dataMirror, null, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // set the plot properties plot.setBackgroundPaint(Color.white); plot.setAxisOffset(RectangleInsets.ZERO_INSETS); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); // return a new chart containing the overlaid plot... JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(Color.white); chart.getTitle().setVisible(false); // chart.getXYPlot().setRangeZeroBaselineVisible(true); chart.getTitle().setVisible(showTitle); chart.getLegend().setVisible(showLegend); return new EChartPanel(chart); }
Example 6
Source File: SpectrumChartFactory.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public static JFreeChart createChart(PseudoSpectrumDataSet dataset, boolean showTitle, boolean showLegend, double rt, double precursorMZ) { // if (dataset == null) return null; // NumberFormat mzForm = MZmineCore.getConfiguration().getMZFormat(); NumberFormat rtForm = MZmineCore.getConfiguration().getRTFormat(); NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); String title = ""; if (precursorMZ == 0) title = "RT=" + mzForm.format(precursorMZ); else title = MessageFormat.format("MSMS for m/z={0} RT={1}", mzForm.format(precursorMZ), rtForm.format(rt)); JFreeChart chart = ChartFactory.createXYLineChart(title, // title "m/z", // x-axis label "Intensity", // y-axis label dataset, // data set PlotOrientation.VERTICAL, // orientation true, // isotopeFlag, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); chart.getTitle().setVisible(false); // set the plot properties XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(RectangleInsets.ZERO_INSETS); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); // set the X axis (retention time) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setNumberFormatOverride(mzForm); xAxis.setUpperMargin(0.08); xAxis.setLowerMargin(0.00); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); xAxis.setAutoRangeIncludesZero(true); xAxis.setMinorTickCount(5); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setNumberFormatOverride(intensityFormat); yAxis.setUpperMargin(0.20); PseudoSpectraRenderer renderer = new PseudoSpectraRenderer(Color.BLACK, false); plot.setRenderer(0, renderer); plot.setRenderer(1, renderer); plot.setRenderer(2, renderer); renderer.setSeriesVisibleInLegend(1, false); renderer.setSeriesPaint(2, Color.ORANGE); // chart.getTitle().setVisible(showTitle); chart.getLegend().setVisible(showLegend); // if (precursorMZ != 0) addPrecursorMarker(chart, precursorMZ); return chart; }
Example 7
Source File: PseudoSpectrum.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public static JFreeChart createChart(PseudoSpectrumDataSet dataset, RawDataFile raw, boolean sum, String title) { // JFreeChart chart = ChartFactory.createXYLineChart(title, // title "m/z", // x-axis label "Intensity", // y-axis label dataset, // data set PlotOrientation.VERTICAL, // orientation true, // isotopeFlag, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); chart.getTitle().setVisible(false); // set the plot properties XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(RectangleInsets.ZERO_INSETS); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat(); NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); // set the X axis (retention time) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setNumberFormatOverride(mzFormat); xAxis.setUpperMargin(0.08); xAxis.setLowerMargin(0.00); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); xAxis.setAutoRangeIncludesZero(true); xAxis.setMinorTickCount(5); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setNumberFormatOverride(intensityFormat); yAxis.setUpperMargin(0.20); PseudoSpectraRenderer renderer = new PseudoSpectraRenderer(Color.BLACK, false); plot.setRenderer(0, renderer); plot.setRenderer(1, renderer); plot.setRenderer(2, renderer); renderer.setSeriesVisibleInLegend(1, false); renderer.setSeriesPaint(2, Color.ORANGE); // return chart; }
Example 8
Source File: HistogramChart.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public HistogramChart() { super(null, true); // initialize the chart by default time series chart from factory chart = ChartFactory.createHistogram("", // title "", // x-axis label "", // y-axis label null, // data set PlotOrientation.VERTICAL, // orientation true, // create legend false, // generate tooltips false // generate URLs ); // title chartTitle = chart.getTitle(); chartTitle.setFont(titleFont); chartTitle.setMargin(5, 0, 0, 0); chartSubTitle = new TextTitle(); chartSubTitle.setFont(subTitleFont); chartSubTitle.setMargin(5, 0, 0, 0); chart.addSubtitle(chartSubTitle); // legend constructed by ChartFactory LegendTitle legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); chart.setBackgroundPaint(Color.white); setChart(chart); // disable maximum size (we don't want scaling) setMaximumDrawWidth(Integer.MAX_VALUE); setMaximumDrawHeight(Integer.MAX_VALUE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(true); // set the logarithmic axis NumberAxis axisDomain = new HistogramDomainAxis(); axisDomain.setMinorTickCount(1); axisDomain.setAutoRange(true); NumberAxis axisRange = new NumberAxis(); axisRange.setMinorTickCount(1); axisRange.setAutoRange(true); plot.setDomainAxis(axisDomain); plot.setRangeAxis(axisRange); ClusteredXYBarRenderer renderer = new ClusteredXYBarRenderer(); renderer.setMargin(marginSize); renderer.setShadowVisible(false); plot.setRenderer(renderer); this.setMinimumSize(new Dimension(400, 400)); this.setDismissDelay(Integer.MAX_VALUE); this.setInitialDelay(0); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }
Example 9
Source File: ScatterPlot.java From Benchmark with GNU General Public License v2.0 | 4 votes |
public void initializePlot( XYPlot xyplot ) { NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis(); NumberAxis domainAxis = (NumberAxis) xyplot.getDomainAxis(); rangeAxis.setRange(-9.99, 109.99); rangeAxis.setNumberFormatOverride(pctFormat); rangeAxis.setTickLabelPaint(Color.decode("#666666")); rangeAxis.setMinorTickCount(5); rangeAxis.setTickUnit(new NumberTickUnit(10)); rangeAxis.setAxisLineVisible(true); rangeAxis.setMinorTickMarksVisible(true); rangeAxis.setTickMarksVisible(true); rangeAxis.setLowerMargin(10); rangeAxis.setUpperMargin(10); domainAxis.setRange(-5, 175); domainAxis.setNumberFormatOverride(pctFormat); domainAxis.setTickLabelPaint(Color.decode("#666666")); domainAxis.setMinorTickCount(5); domainAxis.setTickUnit(new NumberTickUnit(10)); domainAxis.setAxisLineVisible(true); domainAxis.setTickMarksVisible(true); domainAxis.setMinorTickMarksVisible(true); domainAxis.setLowerMargin(10); domainAxis.setUpperMargin(10); xyplot.setRangeGridlineStroke(new BasicStroke()); xyplot.setRangeGridlinePaint(Color.lightGray); xyplot.setRangeMinorGridlinePaint(Color.decode("#DDDDDD")); xyplot.setRangeMinorGridlinesVisible(true); xyplot.setOutlineVisible(true); xyplot.setDomainGridlineStroke(new BasicStroke()); xyplot.setDomainGridlinePaint(Color.lightGray); xyplot.setDomainMinorGridlinePaint(Color.decode("#DDDDDD")); xyplot.setDomainMinorGridlinesVisible(true); xyplot.getRenderer().setSeriesPaint(0, Color.decode("#4572a7")); chart.setTextAntiAlias(true); chart.setAntiAlias(true); chart.removeLegend(); chart.setPadding(new RectangleInsets(20, 20, 20, 20)); Point2D legendLocation = new Point2D.Double( 101, -10 ); makeRect(xyplot, legendLocation, 120, 74, Color.WHITE ); Point2D triangleLocation = new Point2D.Double( 101, -10 ); Color grey = new Color(0.1f,0.1f,0.1f,0.1f); makeTriangle(xyplot, triangleLocation, grey ); makeGuessingLine( xyplot ); }