为什么我的热图是空的(白色)
Why is my heatmap empty (white)?
我想画一个热图,我有一个二维数组,我遵循了这个答案:https://stackoverflow.com/a/32459287/2370139除了我在 c++ 中使用 gnuplot 并且我删除了"非均匀",因为第一行和列是常规值,而不是刻度。
Gnuplot gp;
gp << "set autoscale xfix n";
gp << "set autoscale yfix n";
gp << "set autoscale cbfix n";
gp << "plot '-' matrix with image notitlen";
gp.send2d(pmat);
gp.flush();
PMAT 是一个大小为 50*50 的 2D 数组。它填充了介于 0 和 1 之间的浮点值。它确实绘制了一个完美的白色网格,问题可能是什么?
注意:上述命令在带有文本文件的普通 gnuplot 终端中使用时工作正常,例如
0.5 0.3 0.3
0.2 0.4 0.6
0.2 0.8 1
所以问题必须来自我对C++ API 的使用
如果gnuplot-iostream
没有对矩阵格式的二维数据的内置支持,则可以轻松地在代码中实现它。类似的东西
gp << "plot '-' matrix with image notitlen";
for (int i = 0; i < 50; ++i) {
for (int j = 0; j < 50; ++j)
gp << pmat[i][j] << "t";
gp << "n";
}
gp.flush();
(未经测试)应该可以工作。
相关文章:
- 我的神经网络不起作用 [XOR 问题]
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 我的字符计数代码计算错误.为什么
- 为什么我的C#代码在调用回C++COM直到Task时会暂停.等待/线程.加入
- cmake在我的项目中所需的所有静态库都不成功
- 为什么我的代码在输出中增加了93天
- 我的简单if-else语句是如何无法访问的代码
- 为什么我的for循环不能正确获取argv
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- 0-1背包代码中的错误.我的代码中有什么错误
- 当我的阵列太大时出现分段错误
- 如何确认我的constexpr表达式实际上已经在编译时执行
- 为什么二进制搜索在我的测试中不起作用
- 如何指定我希望我的LIB链接到的DLL文件?-Visual Studio 2019
- 我的代码中有错误吗?使用BGI图形的C++代码对我不起作用
- 当我在main中声明了我的2d数组时,为什么我的程序会退出
- OpenGL在启用深度测试时不会丢弃我的碎片
- 我如何使我的循环转到char*阵列的尽头,并将每个城市都放在链接的列表中(城市被划分为白色的空间)
- 为什么我的热图是空的(白色)
- 为什么我的三角形是白色的