21 void add(std::string key,
double value){
22 double_values.insert(std::pair<std::string, double>(key, value));
26 void add(std::string key, std::string value){
27 string_values.insert(std::pair<std::string,std::string>(key,value));
40 el =
", " + (*it).first +
" = " +
format(
"%0.12g",(*it).second);
47 el =
", " + (*it).first +
" = '" + (*it).second +
"'" ;
59 return std::string(
"");
73 std::vector<double>
x,
y;
109 std::vector<PlotCall> PlotCalls;
113 PlotCalls.push_back(
PlotCall(x,y,dict));
120 for (std::vector<PlotCall>::iterator it = PlotCalls.begin(); it!=PlotCalls.end(); it++)
122 s += (*it).tostring();
128 std::string s =
"import matplotlib\nmatplotlib.use('TkAgg')\nimport matplotlib.pyplot as plt\n";
130 s +=
"plt.savefig('AA.png')\n";
132 if (PyRun_SimpleString(s.c_str()) != 0)
135 fp = fopen(
"errored_plot.py",
"w");
136 fprintf(fp,
"%s",s.c_str());
138 std::cout <<
format(
"plot failed. Written log to errored_plot.py\n");
std::string print_calls()
void additional_code(std::string)
void add(std::string key, double value)
Add a floating point value to the dictionary.
std::vector< double > x(ncmax, 0)
void add(std::string key, std::string value)
Add a string to the dictionary.
std::map< std::string, double > double_values
std::string vec_to_string(double const &a)
PlotCall(std::vector< double > x, std::vector< double > y, Dictionary *dict=NULL)
Save internal variables for this call to plot function, including the keyword argument function as a ...
std::string tostring()
return the string for this call, including the preceding import matplotlib.pyplot as plt and the foll...
std::map< std::string, std::string > string_values
void plot(std::vector< double > x, std::vector< double > y, Dictionary *dict=NULL)