{"id":15282484,"url":"https://github.com/thomann/plotar","last_synced_at":"2025-04-12T23:04:39.038Z","repository":{"id":57453489,"uuid":"84892113","full_name":"thomann/plotAR","owner":"thomann","description":"Walk Through your Data in AR or VR","archived":false,"fork":false,"pushed_at":"2024-05-27T01:05:21.000Z","size":33066,"stargazers_count":18,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-01T14:26:18.170Z","etag":null,"topics":["augmented-reality","plotting","virtual-reality","visualization","vr","webxr","xr"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-03-14T01:37:03.000Z","updated_at":"2024-08-29T04:36:14.000Z","dependencies_parsed_at":"2024-05-12T16:45:01.989Z","dependency_job_id":null,"html_url":"https://github.com/thomann/plotAR","commit_stats":{"total_commits":152,"total_committers":1,"mean_commits":152.0,"dds":0.0,"last_synced_commit":"c464f8e31e9cc7260be55918eba03714af6e32fc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomann%2FplotAR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomann%2FplotAR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomann%2FplotAR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomann%2FplotAR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomann","download_url":"https://codeload.github.com/thomann/plotAR/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219847247,"owners_count":16556405,"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":["augmented-reality","plotting","virtual-reality","visualization","vr","webxr","xr"],"created_at":"2024-09-30T14:26:24.054Z","updated_at":"2024-10-14T14:20:53.941Z","avatar_url":"https://github.com/thomann.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PlotAR - Walk Through Your Data\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/thomann/plotAR/binder) -\n[Examples](https://thomann.github.io/plotAR/examples) -\n[VR-Gallery](https://thomann.github.io/plotAR/examples/gallery.html)\n\nPlotAR let's you quickly iteratively view and explore 3D plots of your data both in AR on your smartphone as well as in VR in\nyour headset to get a real immersive impression so you can use the full power of the 3rd dimension.\nIt can be as easy as:\n```python\n# scatter plot of iris data\nplotar.plotar(iris.data, iris.target)\n# lines plot\nplotar.linear(gapminder, xyz=['gdpPercap','year','lifeExp'],\n    col='country', size='pop')\n# surface of switzerland \nplotar.surfacevr(switzerland, surfacecolor=sat_img, auto_scale=False)\n# animation of development of countries\nplotar.animate(gapminder, xyz=['income','children_per_woman','life_expectancy'],\n              group='country', col='sub_region', size='population',\n              animation_frame='year')\n# animation of development of countries with country name directly in plot\nplotar.animate(gapminder, xyz=['income','children_per_woman','life_expectancy'],\n              group='country', col='sub_region', size='population',\n              animation_frame='year', label='country')\n```\n[\u003cimg src=\"https://thomann.github.io/plotAR/images/qr-examples.png\" width=\"100px\" align=\"right\" alt=\"Link to examples\"\u003e](https://thomann.github.io/plotAR/examples)\nEach will show you a QR-code that you can scan with your mobile device - there you can **open the AR-session** by clicking on the\nsmall icon in the lower right of preview or you can use the link **Open in VR**.\nIf you are curious now, just open the [Examples](https://thomann.github.io/plotAR/examples) on your smartphone or tablet or\ngo to the [VR-Gallery](https://thomann.github.io/plotAR/examples/gallery.html) in your VR headset's browser.\n\n| Example | Screenshot | iOS (usdz) \u003cbr\u003e Android (gltf)|\n| :---         |     :---:        |     :---      |\n| **iris**\u003cbr\u003eThe famous data set | \u003cimg src=\"https://thomann.github.io/plotAR/examples/iris.png\" width=100\u003e | \u003ca rel=\"ar\" href=\"https://thomann.github.io/plotAR/examples/iris.usdz\"\u003e\u003cimg width=\"15\" src=\"https://upload.wikimedia.org/wikipedia/commons/f/fa/Apple_logo_black.svg\"\u003e iris.usdz\u003c/a\u003e\u003cbr\u003e\u003ca href=\"intent://arvr.google.com/scene-viewer/1.0?file=https://thomann.github.io/plotAR/examples/iris.gltf?mode=ar_preferred#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=https://thomann.github.io/plotAR/;end;\"\u003e\u003cimg width=\"15\" src=\"https://upload.wikimedia.org/wikipedia/commons/e/e0/Android_robot_%282014-2019%29.svg\"\u003e iris.gltf\u003c/a\u003e   |\n| **gapminder**\u003cbr\u003eOnly European countries | \u003cimg src=\"https://thomann.github.io/plotAR/examples/gapminder.png\" width=100\u003e | \u003ca rel=\"ar\" href=\"https://thomann.github.io/plotAR/examples/gapminder.usdz\"\u003e\u003cimg width=\"15\" src=\"https://upload.wikimedia.org/wikipedia/commons/f/fa/Apple_logo_black.svg\"\u003e gapminder.usdz\u003c/a\u003e\u003cbr\u003e\u003ca href=\"intent://arvr.google.com/scene-viewer/1.0?file=https://thomann.github.io/plotAR/examples/gapminder.gltf?mode=ar_preferred#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=https://thomann.github.io/plotAR/;end;\"\u003e\u003cimg width=\"15\" src=\"https://upload.wikimedia.org/wikipedia/commons/e/e0/Android_robot_%282014-2019%29.svg\"\u003e gapminder.gltf\u003c/a\u003e   |\n| **PLZ**\u003cbr\u003eCan you guess what it is? | \u003cimg src=\"https://thomann.github.io/plotAR/examples/PLZ.png\" width=100\u003e | \u003ca rel=\"ar\" href=\"https://thomann.github.io/plotAR/examples/PLZ.usdz\"\u003e\u003cimg width=\"15\" src=\"https://upload.wikimedia.org/wikipedia/commons/f/fa/Apple_logo_black.svg\"\u003e PLZ.usdz\u003c/a\u003e\u003cbr\u003e\u003ca href=\"intent://arvr.google.com/scene-viewer/1.0?file=https://thomann.github.io/plotAR/examples/PLZ.gltf?mode=ar_preferred#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=https://thomann.github.io/plotAR/;end;\"\u003e\u003cimg width=\"15\" src=\"https://upload.wikimedia.org/wikipedia/commons/e/e0/Android_robot_%282014-2019%29.svg\"\u003e PLZ.gltf\u003c/a\u003e   |\n| **planets**\u003cbr\u003ePlanets | \u003cimg src=\"https://thomann.github.io/plotAR/examples/planets.png\" width=100\u003e | \u003ca rel=\"ar\" href=\"https://thomann.github.io/plotAR/examples/planets.usdz\"\u003e\u003cimg width=\"15\" src=\"https://upload.wikimedia.org/wikipedia/commons/f/fa/Apple_logo_black.svg\"\u003e planets.usdz\u003c/a\u003e\u003cbr\u003e\u003ca href=\"intent://arvr.google.com/scene-viewer/1.0?file=https://thomann.github.io/plotAR/examples/planets.gltf?mode=ar_preferred#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=https://thomann.github.io/plotAR/;end;\"\u003e\u003cimg width=\"15\" src=\"https://upload.wikimedia.org/wikipedia/commons/e/e0/Android_robot_%282014-2019%29.svg\"\u003e planets.gltf\u003c/a\u003e   |\n| **CH**\u003cbr\u003eSurface of Switzerland | \u003cimg src=\"https://thomann.github.io/plotAR/examples/CH.png\" width=100\u003e | \u003ca rel=\"ar\" href=\"https://thomann.github.io/plotAR/examples/CH.usdz\"\u003e\u003cimg width=\"15\" src=\"https://upload.wikimedia.org/wikipedia/commons/f/fa/Apple_logo_black.svg\"\u003e CH.usdz\u003c/a\u003e\u003cbr\u003e\u003ca href=\"intent://arvr.google.com/scene-viewer/1.0?file=https://thomann.github.io/plotAR/examples/CH.gltf?mode=ar_preferred#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=https://thomann.github.io/plotAR/;end;\"\u003e\u003cimg width=\"15\" src=\"https://upload.wikimedia.org/wikipedia/commons/e/e0/Android_robot_%282014-2019%29.svg\"\u003e CH.gltf\u003c/a\u003e   |\n\nA nicer overview can be found here in [examples/](https://thomann.github.io/plotAR/examples).\nCheck \u003cdemo.ipynb\u003e to see how these samples were made - best is to go through that Notebook on [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/thomann/plotAR/binder)\n\nThe R demo is in \u003cdemo.R\u003e - again look at it on [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/thomann/plotAR/binder?urlpath=rstudio)\n\nThis is a prototype to get your data into Augmented Reality (AR) or and navigate using the computer keyboard.\n\n\u003e This package was presented at EuroPython 2019.\n\u003e Check out the recording video on \u003chttps://www.youtube.com/watch?v=O1y96EG0bTw\u003e.\n\nAre you bored by 3D-plots that only give you a simple rotatable 2d-projection? plotAR provides a simple way for data scientists to plot data, pick up a phone, get a real 3d impression - either by VR or by AR - and use the computer's keyboard to walk through the scatter plot (see [live demo](https://thomann.github.io/plotAR/plotAR-R/inst/)):\n\n![Overview](images/overview.png?raw=true \"Overview\")\n\nThe technologies beneath this project are: a web server that handles the communication between the DataScience-session and the phone, WebSockets to quickly proxy the keyboard events, QR-codes facilitate the simple pairing of both, and an HTML-Page on the computer to grab the keyboard events. And the translation of these keyboard events into 3D terms is a nice exercise in three.js, OpenGL, and SceneKit for HTML, Android, and iOS resp.\n\n\n![Architecture](images/architecture.png \"Architecture\")\n\n\n\u003e **Warning:** Be careful whether data is transmitted unencrypted and everybody can connect! Please be carefule with private data!\n\n\n## Setup\n\nInstall the Python package:\n```bash\npip install --upgrade plotAR\n```\nThis will also install PlotAR into your Jupyter Server - please restart Jupyter to be able to use it.\n\nIf you use **Jupyter**: For full support you will need to connect to that server from your mobile, this means you should start it with:\n```bash\njupyter lab --ip=\"*\"\n```\n**WARNING** Jupyter is secured by default to have a non-guessable token to get some level of security, but still you probably do not use HTTPS, so anybody intercepting the traffic between you mobile device and your desktop can see all your data! This might be ok in your home network or in a company enterprise - be cautious! Traffic with mybinder.org actually is secured by HTTPS and the token.\n\nOtherwise you can start a PlotAR-Server on e.g. the default port 2908:\n```bash\nplotar server -p 2908\n```\n**NOTE** To experience your data in VR or more precise **WebXR**, the server needs to run on **HTTPS** or be localhost - the latter probably only makes sense on PC-VR devices. You can start the server with some (self-generated?) Key and Certificate using the `--ssl-prefix my_plotar_keys.`. Then you also need to set `ignore_ssl_warnings=True` in the python client and acknowledge in all the browsers the self-signed certificate (on newer Chrome Desktop Versions you need to type blindly `THISISUNSAFE` into the warning window to circumvent it). To generate such a self-signed key and certificate you can use `openssl`:\n```\n# generate a key\nopenssl genrsa -out my_plotar_keys.key 2048\n\n# to specify the distinguised name info interactively\nopenssl req -new -x509 -key my_plotar_keys.key -out my_plotar_keys.crt -days 365\n\n# else to specify the distinguised name info on the CLI\n\nopenssl req -new -x509 -key my_plotar_keys.key -out my_plotar_keys.crt -days 365 \\\n    -subj \"/C=CH/ST=Zurich/O=My Name/CN=127.0.0.1\"\n```\nYou will be asked \n\nThen open up \u003chttp://localhost:2908/keyboard.html\u003e to see whether you can connect.\nThis page also will show you a guess of a URL with your desktops IP-adress so you should be able to connect to it from your mobile - *as long as both devices are in the same network!*\n\nOptionally the R-package can be installed using - but it will need access to a Python-based server:\n```r\ndevtools::install_github('thomann/plotAR',subdir='plotAR-R')\n```\nFor the server component:\n- If you want to start the server from your R session easiest is to install the Pyhthon package using:\n```r\nplotar::install_plotar_py()\n```\n- Or you can connect to a running plotAR-Server\n    - start the python server, e.g. one on [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/thomann/plotAR/binder?urlpath=rstudio)\n    - copy the URL using the copy button in the the keyboard view (e.g. something like `https://hub.gke2.mybinder.org/user/thomann-plotar-6sy8ghsu/plotar/keyboard.html?token=e9mbARgtR1-ieBp0vTnGuw`)\n    - in the R session issue `connectServer(\"https://...\")`\n\nAlso check out the native mobile apps:\n- iOS: \u003chttps://github.com/thomann/PlotAR-ios\u003e\n- Android: \u003chttps://github.com/thomann/plotAR-android\u003e\n\n\n## Quick Tour\n\nWorking with the package is meant to be seamless - but it is a little hard to explain in text. Please check out the above [video](https://www.youtube.com/watch?v=O1y96EG0bTw).\n\nHere we will describe how to plot the data in RStudio or Jupyter, then view it on your device, and finally navigate through the scene.\n\n### Plot your data\n\nIn Python - or better even in Jupyter Lab - enter the following:\n\n```python\nimport plotar\nfrom sklearn import datasets\niris = datasets.load_iris()\nplotar.plotar(iris.data, iris.target)\n```\nThis will look something like\n![Jupter](images/screen-jupyter.png?raw=true \"Jupter Screen\")\nJust scan the QR-Code with your mobile device and then tap on the the AR-Icon.\n\nIn R load and plot the first three dimensions of `iris` with `iris$Species` as color:\n```r\nlibrary(plotAR)\nstartServer() # starts a python server via reticulate in background\nplotAR(iris, col=Species)\n```\n![RStudio](images/screen-rstudio.png?raw=true \"Rstudio Screen\")\n\n### View in a browser or on a device\n\nNow you can open the advertised webpage - also on your mobile device using any QR-code reader:\n```\nhttp://\u003cip-address of your machine\u003e:2908/keyboard.html\n```\nThis will look something like (see [live demo](https://thomann.github.io/plotAR/plotAR/overview/)):\n\n![VR view](images/screen-vr.png?raw=true \"VR view\")\n\n\u003e Naturally, you also can visit the server page on your computer: \u003chttp://localhost:2908/plotAR.html\u003e.\n\nTap on the screen to bring it to full-screen!\n\n### Keyboard Navigation\n\nNow in order to navigate through your scene you can use the keyboard. In order to capture key events click on the display keyboard:\n![Keyboard](images/screen-keyboard.png?raw=true)\n\nThey keyboard warns if it loses focus:\n![Keyboard without focus](images/screen-keyboard-nofocus.png?raw=true)\n\nThis window also will get the keyboard focus when it opens. You now can use your computer keyboard to navigate through the virtual space (like in Quake!):\n\n|  Key              |  Movement             |\n|-------------------|-----------------------|\n|   w               |  forward              |\n|   s               | backward              |\n|   a               |    left               |\n|   d               |   right               |\n|   q               |     up                |\n|   e               |   down                |\n|  up/down-arrow    |  rotate vertically    |\n|  left/right-arrow |  rotate horizontally  |\n|   r               |  reload               |\n|  space            |  toggle velocity      |\n\n### \n\nNow if you plot something new it should be reloaded automatically in your viewer:\n```python\nimport numpy as np\nboston = datasets.load_boston()\nplotar.plotar(boston.data)\n```\nor\n```r\nplotAR(trees)\n```\n\n## Issues\n\n* The file `plotAR-matlab/plotAR.m` can be used in MATLAB if you have access to a running server in Python or R.\n\n## Acknowledgements\n\n* Pixar for developing the USD-Tools and Nvidia for putting the `usd-core` PyPI.\n* Google for the [Model Viewer](https://modelviewer.dev/),\n* For the WebXR-client: [`three.js`](https://threejs.org/) and [A-Frame](https://aframe.io/).\n* [`httpuv`](https://github.com/rstudio/httpuv) for the websocket-server implementation in R\n* [`tornado`](https://www.tornadoweb.org/) for the websocket-server implementation in Python\n* \u003chttps://vr.google.com/cardboard/\u003e for the cardboard!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomann%2Fplotar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomann%2Fplotar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomann%2Fplotar/lists"}