簡體   English   中英

縮放區域無法正常工作 - Matplotlib

[英]Zoom Region Not Working Properly - Matplotlib

所以,我試圖從應該放大的 plot 中獲取一個區域的子圖。

代碼:(最小的,可重現的)

import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

#Loading Data
data = pd.read_csv("lol.csv")
data.head()

import matplotlib.pyplot as plt
ypoints = np.array(data['KDA'])
xpoints = np.array(data['Win/Lose'])

from mpl_toolkits.axes_grid1.inset_locator import mark_inset, inset_axes
ax = plt.subplot(1, 1, 1)
ax.scatter(xpoints, ypoints)
ax.set_xlabel("Win/Loss")
ax.set_ylabel("KDA")
axins = ax.inset_axes([0.3, 0.3, 0.47, 0.47])
x1, x2, y1, y2 = 0, 0, -0.5, 6.5
axins.set_xlim(x1, x2)
axins.set_ylim(y1, y2)

ax.indicate_inset_zoom(axins, edgecolor="black")

它顯示了這一點:

問題

它應該有點像這樣:

可能的解決方案

或有點像這樣:( 收集)

可能的解決方案 2

我現在該怎么辦?

謝謝。

解決方案:

我只是忘了添加散點圖 function。

axins.scatter(xpoints, ypoints)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM