Skip to content

RGB Plot

1
rgbplot(colors);

example_rgbplot_1

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

int main() {
    using namespace matplot;

    rgbplot(palette::parula());
    hold(on);
    colormap(palette::parula());
    colorbar().tick_values({});

    show();
    return 0;
}

More examples

example_rgbplot_2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <matplot/matplot.h>

int main() {
    using namespace matplot;

    auto r = iota(0, .1, .9);
    auto g = transform(r, [](double r) { return pow(r, 1.8); });
    auto b = transform(r, [](double r) { return pow(r, 2.1); });
    vector_2d mymap_channels{r, g, b};
    auto mymap = transpose(mymap_channels);

    rgbplot(mymap);
    hold(on);
    colormap(mymap);
    colorbar().tick_values({});

    show();
    return 0;
}