![](/img/trans.png)
[英]How can I change datetime format of x-axis values in matplotlib using python?
[英]How can i change the corresponding X-Axis Label for a given point in 'iplot' of python
當我使用 iplot 函數時,如何顯示相應的數據元素名稱。 我使用以下命令來創建情節
data_f = pd.DataFrame({'Third':val , 'Fourth':val2 , 'Sixth':val3 } )
data_f.iplot( )
這里 val,val2,val3 是 Pandas.Series 和相應的列是 'Third' , 'Fourth' , 'Sixth' ,對於與每個學生的卷號相對應的這些列,我想使用 iplot 繪制圖形,在 x 軸上顯示卷號而不是 [1,2,3,..] 的系列 相應的卷號以 roll_series 的系列形式存在。
預先感謝您的幫助
一種方法是將所有系列放在一個數據框中並繪制如下。
# Create series val, val1, val3 and roll_num
val = np.random.randn(10)
val2 = np.random.randn(10)
val3= np.random.randn(10)
roll_num = np.linspace(start=1001,stop=1010,num=10)
# Create dataframe from above series
df = pd.DataFrame({'val': val, 'val2': val2, 'val3': val3, 'roll_num':roll_num})
df.head(2)
# Plot using iplot() where x-axis now shows student roll number
df.iplot(x='roll_num', y=['val', 'val2', 'val3'], xTitle='Student Roll Number',yTitle='Score',title='Class Scores')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.