#define _USE_MATH_DEFINES #include #include #include "../matplotlibcpp.h" namespace plt = matplotlibcpp; int main() { // Prepare data. std::vector> events; events.push_back({2,5,10,25}); events.push_back({20,21,22,24}); events.push_back({4,8,12,14,16,17,18}); events.push_back({10,11,12,13.5}); // Set the size of output image = 1200x780 pixels plt::figure_size(1200, 780); std::map keywords; keywords["linewidths"] = "0.5"; keywords["colors"] = "black"; plt::eventplot(events, keywords); // Add graph title plt::title("Event plot"); plt::xlabel("Time in ms"); plt::ylabel("Neuron ID"); plt::show(); // save figure const char* filename = "./events.png"; std::cout << "Saving result to " << filename << std::endl;; plt::save(filename); }