Skip to content

Scaled Image

1
imagesc(C);

example_imagesc_1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include <matplot/matplot.h>

int main() {
    using namespace matplot;
    std::vector<std::vector<double>> C = {
        {0, 2, 4, 6}, {8, 10, 12, 14}, {16, 18, 20, 22}};
    imagesc(C);
    colorbar();

    show();
    return 0;
}

More examples

example_imagesc_2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include <matplot/matplot.h>

int main() {
    using namespace matplot;
    std::vector<std::vector<double>> C = {
        {0, 2, 4, 6}, {8, 10, 12, 14}, {16, 18, 20, 22}};
    imagesc(5, 8, 3, 6, C);

    show();
    return 0;
}

example_imagesc_3

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include <matplot/matplot.h>

int main() {
    using namespace matplot;
    std::vector<std::vector<double>> C = {
        {0, 2, 4, 6}, {8, 10, 12, 14}, {16, 18, 20, 22}};
    imagesc(5, 8, 3, 6, C);
    gca()->color_box_range(4, 18);

    show();
    return 0;
}

example_imagesc_4

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <matplot/matplot.h>

int main() {
    using namespace matplot;
    std::vector<std::vector<double>> C = {
        {0, 2, 4, 6}, {8, 10, 12, 14}, {16, 18, 20, 22}};
    auto im = imagesc(5, 8, 3, 6, C);
    gca()->color_box_range(4, 18);
    im->alpha(0.5);

    show();
    return 0;
}