Created
November 1, 2016 19:54
-
-
Save Hajto/6f8c0e40d193b03f0fe70891b0f6fee5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#define NUM_POINTS 5 | |
#define NUM_COMMANDS 2 | |
int main() | |
{ | |
char * commandsForGnuplot[] = {"set title \"TITLEEEEE\"", "plot 'data.temp'"}; | |
double xvals[NUM_POINTS] = {1.2, 2.0, 3.0, 4.0, 4.5}; | |
double yvals[NUM_POINTS] = {4.8 ,3.0, 1.0, 3.0, 3.23}; | |
FILE * gnuplotPipe = popen ("gnuplot -persistent", "w"); | |
fprintf(gnuplotPipe, "plot '-' \n"); | |
int i; | |
for (int i = 0; i < NUM_POINTS; i++) | |
{ | |
fprintf(gnuplotPipe, "%lf %lf\n", xvals[i], yvals[i]); | |
} | |
fprintf(gnuplotPipe, "e"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment