0

I was trying to monitor the change of some parameters using JavaPlot.

Is there a way to simply update the plot of data in the original plot?

1 Answer 1

0

I think you cannot do this with JavaPlot.

JavaPlot doesn't have a single gnuplot instance running in the background which it pipes commands to. For every plot it creates a new temporary file which is then called with gnuplot. That means, that after using p.plot() you don't have any access to the gnuplot window containing the plot.

Consider the following short example:

import com.panayotis.gnuplot.JavaPlot;
import com.panayotis.gnuplot.utils.Debug;

public class test {
    public static void main(String[] args) {
        JavaPlot p = new JavaPlot();
    p.getDebugger().setLevel(Debug.INFO);
        p.addPlot("sin(x)");
        p.plot();
    p.plot();
    }
}

That opens two windows and prints the messages:

** Start of plot commands **
plot sin(x) title 'sin(x)'
quit
** End of plot commands **
exec(/usr/bin/gnuplot /tmp/gnuplot_5778913101279507298.dat -persist )
** Start of plot commands **
plot sin(x) title 'sin(x)'
quit
** End of plot commands **
exec(/usr/bin/gnuplot /tmp/gnuplot_4590356376057662873.dat -persist )

You see that two different temporary files are created.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much..... I guess this means I need to write the graphic interface by myself... =( sigh
Depending on your other requirements it might be enough to extend the GNUPlotExec class to add an finite or infinite loop at the end of the script file: iter = 0; while (iter < 100) { refresh; iter = iter+1; pause 5; }.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.