import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
def make_heatmap(sale_data):
df = pd.DataFrame(sale_data, columns=["b", "c", "value"])
df_pivot = df.pivot(index="b", columns="c", values="value")
plt.figure(figsize=(12, 9))
sns.heatmap(df_pivot, annot=True, fmt="g", cmap="Greens")
plt.show()
def main():
sale_data = [[1, 2, 3], [2, 3, 5], [4, 3, 2], [2, 4, 5], [1, 5, 1]]
make_heatmap(sale_data)
if __name__ == "__main__":
main()
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme