Skip to content

'add_point()' not working with multiple 'plot()' #19

@eleipi

Description

@eleipi

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(); 
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions