0

I am able to plot simple graphs of sinx cosx graph using gnuplot. But I am not able to update it in real time. By real time, I mean to say that its x-axis should change automatically. How can I do that.?

Here is the code for simple sinx plotting:

#include <stdio.h>

int main()
{
     FILE *fp;
     fp = popen("gnuplot -persist","w");
     fprintf(fp, " plot[-5:5] sin(x)\n");
     pclose(fp);
     return 0;
}

This code plots a graph of sinx with x-axis range of -5 to 5, but how will I set the range in case of real time. How to plot a real time graph, please help, thanks.!

Ali
  • 43
  • 1
  • 4
  • Why do you want to do this from c, do you rather want to use a library instead of calling gnuplot? – martin Apr 24 '15 at 07:14
  • @martin because the complete project is in c and I have to integrate it. Do you have any idea how to do this? – Ali Apr 24 '15 at 07:27
  • Does it need to be gnuplot, can't you use a diffrent graph library? – martin Apr 24 '15 at 07:46
  • @martin yes i can use different graph library, if you know please suggest me, but it should be through c language. – Ali Apr 24 '15 at 07:59
  • In the linked duplicate, they also mention the solution with popen and that you should use the replot command after changing your axis. If that solves your problem, makr it as a duplicate, if not, edit your question to show the difference. – martin Apr 24 '15 at 08:08

0 Answers0