Adjusts a Calibration object to fit the current axes. For log axes, the calibration refers to the base-10 logarithm of the value
(Calibration cal)
| 1725 | /** Adjusts a Calibration object to fit the current axes. |
| 1726 | * For log axes, the calibration refers to the base-10 logarithm of the value */ |
| 1727 | public void adjustCalibration(Calibration cal) { |
| 1728 | if (xMin == xMax) //tiff images can't handle infinity in scale, see TiffEncoder.writeScale |
| 1729 | xScale = 1e6; |
| 1730 | if (yMin == yMax) |
| 1731 | yScale = 1e6; |
| 1732 | cal.xOrigin = xBasePxl-xMin*xScale; |
| 1733 | cal.pixelWidth = 1.0/Math.abs(xScale); //Calibration must not have negative pixel size |
| 1734 | cal.yOrigin = yBasePxl+yMin*yScale; |
| 1735 | cal.pixelHeight = 1.0/Math.abs(yScale); |
| 1736 | cal.setInvertY(yScale >= 0); |
| 1737 | cal.setXUnit(" "); // avoid 'pixels' for scaled units |
| 1738 | if (xMin == xMax) |
| 1739 | xScale = Double.POSITIVE_INFINITY; |
| 1740 | if (yMin == yMax) |
| 1741 | yScale = Double.POSITIVE_INFINITY; |
| 1742 | } |
| 1743 | |
| 1744 | /** Displays the plot in a PlotWindow. |
| 1745 | * Plot stacks are shown in a StackWindow, not in a PlotWindow; |
no test coverage detected