Guest User

plot.c

a guest
Dec 18th, 2014
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #define _XOPEN_SOURCE
  2. #include <stdio.h>
  3.  
  4. int main(void)
  5. {
  6.     FILE *plot = popen("gnuplot", "w");
  7.     fprintf(plot, "plot '-' using 1:2 with lines\n");
  8.     for (int x = -8; x <= 8; x++)
  9.         fprintf(plot, "%d %d\n", x, x * x);
  10.     fprintf(plot, "e\n");
  11.     fflush(plot);
  12.     getchar(); // wait
  13.     return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment