private void init(String x_label, String y_label, String window_title)
	{
        chart = ChartFactory.createScatterPlot("",
                x_label, y_label, data, PlotOrientation.VERTICAL, false, true,
                false);

        // turn off borders of the plot:
        XYPlot p = chart.getXYPlot();
        p.getDomainAxis().setLowerMargin(0.0);
        p.getDomainAxis().setUpperMargin(0.0);
        p.getRangeAxis().setLowerMargin(0.0);
        p.getRangeAxis().setUpperMargin(0.0);

        // --------------------------------------------
        //          set up a lookup table
        // --------------------------------------------
        // this is how we render the block plots:
        XYBlockRenderer renderer = new XYBlockRenderer();
        // need to find max and min z of the data set:
        double min = 0; double max = 0;
        for(int i=0; i < data.getSeriesCount(); i++) // iterate over data sets
        {
            for(int j=0; j<data.getItemCount(i); j++) // iterate over points in dataset
            {
                if( data.getZValue(i,j) < min )
                    min = data.getZValue(i,j);
                else if( data.getZValue(i,j) > max )
                    max = data.getZValue(i,j);
            }
        }
        // create paint scale using min and max values, default color black:
        LookupPaintScale paintScale = new LookupPaintScale(min, max, Color.black);
        // set up the LUT:
        double step_size = (max-min)/255.; // step size for LUT
        for(int i=0; i < 256; i++)
        {
            paintScale.add( min+i*step_size , new Color(i,i,i,255));
        }
        renderer.setPaintScale(paintScale);
        // set this renderer to the plot:
        p.setRenderer(renderer);

        // --------------------------------------------
        //          set up a color bar
        // --------------------------------------------
        // create an array of display labels:
        num_labels = 10; // default to 10 labels on color bar
        double display_step_size = (max-min)/((double)num_labels);
        String[] scale_bar_labels = new String[num_labels+1];
        // to format numbers in scientific notation:
        DecimalFormat formater = new DecimalFormat("0.#E0");
        // create list of labesl:
        for(int i=0; i <= num_labels; i++)
        {
            scale_bar_labels[i] = formater.format(min+i*display_step_size);
        }
        // create axis:
        SymbolAxis scaleAxis = new SymbolAxis(null, scale_bar_labels);
        scaleAxis.setRange(min, max);
        scaleAxis.setPlot(new PiePlot());
        scaleAxis.setGridBandsVisible(false);
        // set up the paint scale:
        psl = new PaintScaleLegend(paintScale, scaleAxis);
        psl.setBackgroundPaint(new Color(255,255,255,0)); // clear background
        // set up frame with buffer region to allow text display
        psl.setFrame(new LineBorder( (Paint)Color.BLACK, 
            new BasicStroke((float)1.0),
            new RectangleInsets(15, 10, 15, 10)));
        psl.setAxisOffset(5.0);
        // display on right side:
        psl.setPosition(RectangleEdge.RIGHT);
        // margin around color scale:
        psl.setMargin(new RectangleInsets(20, 15, 20, 15));
        // add to the chart so it will be displayed by default:
        chart.addSubtitle(psl); 

        // --------------------------------------------
        //          WINDOW-RELATED UI
        // --------------------------------------------
        // set up the generic plot UI:
        super.window_title = window_title;
		super.initUI();

		// add another menu item
		JMenuBar mb = super.getJMenuBar(); // get the menu bar
        // find menu named "Plot"
        JMenu menu_plot = null;
        for(int i=0; i<mb.getMenuCount(); i++)
        {
            if(mb.getMenu(i).getText() == "Plot")
                menu_plot = mb.getMenu(i);
        }
        // Add a new checkbox for the color scale bar
        JCheckBoxMenuItem menu_plot_scalebar = new JCheckBoxMenuItem("Color Scale");
        menu_plot_scalebar.setToolTipText("Show color scale bar?");
        menu_plot_scalebar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                AbstractButton aButton = (AbstractButton) event.getSource();
                boolean selected = aButton.getModel().isSelected();
                setScaleBar(selected);
            }
        });
        // set appropirate checkbox state:
        menu_plot_scalebar.setState(true);
        if( menu_plot != null ) // sanity check
            menu_plot.add(menu_plot_scalebar);

	}