When trying to export a figure as per docs, it dumps the raw output of the image into the console after this error:
gnuplot> t output "fig/PlotTest.eps"
^
line 0: invalid command
%!PS-Adobe-2.0
%%Creator: gnuplot 5.4 patchlevel 3
%%CreationDate: Wed Feb 02 14:19:48 2022
%%DocumentFonts: (atend)
<... remainder of the eps file>
Versions:
gnuplot 5.4.3
matplot++ latest master (3fd7593)
MSVC 19.29.30139.0
Win10 64
It sort of looks like it is cutting off the the "se" in "set" since the gnuplot command it is going for seems to be set output "fig/PlotTest.eps"like here, which would probably work. Could it be sending down the pipe before gnuplot is ready or is something lost in the pipe?
Steps to Reproduce
MRE:
template <typename Scalar, typename Matrix>
static std::vector<std::vector<Scalar>> fromEigenMatrix(const Matrix& M)
{
std::vector<std::vector<Scalar>> m;
m.resize(M.rows(), std::vector<Scalar>(M.cols(), 0));
for (size_t i = 0; i < m.size(); i++)
for (size_t j = 0; j < m.front().size(); j++)
m[i][j] = M(i, j);
return m;
}
template <typename Scalar>
static void outputMat(const Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>& m, const std::string& titleStr)
{
const auto min = m.minCoeff();
const auto max = m.maxCoeff();
const auto& vec = fromEigenMatrix<Scalar>(m);
auto fig = figure(true);
auto cax = fig->current_axes();
auto img = image(cax, vec);
title(cax, titleStr);
xlabel(cax, "X");
ylabel(cax, "Y");
if (min != max)
{
colormap(cax, palette::viridis());
colorbar(cax).limits({min, max});
}
save(fig, "fig/" + titleStr + ".eps");
}
int main(){
Eigen::MatrixXd mat(700,500);
mat.setRandom();
outputMat(mat, "PlotTest");
}
Bug category
Describe the bug
When trying to export a figure as per docs, it dumps the raw output of the image into the console after this error:
Versions:
It sort of looks like it is cutting off the the "se" in "set" since the gnuplot command it is going for seems to be
set output "fig/PlotTest.eps"
like here, which would probably work. Could it be sending down the pipe before gnuplot is ready or is something lost in the pipe?Steps to Reproduce MRE: