Skip to content

Commit 4fbadf5

Browse files
author
Patric Schmitz
committed
add cumulative parameter to hist()
1 parent 193fd7b commit 4fbadf5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

matplotlibcpp.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,8 @@ bool fill_between(const std::vector<Numeric>& x, const std::vector<Numeric>& y1,
562562
}
563563

564564
template< typename Numeric>
565-
bool hist(const std::vector<Numeric>& y, long bins=10,std::string color="b", double alpha=1.0)
565+
bool hist(const std::vector<Numeric>& y, long bins=10,std::string color="b",
566+
double alpha=1.0, bool cumulative=false)
566567
{
567568

568569
PyObject* yarray = get_array(y);
@@ -571,6 +572,7 @@ bool hist(const std::vector<Numeric>& y, long bins=10,std::string color="b", dou
571572
PyDict_SetItemString(kwargs, "bins", PyLong_FromLong(bins));
572573
PyDict_SetItemString(kwargs, "color", PyString_FromString(color.c_str()));
573574
PyDict_SetItemString(kwargs, "alpha", PyFloat_FromDouble(alpha));
575+
PyDict_SetItemString(kwargs, "cumulative", cumulative ? Py_True : Py_False);
574576

575577
PyObject* plot_args = PyTuple_New(1);
576578

0 commit comments

Comments
 (0)