gpt4 book ai didi

c++ - Gnuplot 保存许 multimap 像

转载 作者:行者123 更新时间:2023-11-30 17:37:06 25 4
gpt4 key购买 nike

我想将 gnuplot 操作的结果写入 png 文件并且成功,但是我需要生成大约 100 个 png 文件,并且在这里我遇到了问题,因为我收到错误“gnuplot 临时文件的最大数量为 27” 。当我使用方法remove_tmpfiles()时,所有图像都会正确生成,但其中大约20-30个图像无法打开。当我只保存推荐的 27 张图像时,不会出现此错误。

Gnuplot::set_GNUPlotPath( GNUPLOT_PATH );
Gnuplot *main_plot = new Gnuplot;
main_plot->cmd("set terminal pngcairo\n");
for(int j=0; j<100;j++)
{
rysuj_wagi(j, main_plot);
if(j%25 == 0) main_plot->remove_tmpfiles();
}


void rysuj_wagi(int numer, Gnuplot * main_plot)
{
std::ostringstream oss;
oss <<"set output 'waga" << numer<<".png'";
string output = oss.str();
cout<<output;
main_plot->cmd(output);
main_plot->set_grid();
main_plot->set_xrange(-5,5);
main_plot->set_yrange(-5,5);
main_plot->set_style( "linespoints" );
main_plot->set_pointsize( 1.0 );
vector<double> x, y;
x.push_back(0);
y.push_back(0);
x.push_back(punktyWagX[numer]);
y.push_back(punktyWagY[numer]);
main_plot->reset_plot();
main_plot->plot_xy(x, y);
}

你知道出去的路吗?

最佳答案

您似乎正在使用此 API:http://jfi.uchicago.edu/~tcaswell/track_doc/classgnuplot_1_1Gnuplot.html

你有没有尝试过这样的事情:

main_plot->cmd("set terminal pngcairo\n");         
//some setting of YOUR_FILENAME
main_plot->cmd("set output 'YOUR_FILENAME'\n");
main_plot->cmd("replot\n");

您有望避免使用临时文件。

关于c++ - Gnuplot 保存许 multimap 像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22505405/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com