pBook‎ > ‎Plot C++‎ > ‎

GunPlot

posted Sep 21, 2014, 5:27 PM by Javad Taghia   [ updated Sep 21, 2014, 5:27 PM ]
1. Install GunPlot; in installation steps "tick" the option about setting the environment variable (you need to select it, it's not set by default installation, in the third step when the set up wizard asks about some custom setting  scroll down the last option needs to be ticked).
2. GunPlot commands to a text file:

#include "stdafx.h"
#include <Windows.h>

int main()
{
//The file "RunThisScript.txt" contains the following:

//set term png
//set output 'C:\Users\Simon\Desktop\ThisOutput.png'
//plot sin(x)
//quit

ShellExecute(NULL, L"open", L"C:\\Program Files (x86)\\gnuplot\\bin\\wgnuplot.exe", \
		L"C:\\Users\\Simon\\Desktop\\RunThisScript.txt", NULL, SW_SHOWNORMAL); 

	return 0;
}
Comments