| 719 | |
| 720 | template <typename Numeric> |
| 721 | bool arrow(Numeric x, Numeric y, Numeric end_x, Numeric end_y, const std::string& fc = "r", |
| 722 | const std::string ec = "k", Numeric head_length = 0.25, Numeric head_width = 0.1625) { |
| 723 | PyObject* obj_x = PyFloat_FromDouble(x); |
| 724 | PyObject* obj_y = PyFloat_FromDouble(y); |
| 725 | PyObject* obj_end_x = PyFloat_FromDouble(end_x); |
| 726 | PyObject* obj_end_y = PyFloat_FromDouble(end_y); |
| 727 | |
| 728 | PyObject* kwargs = PyDict_New(); |
| 729 | PyDict_SetItemString(kwargs, "fc", PyString_FromString(fc.c_str())); |
| 730 | PyDict_SetItemString(kwargs, "ec", PyString_FromString(ec.c_str())); |
| 731 | PyDict_SetItemString(kwargs, "head_width", PyFloat_FromDouble(head_width)); |
| 732 | PyDict_SetItemString(kwargs, "head_length", PyFloat_FromDouble(head_length)); |
| 733 | |
| 734 | PyObject* plot_args = PyTuple_New(4); |
| 735 | PyTuple_SetItem(plot_args, 0, obj_x); |
| 736 | PyTuple_SetItem(plot_args, 1, obj_y); |
| 737 | PyTuple_SetItem(plot_args, 2, obj_end_x); |
| 738 | PyTuple_SetItem(plot_args, 3, obj_end_y); |
| 739 | |
| 740 | PyObject* res = |
| 741 | PyObject_Call(detail::_interpreter::get().s_python_function_arrow, plot_args, kwargs); |
| 742 | |
| 743 | Py_DECREF(plot_args); |
| 744 | Py_DECREF(kwargs); |
| 745 | if (res) |
| 746 | Py_DECREF(res); |
| 747 | |
| 748 | return res; |
| 749 | } |
| 750 | |
| 751 | template< typename Numeric> |
| 752 | bool hist(const std::vector<Numeric>& y, long bins=10,std::string color="b", |
nothing calls this directly
no outgoing calls
no test coverage detected