public void redraw() {
		// Create the bitmap and draw the plot
		bitmap = new BufferedImage( SIZE_X, SIZE_Y, BufferedImage.TYPE_INT_ARGB );
		Graphics2D g2 = (Graphics2D) bitmap.getGraphics();
		// draw the background white
		g2.setColor( Color.white );
		g2.fillRect( 0, 0, SIZE_X, SIZE_Y );
		g2.setFont( MainAndDownloadUI.FONT );
		FontMetrics fontMetrics = g2.getFontMetrics();
		int strheight = fontMetrics.getAscent() - fontMetrics.getDescent();
		int maxWidth = 0;
		for ( int i = 0; i < DIVISION_Y; i++ ) {
			int width = fontMetrics.stringWidth( String.format( "%01.3f", minY + ( ( maxY - minY ) / DIVISION_Y * i ) ) );
			if ( width > maxWidth )
				maxWidth = width;
		}
		_leftMargin = strheight + maxWidth + 4 * GAP;
		_rightMargin = fontMetrics.stringWidth( String.format( "%01.3f", maxX ) ) / 2 + GAP;
		_topMargin = strheight / 2 + GAP;
		_bottomMargin = 2 * strheight + 4 * GAP;

		// draw a line for each data point
		for ( int i = 0; i < _elements.size(); i++ ) {
			g2.setColor( _elements.get(i).getColor() );
			for ( int j = 0; j < xdata.get( i ).size() - 1; j++ ) {
				g2.draw( new Line2D.Float( pixelX( xdata.get( i ).get( j ) ), pixelY( ydata.get( i ).get( j ) ), pixelX( xdata.get( i ).get( j + 1 ) ),
						pixelY( ydata.get( i ).get( j + 1 ) ) ) );
			}
		}

		// draw the axes
		g2.setColor( Color.black );
		g2.draw( new Line2D.Float( pixelX( minX ), pixelY( minY ), pixelX( maxX ), pixelY( minY ) ) );
		g2.draw( new Line2D.Float( pixelX( minX ), pixelY( minY ), pixelX( minX ), pixelY( maxY ) ) );
		String xaxislabel = "Wavelength (\u00C5)";
		g2.drawString( xaxislabel, pixelX( ( maxX + minX ) / 2 ) - fontMetrics.stringWidth( xaxislabel ) / 2, pixelY( minY ) + 3 * GAP + 2 * strheight );

		if ( _ratio ) {
			g2.setStroke( new BasicStroke( 0, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 1f, new float[] { 5 }, 0 ) );
			g2.draw( new Line2D.Float( pixelX( minX ), pixelY( 1 ), pixelX( maxX ), pixelY( 1 ) ) );
			AffineTransform identity = g2.getTransform();
			g2.transform( AffineTransform.getRotateInstance( -Math.PI / 2, pixelX( minX ) - 3 * GAP - maxWidth - strheight / 2, pixelY( ( maxY + minY ) / 2 ) ) );
			String yaxislabel = "Ratio Between Flux";
			float yaxislabelwidth = fontMetrics.stringWidth( yaxislabel );
			g2.drawString( yaxislabel, pixelX( minX ) - 3 * GAP - maxWidth - strheight / 2 - yaxislabelwidth / 2, pixelY( ( maxY + minY ) / 2 ) + strheight / 2 );
			g2.setTransform( identity );
		} else {
			// label access with units of flux (rotated and positioned at center height and margin-left)
			AffineTransform identity = g2.getTransform();
			g2.transform( AffineTransform.getRotateInstance( -Math.PI / 2, pixelX( minX ) - 3 * GAP - maxWidth - strheight / 2, pixelY( ( maxY + minY ) / 2 ) ) );
			AttributedString yaxislabel = new AttributedString( "Flux (10-17 erg/(cm*s2*\u00C5))" );

			yaxislabel.addAttribute( TextAttribute.FONT, MainAndDownloadUI.FONT );
			yaxislabel.addAttribute( TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER, 8, 11 );
			yaxislabel.addAttribute( TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER, 21, 22 );

			AttributedCharacterIterator iterator = yaxislabel.getIterator();
			float yaxislabelwidth = (float) fontMetrics.getStringBounds( iterator, iterator.getBeginIndex(), iterator.getEndIndex(), g2 ).getWidth();
			g2.drawString( iterator, pixelX( minX ) - 3 * GAP - maxWidth - strheight / 2 - yaxislabelwidth / 2, pixelY( ( maxY + minY ) / 2 ) + strheight / 2 );
			g2.setTransform( identity );
		}
		for ( int i = 0; i <= DIVISION_X; i++ ) {
			// draw the x axis tick marks
			g2.draw( new Line2D.Float( divX( i ), pixelY( minY ), divX( i ), pixelY( minY ) + GAP ) );
			// and the labels for each tick mark (centered)
			String xlbl = String.format( "%01.3f", minX + ( ( maxX - minX ) / DIVISION_X * i ) );
			g2.drawString( xlbl, divX( i ) - fontMetrics.stringWidth( xlbl ) / 2, pixelY( minY ) + 2 * GAP + strheight );
		}
		for ( int i = 0; i <= DIVISION_Y; i++ ) {
			// draw the y axis tick marks
			g2.draw( new Line2D.Float( pixelX( minX ), divY( i ), pixelX( minX ) - GAP, divY( i ) ) );
			// and the labels for each tick mark (centered)
			String ylbl = String.format( "%01.3f", minY + ( ( maxY - minY ) / DIVISION_Y * i ) );
			g2.drawString( ylbl, pixelX( minX ) - 2 * GAP - fontMetrics.stringWidth( ylbl ), divY( i ) + strheight / 2 );
		}
		repaint();
	}