Data Analysis with AI: From Dataset to Publication Figures
This tutorial walks you through using OpenCode to analyze the Palmer Penguins dataset and create visualizations.
What you’ll learn
- How to use
Planmode to guide AI interactions - How to prompt for data analysis tasks
- How to get AI to create figures and export them
Steps
-
Download the “Palmer Penguins dataset” to your folder. This will be an example dataset to use: https://allisonhorst.github.io/palmerpenguins/. You can download the CSV directly from here
-
Switch to
Planmode. This is a mode that won’t start to make things. It will ask you questions to help guide your progress. -
Use this prompt:
Make me some figures of the Palmer Penguins dataset attached.
Output the figure in an Excel file.
-
Interact with the
Plan. For this example I replied that I want scatter plots comparing body measurements across penguin species. This is where you can influence what the model does. This is the major advantage over other chatbots. -
Change from
Planmode toBuildmode and begin planned tasks by prompting it to begin (i.e. “yes”). -
If it gets stuck with an error, prompt
complete analysisand it will continue working until the end.
Results
The Palmer Penguins dataset contains measurements for three penguin species (Adelie, Chinstrap, and Gentoo) from islands in the Palmer Archipelago, Antarctica. It includes features like bill length, bill depth, flipper length, and body mass.
Tips
- Be specific in your prompts about what you want (e.g., “scatter plots”, “histograms”, “correlation matrix”)
- The
Planmode lets you refine the approach before the AI starts working - You can always interrupt and redirect if it’s going in the wrong direction
- Try asking for species comparisons or island-based groupings for interesting visualizations