0
當我編寫一個C++程序,包括通過管道使用GNU-Plot時,繪製了繪圖,但是缺少所有的x11交互性,例如,下面的代碼基於HEREC++ GNU-Plot在x11窗口中是非交互的
int main()
{
FILE *pipe = popen("gnuplot -persist","w");
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 x11\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");
fprintf(pipe, "splot cos(x)+cos(y)\n");
pclose(pipe);
return 0;
}
不過,如果我打開一個命令行,運行gnuplot,然後手動輸入所有的命令,全交互存在,即,縮放,旋轉等...
有人知道如何通過C++程序調用GNU-Plot來獲得交互性嗎?
感謝百萬... –