import math
import random
import wandb
# Simulate temperature variations at different altitudes over time
data = [
[i, random.uniform(-10, 20) - 0.005 * i + 5 * math.sin(i / 50)]
for i in range(300)
]
# Create W&B table with altitude (m) and temperature (°C) columns
table = wandb.Table(data=data, columns=["altitude (m)", "temperature (°C)"])
# Initialize W&B run and log the scatter plot
with wandb.init(project="temperature-altitude-scatter") as run:
# Create and log the scatter plot
scatter_plot = wandb.plot.scatter(
table=table,
x="altitude (m)",
y="temperature (°C)",
title="Altitude vs Temperature",
)
run.log({"altitude-temperature-scatter": scatter_plot})