【发布时间】:2016-06-25 21:26:31
【问题描述】:
我想在使用 gnuplot 的 c++ 应用程序中打印一些数据。关键是我想要一个 png 输出。当我使用终端时,它工作得很好,所以我得到了我想要的,但是当我通过我的应用程序这样做时,我不知道为什么不生成 output.png。这是我做的一个例子:
//---GNUplot
FILE *pipe;
pipe = popen("/usr/local/bin/gnuplot --persist", "w");
if (pipe != NULL){
fprintf(pipe, "set samples 40\n");
fprintf(pipe, "set isosamples 40\n");
fprintf(pipe, "set hidden3d\n");
fprintf(pipe, "set xrange [-8.000:8.000]\n");
fprintf(pipe, "set yrange [-8.000:8.000]\n");
fprintf(pipe, "set zrange [-2.000:2.000]\n");
fprintf(pipe, "set terminal png\n");
fprintf(pipe, "set output 'jose.png'\n");
fprintf(pipe, "set title 'We are plotting from C'\n");
fprintf(pipe, "set xlabel 'Label X'\n");
fprintf(pipe, "set ylabel 'Label Y'\n");
pclose(pipe);
}
//---end
任何关于我做错了什么的线索??
在此先感谢
何塞
【问题讨论】:
-
您遇到任何错误?
标签: c++ xcode macos png gnuplot