graphを追加
This commit is contained in:
parent
035d94aac7
commit
f4fbc178bd
6
README.md
Normal file
6
README.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
仮想環境
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python -m venv venv
|
||||||
|
.\venv\Scripts\activate
|
||||||
|
```
|
38
graphes/base/positioning_map.py
Normal file
38
graphes/base/positioning_map.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
# サンプルデータを辞書で定義
|
||||||
|
data = [
|
||||||
|
{"name": "Product A", "x": 8, "y": 7},
|
||||||
|
{"name": "Product B", "x": 3, "y": 8},
|
||||||
|
{"name": "Product C", "x": 6, "y": 4},
|
||||||
|
{"name": "Product D", "x": 2, "y": 6}
|
||||||
|
]
|
||||||
|
|
||||||
|
# データを軸ごとに分ける
|
||||||
|
categories = [item["name"] for item in data]
|
||||||
|
x = [item["x"] for item in data]
|
||||||
|
y = [item["y"] for item in data]
|
||||||
|
|
||||||
|
# グラフの作成
|
||||||
|
plt.figure(figsize=(8, 6))
|
||||||
|
plt.scatter(x, y, s=200, color='skyblue', edgecolors='black', alpha=0.7)
|
||||||
|
|
||||||
|
# 各データポイントにラベルを付ける
|
||||||
|
for i, category in enumerate(categories):
|
||||||
|
plt.text(x[i] + 0.2, y[i], category, fontsize=10)
|
||||||
|
|
||||||
|
# 軸ラベルとタイトル
|
||||||
|
plt.title('Positioning Map', fontsize=16)
|
||||||
|
plt.xlabel('Price (X-axis)', fontsize=12)
|
||||||
|
plt.ylabel('Quality (Y-axis)', fontsize=12)
|
||||||
|
|
||||||
|
# グリッドを追加
|
||||||
|
plt.grid(alpha=0.3)
|
||||||
|
|
||||||
|
# X軸とY軸の範囲を設定
|
||||||
|
plt.xlim(0, 10)
|
||||||
|
plt.ylim(0, 10)
|
||||||
|
|
||||||
|
# グラフを表示
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.show()
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
matplotlib
|
Loading…
x
Reference in New Issue
Block a user