Skip to content

Filled Polygon

1
polygon(x0, y0, color);

example_fill_1

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

int main() {
    using namespace matplot;

    vector_1d t = iota(1. / 16, 1. / 8, 1);
    t = transform(t, [](double t) { return t * 2. * pi; });
    vector_1d x = transform(t, [](double t) { return cos(t); });
    vector_1d y = transform(t, [](double t) { return sin(t); });
    std::string color = "r";
    matplot::fill(x, y, color);
    axis(equal);

    show();
    return 0;
}