{"id":13642550,"url":"https://github.com/mljar/plotai","last_synced_at":"2025-05-15T15:04:27.440Z","repository":{"id":190578832,"uuid":"682099187","full_name":"mljar/plotai","owner":"mljar","description":"PlotAI - Your Ultimate Plotting Assistant! 📊🤖 Use ChatGPT-3.5 to create plots in Python and Matplotlib directly in your Python script or notebook. ","archived":false,"fork":false,"pushed_at":"2025-02-17T09:05:45.000Z","size":7060,"stargazers_count":331,"open_issues_count":4,"forks_count":25,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-05T03:00:58.085Z","etag":null,"topics":["charts","chatgpt","data-science","llm","matplotlib","plots","python","visualization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mljar.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":"2023-08-23T12:45:04.000Z","updated_at":"2025-03-27T10:57:21.000Z","dependencies_parsed_at":"2024-06-12T16:03:37.532Z","dependency_job_id":"70a43177-5d4e-4418-ae7a-3f5f8769dc78","html_url":"https://github.com/mljar/plotai","commit_stats":{"total_commits":37,"total_committers":3,"mean_commits":"12.333333333333334","dds":"0.18918918918918914","last_synced_commit":"c2334d1f849a2e81f3aab47c1bc320b0286b20c8"},"previous_names":["mljar/plotai"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljar%2Fplotai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljar%2Fplotai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljar%2Fplotai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljar%2Fplotai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mljar","download_url":"https://codeload.github.com/mljar/plotai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525137,"owners_count":21118616,"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":["charts","chatgpt","data-science","llm","matplotlib","plots","python","visualization"],"created_at":"2024-08-02T01:01:32.923Z","updated_at":"2025-04-12T06:00:30.872Z","avatar_url":"https://github.com/mljar.png","language":"Python","readme":"\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/mljar/plotai/blob/main/media/PlotAI_logo.png?raw=true\" height=\"270\" alt=\"PlotAI logo\"/\u003e\n\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n  \u003cem\u003e🎨🤖 Create Python plots in matplotlib with LLM 🎨🤖\u003c/em\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"\" src=\"https://badge.fury.io/py/plotai.svg\"/\u003e\n  \u003cimg alt=\"\" src=\"https://img.shields.io/pypi/pyversions/plotai.svg\"/\u003e\n  \u003cimg alt=\"\" src=\"https://img.shields.io/badge/License-Apache_2.0-blue.svg\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/mljar/plotai#get-started\"\u003e🚀 Get Started\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://github.com/mljar/plotai/issues\"\u003e🤝 Issues\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://twitter.com/MLJAROfficial\"\u003e🐦 Twitter\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://www.linkedin.com/in/aleksandra-p%C5%82o%C5%84ska-42047432/\"\u003e👩‍💼 LinkedIn\u003c/a\u003e\n\u003c/p\u003e\n\n## Important securitiy risk\n\nThe PlotAI executes code from LLM. It is using `exec()` function for this. \n\nI commented out the `exec()` function in file `plotai/code/executor.py`. If you understand the security risks you need to remove comment to use the package.\n\n# PlotAI 🎨🤖 \n\nThe easiest way to create plots in Python and Matplotlib. The `plotai` is using LLM to generate code and plots.\n\nThe idea:\n1. User provides input DataFrame and prompt.\n2. The `PlotAI` constructs a prompt for LLM, which contains the first 5 rows of DataFrame and the user's prompt and asks for Python code as output.\n3. Returned Python code is executed, and the plot is displayed.\n\nhttps://github.com/mljar/plotai/assets/6959032/cb80bc35-e534-466d-aa1d-ce240d35f624\n\nThe simplest possible API for plotting:\n```python\n# import packages\nimport pandas as pd\nfrom plotai import PlotAI\n# create some data\ndf = pd.DataFrame({\"x\":[1,2,3], \"y\": [4,5,6]})\n# do a plot\nplot = PlotAI(df)\nplot.make(\"scatter plot\")\n```\n\nThe `PlotAI` class has only one method, `make()`.\n\nIt works in Python scripts and in notebooks (Jupyter, Colab, VS Code).\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/mljar/plotai/blob/main/media/plotai.jpg?raw=true\" height=\"350\" alt=\"PlotAI logo\"/\u003e\n\u003c/p\u003e\n\n## 🚀 Get started\n\nInstall `plotai` package:\n\n```bash\npip install plotai\n```\n\nCreate `.env` file with the OpenAI API key:\n\n```\nOPENAI_API_KEY=your-key-here\n```\n\nYou can also pass the OpenAI API key in Python:\n\n```python\nimport os\nos.environ[\"OPENAI_API_KEY\"] = \"your-key-here\"\n```\n\nImport `plotai` and make plots:\n\n```python\n# import PlotAI\nfrom plotai import PlotAI\n\n# create PlotAI object, pass pandas DataFrame as an argument\nplot = PlotAI(df)\n\n# make a plot, just tell what you want\nplot.make(\"make a scatter plot\")\n```\n\nBy default the library will use '*gpt-3.5-turbo*'. You can use different OpenAI models:\n\n```python\n# import PlotAI\nfrom plotai import PlotAI\n\n# create PlotAI object, pass pandas DataFrame as an argument\nplot = PlotAI(df, model_version=\"gpt-4\")\n\n# make a plot, just tell what you want\nplot.make(\"make a scatter plot\")\n```\n\n## More examples\n\n#### Analyze the GPD dataset\n\nhttps://github.com/mljar/plotai/assets/6959032/e62b1a26-7c91-40e4-9d2d-1a600d8dd7ba\n\n#### Analyze the Iris dataset \n\n![](https://github.com/mljar/plotai/blob/main/media/PlotAI-Iris-demo.png?raw=true)\n\n\n## 👩‍💼🐦 Connect with Us on LinkedIn \u0026 Twitter\n\nStay up-to-date with the latest updates about PlotAI 🎨🤖 by following us on Twitter ([MLJAR Twitter](https://twitter.com/MLJAROfficial)) and LinkedIn ([Aleksandra LinkedIn](https://www.linkedin.com/in/aleksandra-p%C5%82o%C5%84ska-42047432/) \u0026 [Piotr LinkedIn](https://www.linkedin.com/in/piotr-plonski-mljar/)). We look forward to connecting with you and hearing your thoughts, ideas, and experiences with PlotAI. Let's explore the future of AI together!\n\n## ⚠️ Limitations\n\nPlotAI is in very experimental form, below are some limitations:\n- PlotAI is using OpenAI ChatGPT-3.5-turbo for completions, it will be nice to extend to other LLMs.\n- PlotAI is sending 5 first rows from your DataFrame to OpenAI ChatGPT. If you have sensitive data, please remove/encode it before passing to `PlotAI`.\n- PlotAI is executing Python code returned by LLM, it can be dangerous and unsafe. It would be nice to have the option to accept the response code before execution.\n\n\n## 🛡 Disclaimer\n\nThis project, PlotAI, is provided \"as is\" without any warranty, express or implied. By using this software, you agree to assume all risks associated with its use, including but not limited to data loss, system failure, or any other issues that may arise. The developers and contributors of this project do not accept any responsibility or liability for any losses, damages, or other consequences that may occur as a result of using this software. \n\nPlease note that the use of the OpenAI language models can be expensive due to its token usage. By utilizing this project, you acknowledge that you are responsible for monitoring and managing your own token usage and the associated costs. It is highly recommended to check your OpenAI API usage regularly and set up any necessary limits or alerts to prevent unexpected charges.\n\n## Convert Python Notebooks to web applications 📓 -\u003e 🌐\n\nWe are working on framework [Mercury](https://github.com/mljar/mercury) for sharing Python notebooks as interactive web applications. The framework is open source. We also working on a service for [one-click deployment of Python notebooks](https://runmercury.com/). You can check [Python notebooks integrations on our website](https://runmercury.com/use/). \n\nAll the best!\n\n","funding_links":[],"categories":["Chatbots","Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljar%2Fplotai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmljar%2Fplotai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljar%2Fplotai/lists"}