So, I was trying to get a subplot of a region from an plot that should be zoomed in.
Code: (Minimal, Reproducible one)
JavaScript
x
23
23
1
import numpy as np # linear algebra
2
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
3
4
#Loading Data
5
data = pd.read_csv("lol.csv")
6
data.head()
7
8
import matplotlib.pyplot as plt
9
ypoints = np.array(data['KDA'])
10
xpoints = np.array(data['Win/Lose'])
11
12
from mpl_toolkits.axes_grid1.inset_locator import mark_inset, inset_axes
13
ax = plt.subplot(1, 1, 1)
14
ax.scatter(xpoints, ypoints)
15
ax.set_xlabel("Win/Loss")
16
ax.set_ylabel("KDA")
17
axins = ax.inset_axes([0.3, 0.3, 0.47, 0.47])
18
x1, x2, y1, y2 = 0, 0, -0.5, 6.5
19
axins.set_xlim(x1, x2)
20
axins.set_ylim(y1, y2)
21
22
ax.indicate_inset_zoom(axins, edgecolor="black")
23
It is showing this:
It should show somewhat like this:
or somewhat like this: (Collected)
What should I do now?
Thanks.
Advertisement
Answer
Solution:
I just forgot to adding the scatter function.
axins.scatter(xpoints, ypoints)