3D Scatter

Real Estate Market Analysis

Property market visualization showing size, bedrooms, and price by property type.

Output
Real Estate Market Analysis
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(963)

# Real estate listings
n_properties = 150

sqft = np.random.uniform(800, 4000, n_properties)
bedrooms = np.random.choice([1, 2, 3, 4, 5], n_properties, p=[0.1, 0.25, 0.35, 0.2, 0.1])
price = sqft * 200 + bedrooms * 50000 + np.random.normal(0, 50000, n_properties)
price = np.clip(price, 100000, 1500000)

# Property type
prop_type = np.random.choice(['Condo', 'House', 'Townhouse'], n_properties, p=[0.3, 0.5, 0.2])
type_colors = {'Condo': '#27D3F5', 'House': '#6CF527', 'Townhouse': '#F5B027'}
colors = [type_colors[t] for t in prop_type]

fig = plt.figure(figsize=(10, 8), facecolor='#ffffff')
ax = fig.add_subplot(111, projection='3d', facecolor='#ffffff')

ax.scatter(sqft, bedrooms, price/1000, c=colors, s=60, 
           alpha=0.7, edgecolors='#374151', linewidths=0.3)

ax.set_xlabel('Square Feet', color='#1f2937', fontsize=10)
ax.set_ylabel('Bedrooms', color='#1f2937', fontsize=10)
ax.set_zlabel('Price ($K)', color='#1f2937', fontsize=10)
ax.set_title('Real Estate Market Analysis', color='#1f2937', fontsize=14, fontweight='bold', pad=20)

ax.tick_params(colors='#6b7280', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#e5e7eb')
ax.yaxis.pane.set_edgecolor('#e5e7eb')
ax.zaxis.pane.set_edgecolor('#e5e7eb')

ax.view_init(elev=20, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support