我有一個問題,我簡化如下,如果有人建議我在 seaborn 中的代碼就像我想要實作的那樣,我會很高興。
import matplotlib.pyplot as plt
a = [2000, 4000, 3000, 8000, 6000, 3000, 3000, 4000, 2000, 4000, 3000, 8000, 6000, 3000, 3000, 4000, 2000, 4000, 3000, 8000, 6000, 3000, 3000, 4000]
b = [0.8, 0.9, 0.83, 0.81, 0.86, 0.89, 0.89, 0.8, 0.8, 0.9, 0.83, 0.81, 0.86, 0.89, 0.89, 0.8, 0.8, 0.9, 0.83, 0.81, 0.86, 0.89, 0.89, 0.8]
c = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
fig1, ax1 = plt.subplots(figsize=(12, 6))
ax12 = ax1.twinx()
ax1.bar(c, a)
ax12.plot(c, b, 'o-', color="red", markersize=12,
markerfacecolor='Yellow', markeredgewidth=2, linewidth=2)
ax12.set_ylim(bottom=0, top=1, emit=True, auto=False)
plt.grid()
plt.show()
我正在嘗試實作中心和垂直的標簽,如下圖所示。

uj5u.com熱心網友回復:
從 matplotlib 3.4.0 開始,使用
海運版
我剛剛注意到問題文本詢問有關 seaborn 的問題,在這種情況下我們可以使用
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/421598.html
標籤:
