Chat2VIS — Generating Data Visualisations from Natural Language Text using GPT-3 and ChatGPT

Paula Maddigan
2 min readApr 4, 2023

--

With the rise of large language models, here is a novel way of using them to generate data visualisations.

Many of us have experimented with what ChatGPT can do….and what it can not. One thing the models do excel at though, is writing Python code. Many of us have at our fingertips a treasure trove of data, whether it be from our smart watch, small business adventure, or a hobby. However making use of that data to generate insights can present challenges, especially if Excel is just not your thing.

Chat2VIS (https://chat2vis.streamlit.app/) is a Streamlit application to make life a little easier. For example, load up your budget data from a CSV file. Then using natural language text, such as “Plot the budget. Make it pink.”, will allow you to generate a graph of your budget….in pink. If English is not your preferred language, then use French. Ask for the plot title to be printed in German. It’s multilingual, allowing you to refine graph aesthetics in a way intuitive to you. It even understands when you make a spelling mistake. But remember, the underlying architecture relies on OpenAI models and hence it is bounded by their limitations.

So grab yourself an API key from the OpenAI website and load some credit onto your account. At the time of writing ChatGPT costs US$0.002 / 1,000 tokens, with 1,000 tokens around 750 words. The query below “average running time by genre” on the preloaded movies dataset used around 500 tokens, costing less than US$0.002. Your credit should go a long way.

Chat2VIS natural language interface.

To understand more on how Chat2VIS works, take a read of these articles:

--

--