plotted line is gone after put legend on #172
Replies: 3 comments 3 replies
-
I have the same problem. As soon as I add a legend to my plots, all the contents I plotted up to that point are cleared. Linux + gnuplot. |
Beta Was this translation helpful? Give feedback.
-
What happens when you run the examples in https://alandefreitas.github.io/matplotplusplus/appearance/labels/legend/ ? It might be something related to the order of the commands. |
Beta Was this translation helpful? Give feedback.
-
I know this is an old thread, but I'm hoping that somebody was able to fix this issues. In my case, I'm plotting several lines. If I don't add a legend, it works perfectly every time. If I add a legend, sometimes it displays correctly, sometimes one of the plot lines disappears, and sometimes all of the plot lines disappear. In each case, the chart will draw all the plot lines, then when it draws the legend, one or more of the plot lines will disappear. I've tried moving ax->legend before and after "plot," adding ax->draw before and after ax->legend, both interactive and quiet mode, and I still can't get it to work. I'm using gnuplot 5.4.8 on Windows 10 with MSVC. |
Beta Was this translation helpful? Give feedback.
-
I have code like this:
I run the following code to call this function:
where
data
is astd::vector<double>
variable. With this setup, I run the program, I only see the legend, but the plotted line fromdata
is not shown. However, if I comment out the linep->display_name(lgd[i].c_str());
andmatplot::legend(lgd);
, I can see the line draw from the data, without legend.How to solve this problem? Thanks
Beta Was this translation helpful? Give feedback.
All reactions