matplotlib-cpp icon indicating copy to clipboard operation
matplotlib-cpp copied to clipboard

The command like "subplot"doesn't work

Open Loong99 opened this issue 3 years ago • 2 comments

plt::plot(t3, p3);
plt::subplot(2, 2, 1);
plt::title("p-t");
plt::xlabel("t/ms");
plt::ylabel("p/Mpa");

plt::plot(t3, p3);
plt::subplot(2, 2, 2);
plt::title("p-t");
plt::xlabel("t/ms");
plt::ylabel("p/Mpa");

plt::plot(t3, p3);
plt::subplot(2, 2, 3);
plt::title("p-t");
plt::xlabel("t/ms");
plt::ylabel("p/Mpa");

plt::plot(t3, p3);
plt::subplot(2, 2, 4);
plt::title("p-t");
plt::xlabel("t/ms");
plt::ylabel("p/Mpa");

It doesn't work well above, but work well below. plt::figure(1); plt::plot(t3, p3); plt::title("p-t"); plt::xlabel("t/ms"); plt::ylabel("p/Mpa"); plt::figure(2); plt::plot(l3, p3); plt::title("p-l"); plt::xlabel("l/dm"); plt::ylabel("p/Mpa"); plt::figure(3); plt::plot(t3, v3); plt::title("v-t"); plt::xlabel("t/ms"); plt::ylabel("v/(m/s)"); plt::figure(4); plt::plot(l3, v3); plt::title("v-l"); plt::xlabel("l/dm"); plt::ylabel("v/(m/s)"); plt::show();

Loong99 avatar May 22 '22 06:05 Loong99

you can change the subplot function code:

PyTuple_SetItem(args, 0, PyLong_FromLong(nrows)); PyTuple_SetItem(args, 1, PyLong_FromLong(ncols)); PyTuple_SetItem(args, 2, PyLong_FromLong(plot_number));

ykachin avatar May 28 '22 12:05 ykachin

Too bad this repository isn't updated since 2021. @lava could you merge PR #333 to fix this issue?

eduardobehr avatar Feb 14 '23 13:02 eduardobehr