Skip to content

Instantly share code, notes, and snippets.

@leha-bot
Created December 15, 2020 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leha-bot/13d4790cc76bb05dd8b376a1fdd6e7ec to your computer and use it in GitHub Desktop.
Save leha-bot/13d4790cc76bb05dd8b376a1fdd6e7ec to your computer and use it in GitHub Desktop.
#include <matplot/matplot.h>
#include <cstddef>
#include <cmath>
#include <vector>
#include <cassert>
std::string get_filename(const std::string &prefix, const std::string &matr_name)
{
return prefix + "_" + matr_name + ".png";
}
void simplified_test_case(const std::string &prefix)
{
// take one, plot
double some[] = {21, 54, 76, 33};
matplot::title("Test plot");
matplot::plot(std::vector<double>{std::begin(some), std::end(some)});
matplot::save(get_filename(prefix, "stdvec_1d.png"));
auto matr_0 = std::vector<std::vector<double>> {{10,10,10,10},{10,10,10,10},{10,10,10,10},{10,10,10,10}};
matplot::title("Test matrix (heatmap) 4x4, all tens");
matplot::heatmap(matr_0);
matplot::save(get_filename(prefix, "test_heatmap_stdvec_2d_all_tens"));
}
int main()
{
simplified_test_case("first_try");
simplified_test_case("second_try");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment