在同一个 gnuplot 窗口中绘制多个数据集
我有两个数据集(x,y1)和(x,y2),这是我从计算结果中得到的,并将这些文件写入“data1.tmp”和“data1.tmp”中。 “数据2.tmp”。我想使用这两个数据集在 Gnuplot 中进行绘图。
#include <iostream>
#include <cstdlib>
int main()
{
FILE* gnupipe1, *gnupipe2;
const char* GnuCommands1[] = {"set title \"v vs x\"","plot \'data1.tmp\' with lines"};
const char* GnuCommands2[] = {"set title \"y vs x\"","plot \'data2.tmp\' with lines"};
gnupipe1 = _popen("gnuplot -persistent","w");
gnupipe2 = _popen("gnuplot -persistent", "w");
for (int i = 0; i < 2; i++)
{
fprintf(gnupipe1,"%s\n",GnuCommands1[i]);
fprintf(gnupipe2,"%s\n", GnuCommands2[i]);
}
return 0;
}
现在,当我运行程序时,两个窗口会显示准确绘制数据。
如何以这种方式绘制多个数据集?说 (x,y1) & (x,y2) 在同一窗口中?
I have two data set (x,y1) and (x,y2) which I got from the result of computation and wrote those files in "data1.tmp" & "data2.tmp". I want to use this two data set to plot in Gnuplot.
#include <iostream>
#include <cstdlib>
int main()
{
FILE* gnupipe1, *gnupipe2;
const char* GnuCommands1[] = {"set title \"v vs x\"","plot \'data1.tmp\' with lines"};
const char* GnuCommands2[] = {"set title \"y vs x\"","plot \'data2.tmp\' with lines"};
gnupipe1 = _popen("gnuplot -persistent","w");
gnupipe2 = _popen("gnuplot -persistent", "w");
for (int i = 0; i < 2; i++)
{
fprintf(gnupipe1,"%s\n",GnuCommands1[i]);
fprintf(gnupipe2,"%s\n", GnuCommands2[i]);
}
return 0;
}
Now when I run the program two window shows up plotting the data accurately.
How to plot multiple data set this way? say (x,y1) & (x,y2) in same window?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在打开两个不同的 gnuplot,您不需要这样做。
You are opening two different gnuplots, you don't need to do that.