Hello,
when using add_point(x, y) in a for-loop to create multiple polygons in a single plot, the polygons get connected to each other and replotted with every plot() command. This happens because the internal list_of_x and list_of_y vectors are not cleared after the plot command creates a GnuplotSeries and adds it to series. To allow the creation of subsequent polygons using add_point(), the plot() command should clear these lists. For example:
/* Create a plot using the values set with the method `add_point` */
void plot(const std::string &label = "", LineStyle style = LineStyle::LINES) {
check_consistency();
_plot(label, style, false, list_of_x, list_of_y);
// Clear lists for the next `add_point` usage
list_of_x.clear();
list_of_y.clear();
}
Hello,
when using
add_point(x, y)in a for-loop to create multiple polygons in a single plot, the polygons get connected to each other and replotted with everyplot()command. This happens because the internallist_of_xandlist_of_yvectors are not cleared after the plot command creates aGnuplotSeriesand adds it toseries. To allow the creation of subsequent polygons usingadd_point(), theplot()command should clear these lists. For example: