0

I want to compare time series data in just one graphic. I added several data sets to same plot and plot it - just one data set is shown. Documentation missing, existing questions useless..

Question: Why is just one data set represented? And also, why is its' title not used to create a legend?

My code (sniped):

//first, create terminal to write png files (not shown)
..

//create the three data sets (just shown for first data set here)
double[][] original = combinedSequence.getOriginalValues();
AbstractPlot originalPlot = new DataSetPlot(original);
originalPlot.setTitle("'original'");
..

//add the three data set plots
p.addPlot(originalPlot);
p.addPlot(offsetPlot);
p.addPlot(functionPlot);

//plot graph
p.newGraph();
p.plot();

1 Answer 1

0

Two things:

  1. newGraph() should be set before any subplot
  2. titles should not have '

So, a correct version of your code will be:

    double[][] original1 = {{2,3},{4,5},{6,7}};
    double[][] original2 = {{8,9},{12,13},{14,15}};
    AbstractPlot originalPlot = new DataSetPlot(original1);
    originalPlot.setTitle("original1");
    AbstractPlot originalPlot2 = new DataSetPlot(original2);
    originalPlot2.setTitle("original2");

    JavaPlot p = new JavaPlot();

    p.addPlot(originalPlot);
    p.newGraph();
    p.addPlot(originalPlot2);

    p.plot();
Sign up to request clarification or add additional context in comments.

Comments

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.