- 参考文章
- 示例代码
在64位Windows的VS软件中使用C/C++调用gnuplot画图
示例代码按照上述安装参考,进行安装
#includevoid main() { FILE* pipe = _popen("gnuplot", "w"); if (pipe == NULL) { //exit(-1); } fprintf(pipe, "set terminal wxt size 600, 400n"); fprintf(pipe, "unset bordern"); fprintf(pipe, "set dummy u, vn"); fprintf(pipe, "set angles degreesn"); fprintf(pipe, "set parametricn"); fprintf(pipe, "set view 60, 136, 1.22, 1.26n"); fprintf(pipe, "set samples 64, 64n"); fprintf(pipe, "set isosamples 13, 13n"); fprintf(pipe, "set mapping sphericaln"); fprintf(pipe, "set style data linesn"); fprintf(pipe, "unset xticsn"); fprintf(pipe, "unset yticsn"); fprintf(pipe, "unset zticsn"); fprintf(pipe, "set title 'Labels colored by GeV plotted in spherical coordinate system'n"); fprintf(pipe, "set urange [ -90.0000 : 90.0000 ] noreverse nowritebackn"); fprintf(pipe, "set vrange [ 0.00000 : 360.000 ] noreverse nowritebackn"); fprintf(pipe, "set xrange [ * : * ] noreverse writebackn"); fprintf(pipe, "set x2range [ * : * ] noreverse writebackn"); fprintf(pipe, "set yrange [ * : * ] noreverse writebackn"); fprintf(pipe, "set y2range [ * : * ] noreverse writebackn"); fprintf(pipe, "set zrange [ * : * ] noreverse writebackn"); fprintf(pipe, "set cblabel 'GeV'n"); fprintf(pipe, "set cbrange [ 0.00000 : 8.00000 ] noreverse nowritebackn"); fprintf(pipe, "set rrange [ * : * ] noreverse writebackn"); fprintf(pipe, "set colorbox usern"); fprintf(pipe, "set colorbox vertical origin screen 0.9, 0.2 size screen 0.02, 0.75 front noinvert bdefaultn"); fprintf(pipe, "NO_ANIMATION = 1n"); fprintf(pipe, "splot cos(u)*cos(v),cos(u)*sin(v),sin(u) notitle with lines lt 5, 'world.dat' notitle with lines lt 2, 'srl.dat' using 3:2:(1):1:4 with labels notitle point pt 6 lw .1 left offset 1,0 font ',7' tc paln"); fprintf(pipe, "pause mousen"); _pclose(pipe); }


 gnuplot学习之---[C++语法练习](曲线绘制)](http://www.mshxw.com/aiimages/31/529398.png)
