public void paint(Graphics g) {
		int x, y;
		int top = vertSpace;
		int bottom = getSize().height - vertSpace;
		int left = horzSpace;
		int right = getSize().width - horzSpace;
		int width = right - left;
		int fullHeight = bottom - top;
		int centre = (top + bottom) / 2;
		int xAxisPos = centre;
		int yHeight = fullHeight / 2;

		// Teken initiele zaken
		super.paintComponent(g);

		if (plotStyle == SPECTRUM) {
			xAxisPos = bottom;
			yHeight = fullHeight;
		}
		this.setBackground(bgColor);
		if (logScale) {
			xAxisPos = top;
			g.setColor(gridColor);
			// vertical grid lines
			for (int i = 0; i <= vertIntervals; i++) {
				x = left + i * width / vertIntervals;
				g.drawLine(x, top, x, bottom);
			}
			// horizontal grid lines
			for (int i = 0; i <= horzIntervals; i++) {
				y = top + i * fullHeight / horzIntervals;
				g.drawLine(left, y, right, y);
			}
		}
		g.setColor(axisColor);
		g.drawLine(left, top, left, bottom); // vertical axis
		g.drawLine(left, xAxisPos, right, xAxisPos); // horizontal axis

		if (nPoints != 0) {
			g.setColor(plotColor);
			// horizontal scale factor:
			xScale = width / (float) (nPoints - 1);
			// vertical scale factor:
			yScale = yHeight / ymax;
			int[] xCoords = new int[nPoints];
			int[] yCoords = new int[nPoints];
			for (int i = 0; i < nPoints; i++) {
				xCoords[i] = left + Math.round(i * xScale);
				yCoords[i] = xAxisPos - Math.round(plotValues[i] * yScale);
			}
			if (tracePlot)
				for (int i = 0; i < nPoints - 1; i++)
					g.drawLine(xCoords[i], yCoords[i], xCoords[i + 1],
							yCoords[i + 1]);
			else {
				for (int i = 0; i < nPoints; i++)
					g.drawLine(xCoords[i], xAxisPos, xCoords[i], yCoords[i]);
			}
		}
	}