Package ptolemy.plot

Examples of ptolemy.plot.Plot$Format


    /** Create a new plot. In this base class, it is an instance of Plot.
     *  In derived classes, it can be classes derived from Plot.
     *  @return A new plot object.
     */
    protected PlotBox _newPlot() {
        return new Plot();
    }
View Full Code Here


        if (actor.plot == null) {
            try {
                actor.initialize();
            } catch (IllegalActionException ex) {
                // Ignore this, we probably don't have a configuration.
                actor.plot = new Plot();
            }
        }

        StringWriter stringWriter = new StringWriter();
        PrintWriter printWriter = new PrintWriter(stringWriter);
View Full Code Here

                NamedObj container = object.getContainer();

                _taskMap = new HashMap();
                _taskState = new ArrayList();
                plot = new Plot();
                plot.setTitle("TM Schedule");
                plot.setButtons(true);

                // We put the plotter as a sub-effigy of the toplevel effigy,
                // so that it closes when the model is closed.
View Full Code Here

        try {
            _dataInputStream = new DataInputStream(in);
            _sound = new Audio(_dataInputStream);

            // Configure the plot.
            Plot plt = (Plot) plot;
            plt.clear(true);
            plt.setXRange(0, (_sound.size - 1) / 8000.0);
            plt.setXLabel("Time in seconds");
            plt.setYRange(-1.0, 1.0);

            double[] pltdata = _sound.toDouble(0);

            if (pltdata != null) {
                plt.addPoint(0, 0, pltdata[0], false);

                for (int i = 1; i < pltdata.length; i++) {
                    plt.addPoint(0, i / 8000.0, pltdata[i], true);
                }
            }

            plt.repaint();
        } catch (IOException ex) {
            cleanup();

            // FIXME: fill in stack trace?
            IOException newException = new IOException();
View Full Code Here

        PolarToCartesian polarToCartesian = new PolarToCartesian(this,
                "Polar to Cartesian");

        // Finally, the plotter.
        XYPlotter xyPlotter = new XYPlotter(this, "xyPlotter");
        xyPlotter.plot = new Plot();
        xyPlotter.plot.setGrid(false);
        xyPlotter.plot.setXRange(-3, 4);
        xyPlotter.plot.setYRange(-4, 4);

        // Make the connections.
View Full Code Here

        Const source = new Const(this, "Const");
        source.value.setToken(new DoubleToken(1.0));

        // the plot
        TimedPlotter responsePlot = new TimedPlotter(this, "plot");
        Plot newPlot = new Plot();
        responsePlot.plot = newPlot;
        newPlot.setGrid(true);
        newPlot.setTitle("Thermostat");
        newPlot.addLegend(0, "Temperature");
        newPlot.setConnected(true);
        newPlot.setImpulses(false);

        //newPlot.addLegend(1, "Trigger");
        newPlot.setXRange(0.0, 5.0);
        newPlot.setYRange(0.0, 0.2);
        newPlot.setSize(500, 300);

        CTCompositeActor hs = new CTCompositeActor(this, "HS");

        // the ports
        TypedIOPort hsin = (TypedIOPort) hs.newPort("input");
View Full Code Here

        if (actor.plot == null) {
            try {
                actor.initialize();
            } catch (IllegalActionException ex) {
                // Ignore this, we probably don't have a configuration.
                actor.plot = new Plot();
            }
        }

        StringWriter stringWriter = new StringWriter();
        PrintWriter printWriter = new PrintWriter(stringWriter);
View Full Code Here

    /** Construct a plot with the specified command-line arguments.
     *  @param args The command-line arguments.
     *  @exception Exception If command line arguments have problems.
     */
    public PlotMLApplication(String[] args) throws Exception {
        this(new Plot(), args);
    }
View Full Code Here

    public static void main(final String[] args) {
        try {
            Runnable doActions = new Runnable() {
                public void run() {
                    try {
                        new PlotMLApplication(new Plot(), args);
                    } catch (Exception ex) {
                        System.err.println(ex.toString());
                        ex.printStackTrace();
                    }
                }
View Full Code Here

     *  directly on the Frame.  The main method is static
     *  so getting at the Frame is a little trickier.
     */
    TwoPlotExample() {
        // Instantiate the two plots.
        Plot leftPlot = new Plot();
        Plot rightPlot = new Plot();

        // Set the size of the toplevel window.
        setSize(800, 300);

        // Create the left plot by calling methods.
        // Note that most of these methods should be called in
        // the event thread, see the Plot.java class comment.
        // In this case, main() is invoking this constructor in
        // the event thread.
        leftPlot.setSize(350, 300);
        leftPlot.setButtons(true);
        leftPlot.setTitle("Left Plot");
        leftPlot.setYRange(-4, 4);
        leftPlot.setXRange(0, 100);
        leftPlot.setXLabel("time");
        leftPlot.setYLabel("value");
        leftPlot.addYTick("-PI", -Math.PI);
        leftPlot.addYTick("-PI/2", -Math.PI / 2);
        leftPlot.addYTick("0", 0);
        leftPlot.addYTick("PI/2", Math.PI / 2);
        leftPlot.addYTick("PI", Math.PI);
        leftPlot.setMarksStyle("none");
        leftPlot.setImpulses(true);

        // Call setConnected before reading in data.
        leftPlot.setConnected(false, 1);

        boolean first = true;

        for (int i = 0; i <= 100; i++) {
            leftPlot.addPoint(0, i, 5 * Math.cos((Math.PI * i) / 20), !first);
            leftPlot.addPoint(1, i, 4.5 * Math.cos((Math.PI * i) / 25), !first);
            leftPlot.addPoint(2, i, 4 * Math.cos((Math.PI * i) / 30), !first);
            leftPlot.addPoint(3, i, 3.5 * Math.cos((Math.PI * i) / 35), !first);
            leftPlot.addPoint(4, i, 3 * Math.cos((Math.PI * i) / 40), !first);
            leftPlot.addPoint(5, i, 2.5 * Math.cos((Math.PI * i) / 45), !first);
            leftPlot.addPoint(6, i, 2 * Math.cos((Math.PI * i) / 50), !first);
            leftPlot.addPoint(7, i, 1.5 * Math.cos((Math.PI * i) / 55), !first);
            leftPlot.addPoint(8, i, 1 * Math.cos((Math.PI * i) / 60), !first);
            leftPlot.addPoint(9, i, 0.5 * Math.cos((Math.PI * i) / 65), !first);
            first = false;
        }

        // Create the right plot by reading in a file.
        rightPlot.setButtons(true);
        leftPlot.setSize(350, 300);

        File file = new File(".", "data.plt");

        try {
            rightPlot.clear(true);
            rightPlot.read(new FileInputStream(file));
        } catch (FileNotFoundException ex) {
            System.err.println("File not found: " + file + " : " + ex);
        } catch (IOException ex) {
            System.err.println("Error reading input: " + file + " : " + ex);
        }

        // Override the title in the file.
        rightPlot.setTitle("Right Plot");

        // Layout the two plots
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        getContentPane().setLayout(gridbag);
View Full Code Here

TOP

Related Classes of ptolemy.plot.Plot$Format

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.