Guide: How to generate a forest plot from 2D Data Table and Column Table using AI?

Guide: How to generate a forest plot from 2D Data Table and Column Table using AI?

Guide: How to generate a forest plot from 2D Data Table and Column Table using AI?

Guide: How to generate a forest plot from 2D Data Table and Column Table using AI?

Feb 25, 2025

Feb 25, 2025

4 min read

4 min read

Welcome to the AI and Statistics series!

Let’s dive into how AI can transform tabular data into various types of charts.

Today, we will be using a 2D Data Table and a Column Table to generate Forest Charts.

Forest charts are commonly used for visualizing the estimated effects or outcomes of different studies or data series on the same graph.

We’ll demonstrate how these two different table structures can be transformed and visualized in the form of forest charts.

Our analysis can help understand the differences between 2D Data Table and Column Table structures, and visualize how the data from these structures can be effectively represented.

Don’t worry about using the AI Agent-driven Bayeslab, all you need is natural language to get the data analysis result.

All content will be explained in the most comprehensible natural language descriptions to help you get started with data analysis from scratch.

We’ll start with a data table featuring Forest Map.xlsx.

This file is a 2D Data Table where each row contains an independent variable (X) and a dependent variable (Y).We’ll compare this with a Column Table format presented in Column-Forest Map.xlsx, where the columns represent grouped variables.

We’ll delve into how these prompts influence the final charts and uncover techniques for effective data visualization.

In just 2 minutes, you’ll learn how to transform and visualize different table structures into Forest Charts.

Our steps will include:

Step1-Table Transform

Step 2–2D Data table Forest Plot

Step 3- Column Forest Plot

Step 1: Table Transform

We first convert the 2D Data Table into a Column Table format.

The Prompt is:

Once the above prompt is written, click ‘Run’ to convert the 2D Data Table into a Column format with the Genes data creating different columns, and Hazard Ratio, Lower 95%CI, High 95%CI as rows. The transformed table is saved locally as “Column-Forest Map.”

Step 2: 2D Data table Forest Plot

2.1 — Drawing

We use Forest Map.xlsx to draw a forest plot.

The Prompt is:

Read Forest Map.xlsx, convert this 2D Data Table into a Column format, grouping by the Gene field for different columns, with Hazard Ratio, Lower 95%CI, High 95%CI as row data.

Column Requirements (with column titles and row titles):

Column titles: The columns should be grouped based on the Gene column data from the original table.

Row titles: The rows should be Hazard Ratio, Lower 95%CI, High 95%CI.

Rename row titles: Lower 95%CI to Lower Limit and High 95%CI to Upper Limit.

Save the processed data table locally, named as “Column-Forest Map”.

Once the prompt is written, click ‘Run’ to generate the forest plot representing the data from the 2D DataTable.

2.2 — Add Auxiliary Lines

We add auxiliary lines for better visualization.

The Prompt is:

Read Forest Map.xlsx and draw a forest plot.

Once the prompt is written, click ‘Run’ to adjust the X-axis tick marks to multiples of 0.5 and add an auxiliary line at X=1.0 using a dashed line.

Step 3: Column Forest Plot

3.1 — Drawing

We draw a forest plot using the Column-Forest Map.xlsx.

The Prompt is:

Read Forest Map.xlsx and draw a forest plot.

Chart optimization:

Adjust the X-axis so that the majority of the graph area covers the entire chart (set tick marks to multiples of 0.5).

Add an auxiliary line at X=1.0 using a dashed line.

Once the prompt is written, click ‘Run’ to generate the forest plot based on the column-formatted data.

3.2 — Add Auxiliary Lines

We add auxiliary lines to the Column Table plot for better visualization.

The Prompt is:

Read Column-Forest Map.xlsx , which is a Column table. The “Measure” field serves as the row title and is not part of the column grouping.

Column Grouping: Includes all columns except for the “Measure” field.

Rows are not grouped but do have titles: Use the values under the “Measure” column as the titles for each row.

Create a Mean/Median & error forest plot for each data group based on the column grouping, oriented horizontally.

Chart optimization:

Adjust the X-axis so that the majority of the graph area covers the entire chart (set tick marks to multiples of 0.5).

Add an auxiliary line at X=1.0 using a dashed line.

Once the prompt is written, click ‘Run’ to adjust the X-axis tick marks to multiples of 0.5 and add an auxiliary line at X=1.0 using a dashed line.

Thank you for watching this installment of the AI and Statistics series!

We showed how to transform a 2D Data Table into a Column Table and how to create Forest Charts from both table structures.

Stay tuned for our upcoming demonstrations to explore more fascinating data visualization.

Using AI Agent and Bayeslab, anyone can organize, analyze, plot data charts, and make business data predictions like a professional data analyst based on previous data.


About Bayeslab 


Bayeslab: Website

The AI First Data Workbench

X: @BayeslabAI

Documents:

https://bayeslab.gitbook.io/docs

Blogs:

https://bayeslab.ai/blog

Bayeslab is a powerful web-based AI code editor and data analysis assistant designed to cater to a diverse group of users, including :

👥 data analysts ,🧑🏼‍🔬experimental scientists, 📊statisticians, 👨🏿‍💻 business analysts, 👩‍🎓university students, 🖍️academic writers, 👩🏽‍🏫scholars, and ⌨️ Python learners.

Bayeslab makes data analysis as easy as note-taking!

Bayeslab makes data analysis as easy
as note-taking!

Start Free

Bayeslab makes data analysis as easy as note-taking!

Bayeslab makes data analysis as easy as note-taking!