How to make a pie chart in Tableau

Here is the graph code: Be sure to check the data in the chart to make sure I got it right.

Python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Sample data
data = pd.DataFrame({
    'Category': ['Food', 'Transportation', 'Housing', 'Utilities', 'Other'],
    'Expenses': [300, 200, 500, 150, 100]
})

# Create a pie chart
plt.figure(figsize=(8, 8))
plt.pie(data['Expenses'], labels=data['Category'], autopct='%1.1f%%', startangle=140)
plt.title('Pie Chart of Expenses')
plt.axis('equal')  # Equal aspect ratio ensures a circular pie chart

# Display the pie chart
plt.show()

Leave a Reply

Your email address will not be published. Required fields are marked *