Skip to content
Snippets Groups Projects
Commit 29a8311c authored by Caron Olivier's avatar Caron Olivier
Browse files

small update : show multiple figures (matplotlib)

parent 5a2424df
No related branches found
No related tags found
No related merge requests found
Pipeline #4557 failed
......@@ -151,13 +151,15 @@ int main() {
for (auto archive : archiveCheckpoint.getCheckpoints()) {
hypervolumes.push_back (multiObjectiveHypervolumeMetric(archive,bounds));
}
matplotlibcpp::figure(1) ;
matplotlibcpp::named_plot("Hypervolume (t)", archiveCheckpoint.getTimeValues(), hypervolumes);
matplotlibcpp::title("Genetic Algorithm");
matplotlibcpp::xlabel("Time (milliseconds)");
matplotlibcpp::ylabel("hypervolume");
matplotlibcpp::legend();
matplotlibcpp::show();
matplotlibcpp::figure(2) ;
matplotlibcpp::named_plot("Best Obj 1 (t)", archiveCheckpoint.getTimeValues(), archiveCheckpoint.getValues(0));
matplotlibcpp::named_plot("Best Obj 2 (t)", archiveCheckpoint.getTimeValues(), archiveCheckpoint.getValues(1));
matplotlibcpp::named_plot("Best Obj 1 (0->t)", archiveCheckpoint.getTimeValues(), archiveCheckpoint.getBestValues(0));
......@@ -167,6 +169,7 @@ int main() {
matplotlibcpp::xlabel("Time (seconds)");
matplotlibcpp::ylabel("fitness best found objectives");
matplotlibcpp::legend();
matplotlibcpp::show();
......
......@@ -145,14 +145,15 @@ int main() {
for (auto archive : archiveCheckpoint.getCheckpoints()) {
hypervolumes.push_back (multiObjectiveHypervolumeMetric(archive,bounds));
}
matplotlibcpp::figure(1) ;
matplotlibcpp::named_plot("Hypervolume (t)", archiveCheckpoint.getTimeValues(), hypervolumes);
matplotlibcpp::title("Genetic Algorithm");
matplotlibcpp::xlabel("Time (milliseconds)");
matplotlibcpp::ylabel("hypervolume");
matplotlibcpp::legend();
matplotlibcpp::show();
matplotlibcpp::figure(2) ;
matplotlibcpp::named_plot("Best Obj 1 (t)", archiveCheckpoint.getTimeValues(), archiveCheckpoint.getValues(0));
matplotlibcpp::named_plot("Best Obj 2 (t)", archiveCheckpoint.getTimeValues(), archiveCheckpoint.getValues(1));
matplotlibcpp::named_plot("Best Obj 1 (t0 -> t)", archiveCheckpoint.getTimeValues(), archiveCheckpoint.getBestValues(0));
......@@ -162,7 +163,7 @@ int main() {
matplotlibcpp::xlabel("Time (milliseconds)");
matplotlibcpp::ylabel("objective values");
matplotlibcpp::legend();
matplotlibcpp::show();
matplotlibcpp::show(); // show both figures
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment