alandefreitas / matplotplusplus

Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
https://alandefreitas.github.io/matplotplusplus/
MIT License
4.11k stars 313 forks source link

Seeing gnuplot error messages in output #243

Open MikeGitb opened 2 years ago

MikeGitb commented 2 years ago

Bug category

Describe the bug

I have a similar problem as https://github.com/alandefreitas/matplotplusplus/issues/27. In my case it seems that another command is split (see repro). However the plot is displayed correctly (best I can tell) I should mention that I'm using th version from vcpkg, which seems to be about a year old (package version is given as 2021-04-11#5).

Steps to Reproduce Compiling the following program

Compiling the following program
#include <matplot/matplot.h>
#include <iostream>

int main() {
    std::vector<double> a{1,2,3,4,5}, b{-1,-0.7,0,0.7,1};
    matplot::figure();
    std::cout << "============  " << 1 << " ================  " << std::endl;
    matplot::plot(a, b);
    std::cout << "============  " << 2 << " ================  " << std::endl;
    matplot::show();
}

In visual studio 2022 (cmake project via "open folder" and using vcpkg in maifest mode to get matplotlplusplus)

Output

```console ============ 1 ================ gnuplot> se ^ line 0: unrecognized option - see 'help set'. gnuplot> t terminal wxt title "Figure 1" size 560,420 enhanced font "Sans,10" ^ line 0: invalid command ============ 2 ================ gnuplot> se ^ line 0: unrecognized option - see 'help set'. gnuplot> t terminal wxt title "Figure 1" size 560,420 enhanced font "Sans,10" ^ line 0: invalid command gnuplot> se ^ line 6: unrecognized option - see 'help set'. gnuplot> t terminal wxt title "Figure 1" size 560,420 enhanced font "Sans,10" ^ line 6: invalid command Press ENTER to continue... ```

Platform

Environment Details:

Additional context

When I start gnuplot manually, I get the following output:

        G N U P L O T
        Version 5.4 patchlevel 3    last modified 2021-12-24

        Copyright (C) 1986-1993, 1998, 2004, 2007-2021
        Thomas Williams, Colin Kelley and many others

        gnuplot home:     http://www.gnuplot.info
        faq, bugs, etc:   type "help FAQ"
        immediate help:   type "help"  (plot window: hit 'h')

Terminal type is now 'wxt'
Options are '0 enhanced'
Encoding set to 'cp1252'.
gnuplot>
nigeljw3 commented 1 year ago

I am also seeing this identical problem with a custom debug build from trunk and also a package release build from vcpkg.

nigeljw3 commented 1 year ago

So I reinstalled gnuplot and then set the GNUTERM to use "windows" and I no longer have this issue.

I tried to explicitly set QT previously, but had the same issue as whatever was default on the first install.

nigeljw3 commented 1 year ago

Looks like I get a similar issue if I try to save an image instead of just showing the plot.

gnuplot> t output "plot.png" ^ line 22: invalid command

‰PNG → IHDR☻€☺☻º³K³♠bKGDÿÿÿ ½§“§óIDATxœíݱo[åÞÀñ§´—Fê€Å¶

alandefreitas commented 1 year ago

That's intended behavior because they're errors. At most, we could have a flag in the backend to turn that off.

MikeGitb commented 1 year ago

@alandefreitas : What is intended behavior?

KelbyVP commented 1 year ago

That's intended behavior because they're errors. At most, we could have a flag in the backend to turn that off.

Alan, I'm getting this error when I copy your code from your "Saving Programatically" page. It keeps me from saving the image. So, the sample code shown on your page doesn't work. If there are errors here, how do we go about saving in a way that doesn't produce these errors?