浏览代码

Add support for plot(y,keywords)

There is a convenient function plot(y,format) already, which however
doesn't allow to set additional parameters like labels, so add a similar
function that supports keywords.
Olivier Croquette 6 年之前
父节点
当前提交
5dd719498b
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      matplotlibcpp.h

+ 8 - 0
matplotlibcpp.h

@@ -1061,6 +1061,14 @@ bool plot(const std::vector<Numeric>& y, const std::string& format = "")
     return plot(x,y,format);
 }
 
+template<typename Numeric>
+bool plot(const std::vector<Numeric>& y, const std::map<std::string, std::string>& keywords)
+{
+    std::vector<Numeric> x(y.size());
+    for(size_t i=0; i<x.size(); ++i) x.at(i) = i;
+    return plot(x,y,keywords);
+}
+
 template<typename Numeric>
 bool stem(const std::vector<Numeric>& y, const std::string& format = "")
 {