Example usage for weka.gui.visualize VisualizePanel setMasterPlot

List of usage examples for weka.gui.visualize VisualizePanel setMasterPlot

Introduction

In this page you can find the example usage for weka.gui.visualize VisualizePanel setMasterPlot.

Prototype

public void setMasterPlot(PlotData2D newPlot) throws Exception 

Source Link

Document

Set the master plot for the visualize panel

Usage

From source file:adams.gui.menu.InstancesPlot.java

License:Open Source License

/**
 * Launches the functionality of the menu item.
 *///from   ww w .jav  a  2 s . c  o  m
@Override
public void launch() {
    File file;
    AbstractFileLoader loader;
    if (m_Parameters.length == 0) {
        // choose file
        int retVal = m_FileChooser.showOpenDialog(getOwner());
        if (retVal != JFileChooser.APPROVE_OPTION)
            return;
        file = m_FileChooser.getSelectedFile();
        loader = m_FileChooser.getLoader();
    } else {
        file = new PlaceholderFile(m_Parameters[0]).getAbsoluteFile();
        loader = ConverterUtils.getLoaderForFile(file);
    }

    // build plot
    VisualizePanel panel = new VisualizePanel();
    getLogger().severe("Loading instances from " + file);
    try {
        loader.setFile(file);
        Instances i = loader.getDataSet();
        i.setClassIndex(i.numAttributes() - 1);
        PlotData2D pd1 = new PlotData2D(i);
        pd1.setPlotName("Master plot");
        panel.setMasterPlot(pd1);
    } catch (Exception e) {
        getLogger().log(Level.SEVERE, "Failed to load: " + file, e);
        GUIHelper.showErrorMessage(getOwner(),
                "Error loading file '" + file + "':\n" + Utils.throwableToString(e));
        return;
    }

    // create frame
    ChildFrame frame = createChildFrame(panel, GUIHelper.getDefaultDialogDimension());
    frame.setTitle(frame.getTitle() + " - " + file);
}