Published on January 24, 2024, 4:10 pm
Generative AI, or generative artificial intelligence, is revolutionizing the field of data visualization by speeding up and enhancing the process. Are you tired of spending endless hours creating boring charts? With the power of generative AI, you can transform your data visualization and make it more engaging and informative. In this article, we will explore how you can leverage generative AI tools such as Python Altair, GitHub Copilot, ChatGPT, and DALL-E to elevate your data visualization game.
Let’s start by using GitHub Copilot to build the basic chart. GitHub Copilot acts as an AI assistant that helps you write code efficiently. By describing the sequence of actions required for your software, Copilot generates runnable code in your preferred programming language.
Before utilizing GitHub Copilot, it’s essential to set up a free trial or subscription for your personal GitHub account. If you are a teacher or student, there is also an option for a free subscription plan specifically designed for educational purposes.
Once the setup is complete, integrate Copilot as an extension of Visual Studio Code (VSC), which is a popular code editor among developers. By following a few simple steps, you can configure VSC with Copilot.
Now let’s dive into generating the basic chart using Copilot. The process involves two steps: loading and preprocessing data. By providing instructions to Copilot, it will generate the corresponding Python code for these steps. Running this code will produce an HTML file named “chart.html,” which can be opened in any preferred browser to visualize the chart.
After building the basic chart using Copilot’s assistance, you have complete control over further improvements. For example, if you want to increase the stroke width for BES (Business Enterprise Sector), ask Copilot to generate code for it. Simply add a comma after specifying color and write instructions accordingly. After pressing enter, wait for Copilot to generate the code that fits your requirements.
To enhance the chart readability and engage your audience emotionally, you can also add an image using DALL-E. DALL-E is a generative AI model that combines GPT-3’s language capabilities with image generation capabilities. To use DALL-E, you need to create an account on the OpenAI website and purchase some credits.
Once again, you will write instructions to generate the desired image using DALL-E. The output will be a black and white icon representing research and development expenditure, for example. Incorporate this generated image into the chart by adding the appropriate code snippet.
To view the final chart with all improvements, run it on a web server. You can accomplish this by executing a Python command from the directory containing the HTML file. After running the command, access localhost:8000/chart.html in your browser to see the chart in action.
Congratulations! You have now successfully utilized generative AI tools to create an outstanding data visualization. By combining Python Altair, GitHub Copilot, ChatGPT for generating text annotations, and DALL-E for adding images, you have taken your data storytelling to new heights.
If you want to explore more possibilities with generative AI in data storytelling or learn how to improve your charts further, there are resources available that delve deeper into these topics . You can also find additional information about data visualization with Python Altair in another helpful resource .
In conclusion, leveraging generative AI empowers you to create visually appealing and informative data visualizations without spending countless hours on manual processes. By automating certain tasks through AI assistants like GitHub Copilot and incorporating powerful models like ChatGPT and DALL-E, you can unlock endless possibilities for enhancing your data storytelling abilities.
 A. Lo Duca.Data Storytelling with Generative AI using Python and Altair.
 A. Lo Duca. Using Python Altair for Data Storytelling.
About the Author:
Angelica Lo Duca is a researcher at the Institute of Informatics and Telematics of the National Research Council (IIT-CNR) in Pisa, Italy. She specializes in Data Science, Data Analysis, Text Analysis, Open Data, Web Applications, Data Engineering, and Data Journalism. Angelica is also an enthusiastic tech writer and author of several notable books in the field.
(Get The Complete Collection of Data Science Cheat Sheets & Great Big NLP Primer ebook)
Subscribe To Our Newsletter