Skip to content

Commit 3d5b1db

Browse files
committed
Fix warnings
1 parent dd38483 commit 3d5b1db

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

matplotlibcpp.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ bool plot(const VectorY &y, const std::string &format = "",
550550
// Note: cannot be an unsigned type for some reason, yields an overflow
551551
// problem..
552552
std::vector<int> x(y.size());
553-
for (size_t i = 0; i < x.size(); ++i)
553+
for (std::size_t i = 0; i < x.size(); ++i)
554554
x.at(i) = i;
555555

556556
return plot(x, y, format, keywords);
@@ -562,7 +562,7 @@ template <typename VectorY = std::vector<double>>
562562
bool plot(const VectorY &y,
563563
const std::map<std::string, std::string> &keywords) {
564564
std::vector<int> x(y.size());
565-
for (int i = 0; i < x.size(); ++i)
565+
for (std::size_t i = 0; i < x.size(); ++i)
566566
x.at(i) = i;
567567

568568
return plot(x, y, "", keywords);
@@ -1075,6 +1075,11 @@ bool bar(const std::vector<Numeric> &y, std::string ec = "black",
10751075
PyDict_SetItemString(kwargs, "ls", PyString_FromString(ls.c_str()));
10761076
PyDict_SetItemString(kwargs, "lw", PyFloat_FromDouble(lw));
10771077

1078+
for (auto const &item : keywords) {
1079+
PyDict_SetItemString(kwargs, item.first.c_str(),
1080+
PyString_FromString(item.second.c_str()));
1081+
}
1082+
10781083
PyObject *plot_args = PyTuple_New(2);
10791084
PyTuple_SetItem(plot_args, 0, xarray);
10801085
PyTuple_SetItem(plot_args, 1, yarray);

0 commit comments

Comments
 (0)