MCPcopy Create free account
hub / github.com/accellera-official/systemc / Plot

Method Plot

examples/sysc/async_suspend/matplotlibcpp.h:1746–1779  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1744 // default initialization with plot label, some data and format
1745 template<typename Numeric>
1746 Plot(const std::string& name, const std::vector<Numeric>& x, const std::vector<Numeric>& y, const std::string& format = "") {
1747
1748 assert(x.size() == y.size());
1749
1750 PyObject* kwargs = PyDict_New();
1751 if(name != "")
1752 PyDict_SetItemString(kwargs, "label", PyString_FromString(name.c_str()));
1753
1754 PyObject* xarray = get_array(x);
1755 PyObject* yarray = get_array(y);
1756
1757 PyObject* pystring = PyString_FromString(format.c_str());
1758
1759 PyObject* plot_args = PyTuple_New(3);
1760 PyTuple_SetItem(plot_args, 0, xarray);
1761 PyTuple_SetItem(plot_args, 1, yarray);
1762 PyTuple_SetItem(plot_args, 2, pystring);
1763
1764 PyObject* res = PyObject_Call(detail::_interpreter::get().s_python_function_plot, plot_args, kwargs);
1765
1766 Py_DECREF(kwargs);
1767 Py_DECREF(plot_args);
1768
1769 if(res)
1770 {
1771 line= PyList_GetItem(res, 0);
1772
1773 if(line)
1774 set_data_fct = PyObject_GetAttrString(line,"set_data");
1775 else
1776 Py_DECREF(line);
1777 Py_DECREF(res);
1778 }
1779 }
1780
1781 // shorter initialization with name or format only
1782 // basically calls line, = plot([], [])

Callers

nothing calls this directly

Calls 3

get_arrayFunction · 0.85
c_strMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected