I have created the gnuplot, but the problem is that it disappears immediately. I tried different solutions proposed in other threads, but none of them worked. S
Look into the -persist option to pass to gnuplot, you could probably change the third line in your code to
GNUPlot gp = new GNUPlot("C:\\Program Files (x86)\\gnuplot\\bin\\pgnuplot.exe -persist");
or
GNUPlot gp = new GNUPlot("C:\\Program Files (x86)\\gnuplot\\bin\\pgnuplot.exe /noend");
Here is my source.