8000 Add support for plot(y,keywords) · hypercode-go/matplotlib-cpp@5dd7194 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5dd7194

Browse files
ocroquettelava
authored andcommitted
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.
1 parent bc7e457 commit 5dd7194

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

matplotlibcpp.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,14 @@ bool plot(const std::vector<Numeric>& y, const std::string& format = "")
10611061
return plot(x,y,format);
10621062
}
10631063

1064+
template<typename Numeric>
1065+
bool plot(const std::vector<Numeric>& y, const std::map<std::string, std::string>& keywords)
1066+
{
1067+
std::vector<Numeric> x(y.size());
1068+
for(size_t i=0; i<x.size(); ++i) x.at(i) = i;
1069+
return plot(x,y,keywords);
1070+
}
1071+
10641072
template<typename Numeric>
10651073
bool stem(const std::vector<Numeric>& y, const std::string& format = "")
10661074
{

0 commit comments

Comments
 (0)
0