Argument to matplotlib.
The Argument is a helper class to the Plotter. It allows both strings and key-value pairs to be passed as arguments to the same function.
For example, consider the following function.
This can be called using either
or
f({
{"linewidth", "2"},
{"color", "blue"},
{"linestyle, "dashed"}
});
Example
using namespace std;
using namespace TBTK;
using namespace Visualization::MatPlotLib;
const std::map<std::string, std::string> argumentMap
= argument.getArgumentMap();
if(argumentMap.size() == 0){
Streams::out <<
"\t" << argument.getArgumentString() <<
"\n";
}
else{
for(auto element : argumentMap){
<< "\t" << element.first
<< ": " << element.second
<< "\n";
}
}
}
int main(){
print("Argument");
print({
{"First key", "First value"},
{"Second key", "Second value"},
{"Third key", "Third value"}
});
}
Output
First key: First value
Second key: Second value
Third key: Third value