public void changeFont(Font font) { setFont(font); }
public void changeFont(Font font) { setFont(font); }
/** Sets the font size and style for all following drawLabel etc. operations. This leaves * the font name and style of the previously used fonts unchanged. The currently set font * when displaying the plot determines the font of the numbers at the axes. * That font also sets the default label font size, which may be overridden by * setAxisLabelFontSize or setXLabelFont, setYLabelFont. * After the plot has been shown, sets the font for the numbers and the legend (if present). * Styles are defined in the Font class, e.g. Font.PLAIN, Font.BOLD. * Set <code>style</code> to -1 to leave the style unchanged. * Call updateImage() thereafter to make the change visible (if the image is shown already). */ public void setFont(int style, float size) { if (size < 9) size = 9f; if (size > 24) size = 24f; Font previousFont = nonNullFont(pp.frame.getFont(), currentFont); if (style < 0) style = previousFont.getStyle(); setFont(previousFont.deriveFont(style, size)); }
/** Sets the font size and style for all following drawLabel etc. operations. This leaves * the font name and style of the previously used fonts unchanged. The currently set font * when displaying the plot determines the font of the numbers at the axes. * That font also sets the default label font size, which may be overridden by * setAxisLabelFontSize or setXLabelFont, setYLabelFont. * After the plot has been shown, sets the font for the numbers and the legend (if present). * Styles are defined in the Font class, e.g. Font.PLAIN, Font.BOLD. * Set <code>style</code> to -1 to leave the style unchanged. * Call updateImage() thereafter to make the change visible (if the image is shown already). */ public void setFont(int style, float size) { if (size < 9) size = 9f; if (size > 24) size = 24f; Font previousFont = nonNullFont(pp.frame.getFont(), currentFont); if (style < 0) style = previousFont.getStyle(); setFont(previousFont.deriveFont(style, size)); }
double setPlotFontSize(Plot plot, boolean forAxisLabels) { float size = (float)getFirstArg(); int style = -1; if (interp.nextToken()!=')') { String options = getNextString().toLowerCase(); style = 0; if (options.indexOf("bold") >= 0) style |= Font.BOLD; if (options.indexOf("ital") >= 0) style |= Font.ITALIC; } interp.getRightParen(); if (forAxisLabels) plot.setAxisLabelFont(style, size); else plot.setFont(style, size); plot.updateImage(); return Double.NaN; }
double setPlotFontSize(Plot plot, boolean forAxisLabels) { float size = (float)getFirstArg(); int style = -1; if (interp.nextToken()!=')') { String options = getNextString().toLowerCase(); style = 0; if (options.indexOf("bold") >= 0) style |= Font.BOLD; if (options.indexOf("ital") >= 0) style |= Font.ITALIC; } interp.getRightParen(); if (forAxisLabels) plot.setAxisLabelFont(style, size); else plot.setFont(style, size); plot.updateImage(); return Double.NaN; }
/** Plots a histogram of this image using the specified number of bins and returns the PlotWindow. */ public PlotWindow plotHistogram(int bins) { ImageStatistics stats = getStatistics(AREA+MEAN+MODE+MIN_MAX, bins); Plot plot = new Plot("Hist_"+getTitle(), "Value", "Frequency"); plot.setColor("black", "#999999"); plot.setFont(new Font("SansSerif",Font.PLAIN,14)); double[] y = stats.histogram(); int n = y.length; double[] x = new double[n]; int bits = getBitDepth(); boolean eightBit = bits==8 || bits==24; double min = !eightBit?stats.min:0; for (int i=0; i<n; i++) x[i] = min+i*stats.binSize; plot.add("bar", x, y); if (bins!=256) plot.addLegend(bins+" bins", "auto"); if (eightBit) plot.setLimits(0,256,0,Double.NaN); return plot.show(); }
/** Plots a histogram of this image using the specified number of bins and returns the PlotWindow. */ public PlotWindow plotHistogram(int bins) { ImageStatistics stats = getStatistics(AREA+MEAN+MODE+MIN_MAX, bins); Plot plot = new Plot("Hist_"+getTitle(), "Value", "Frequency"); plot.setColor("black", "#999999"); plot.setFont(new Font("SansSerif",Font.PLAIN,14)); double[] y = stats.histogram(); int n = y.length; double[] x = new double[n]; int bits = getBitDepth(); boolean eightBit = bits==8 || bits==24; double min = !eightBit?stats.min:0; for (int i=0; i<n; i++) x[i] = min+i*stats.binSize; plot.add("bar", x, y); if (bins!=256) plot.addLegend(bins+" bins", "auto"); if (eightBit) plot.setLimits(0,256,0,Double.NaN); return plot.show(); }
yLabel = yMultiLineLabel.replace("|", "\n"); axisLabelBold = gd.getNextBoolean(); plot.setFont('f', numberFont.deriveFont(numberFont.getStyle(), numberFontSize)); plot.setAxisLabelFont(axisLabelBold ? Font.BOLD : Font.PLAIN, labelFontSize); plot.setXYLabels(xLabel, yLabel);
yLabel = yMultiLineLabel.replace("|", "\n"); axisLabelBold = gd.getNextBoolean(); plot.setFont('f', numberFont.deriveFont(numberFont.getStyle(), numberFontSize)); plot.setAxisLabelFont(axisLabelBold ? Font.BOLD : Font.PLAIN, labelFontSize); plot.setXYLabels(xLabel, yLabel);
new PlotContentsDialog(plot, PlotContentsDialog.STYLE).showDialog(this); else if (b==menuItems[RESET_PLOT]) { plot.setFont(Font.PLAIN, Prefs.getInt(PREFS_FONT_SIZE, FONT_SIZE)); plot.setAxisLabelFont(Font.PLAIN, Prefs.getInt(PREFS_FONT_SIZE, FONT_SIZE)); plot.setFormatFlags(Plot.getDefaultFlags());
new PlotContentsDialog(plot, PlotContentsDialog.STYLE).showDialog(this); else if (b==menuItems[RESET_PLOT]) { plot.setFont(Font.PLAIN, Prefs.getInt(PREFS_FONT_SIZE, FONT_SIZE)); plot.setAxisLabelFont(Font.PLAIN, Prefs.getInt(PREFS_FONT_SIZE, FONT_SIZE)); plot.setFormatFlags(Plot.getDefaultFlags());