Skip to content

Z Tick Format

1
ztickformat(fmtstr);

example_ztickformat_1

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

int main() {
    using namespace matplot;

    auto z = rand(5, 5, 0, 10);
    stem3(z);
    ztickformat("usd");

    show();
    return 0;
}

More examples

example_ztickformat_2

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

int main() {
    using namespace matplot;

    auto z = rand(5, 5, 0, 10);
    stem3(z);
    ztickformat("usd");

    std::cout << "ztickformat(): " << ztickformat() << std::endl;
    ztickformat("$%.0f");

    show();
    return 0;
}

example_ztickformat_3

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

int main() {
    using namespace matplot;

    auto t = iota(0, pi / 10, 10 * pi);
    auto st = transform(t, [](double t) { return sin(t); });
    auto ct = transform(t, [](double t) { return cos(t); });
    plot3(st, ct, t);
    grid(on);
    ztickformat("%g cm");

    show();
    return 0;
}

example_ztickformat_4

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

int main() {
    using namespace matplot;

    auto x = rand(50, 0, 10);
    auto y = rand(50, 0, 10);
    auto z = rand(50, 0, 10);
    scatter3(x, y, z);
    ztickformat("%.2f");

    show();
    return 0;
}

example_ztickformat_5

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

int main() {
    using namespace matplot;

    tiledlayout(1, 2);
    auto ax1 = nexttile();
    stem3(ax1, rand(5, 5, 0, 4));
    ztickformat(ax1, "usd");

    auto ax2 = nexttile();
    stem3(ax2, rand(5, 5, 0, 4));

    show();
    return 0;
}