下面是一个使用 Python 和 matplotlib 库绘制基于时间序列的山脊图的代码示例:
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# 生成一个随机的时间序列数据
np.random.seed(0)
num_points = 100
x = pd.date_range(start='2023-01-01', periods=num_points, freq='D')
y = np.random.randn(num_points)
# 绘制山脊图
plt.plot(