{"id":19429864,"url":"https://github.com/soraxas/plotmsg-cpp","last_synced_at":"2025-02-25T05:42:16.696Z","repository":{"id":89610340,"uuid":"350344222","full_name":"soraxas/PlotMsg-cpp","owner":"soraxas","description":"Create plots in C++ with message sending","archived":false,"fork":false,"pushed_at":"2023-05-03T01:33:56.000Z","size":169,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T06:51:23.472Z","etag":null,"topics":["asynchronous-plotting","cpp","message-passing","plotly","plotting","protobuf"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soraxas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-22T12:58:49.000Z","updated_at":"2023-06-30T12:13:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"08b09d78-a8c6-41d2-bb9b-ca17306a6e6d","html_url":"https://github.com/soraxas/PlotMsg-cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soraxas%2FPlotMsg-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soraxas%2FPlotMsg-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soraxas%2FPlotMsg-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soraxas%2FPlotMsg-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soraxas","download_url":"https://codeload.github.com/soraxas/PlotMsg-cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240612540,"owners_count":19829027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous-plotting","cpp","message-passing","plotly","plotting","protobuf"],"created_at":"2024-11-10T14:22:00.764Z","updated_at":"2025-02-25T05:42:16.669Z","avatar_url":"https://github.com/soraxas.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PlotMsg for C++\n\nThis repository brings **PlotMsg** to C++ by utilising the native PlotMsg library backend in Python. This is achieved by implementing a *publisher* and *subscriber* model between C++ and Python, and a stateful model in the **Jupyter notebook** ecosystem that captures the incoming message. It supports asynchronous refresh within the notebook whenever a new message is published from your C++ files, and automatically display them within the notebook. This library also support non-notebook usage where it uses PlotMsg's native figure display from within your browser.\n\n# Requirements\n\n- zeromq (messaging protocol)\n\n- protobuf (serialisation of message)\n\n# Using the library in your C++ project\n\nYou can include the project it as you normally. The following shows a snippet to quickly visualise your code using PlotMsg without much setup\n\n## Quick and dirty out-of-tree build in cmake\n\nIn your **CMakeLists.txt**:\n\n```cmake\ncmake_minimum_required(...)\n\n...\n\n# Add as out-of-tree build (with absolute path \u0026 binary directory)\nadd_subdirectory(\n        /home/soraxas/git-repo/plotmsg\n        plotmsg\n)\nfind_package( plotmsg REQUIRED )\n\n...\n\n# link the library to your target\ntarget_link_libraries( ${MY_TARGET} plotmsg )\n```\n\n# Example Usage\n\nSay you have something like this in your `${MY_TARGET}`\n\n```cpp\n#include \"plotmsg/main.hpp\"\n#include \"plotmsg/template/core.hpp\"\n\nint main(int argc, char const *argv[]) {\n  PlotMsg::Figure fig;\n  std::vector\u003cdouble\u003e x{1, 2, 3, 4, 5, 6, 7};\n  std::vector\u003cdouble\u003e y{1, 2, 3, 2, 3, 4, 5};\n\n  auto trace = PlotMsg::TraceTemplate::scatter(x, y);\n  trace[\"mode\"] = \"lines\";\n\n  fig.add_trace(trace);\n\n  fig.send();\n}\n```\n\nRun\n\n```shell\ncmake -Bbuild\nmake -C build\n```\n\nto build your C++ project.\n\nYou can then, for example, start the python subscriber with\n\n```sh\nipython\n```\n\n```python\nimport sys; sys.path.insert(0, \"built_python_pkg\")\n\nfrom plotmsg_dash import PlotMsgPlotly\n\nsub = PlotMsgPlotly()\nsub.initialise()\nsub.spin()\n```\n\nAfterwards, the ipython kernel is listening at the *default* **tcp://127.0.0.1:5557** socket and, when you execute your compiled C++ binary, it will send the `fig` message using the same socket.\n\n## Example Project\n\n`./demo_project` is an example of a simple project that utilises `plotmsg`. You can \ntest \nit out with\n\n```sh\ncd demo_project\ncmake -Bbuild\nmake -C build\n\n# start subscriber in the background (1)\npython py_sub_example.py \u0026\n\n# publish figure from c++\n./build/test\n\n# killall background jobs (py script in (1) that is running in bg )\nkill $(jobs -p)\n```\n\n\n```sh\ngit clone https://github.com/protocolbuffers/protobuf.git\ncd protobuf\ngit submodule update --init --recursive\n./autogen.sh\n\n./configure --prefix=/usr\nmake\nmake check\nsudo make install\nsudo ldconfig # refresh shared library cache.\n\n```\n\n```sh\ncmake .. -DCMAKE_INSTALL_PREFIX=$HOME/zmq_cmake\nmake\nmake install\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoraxas%2Fplotmsg-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoraxas%2Fplotmsg-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoraxas%2Fplotmsg-cpp/lists"}