matplotlib字型大小相關設定__matplotlib

來源:互聯網
上載者:User
ax = plt.subplot(111)# 設定刻度字型大小plt.xticks(fontsize=20)plt.yticks(fontsize=20)# 設定座標標籤字型大小ax.set_xlabel(..., fontsize=20)ax.set_ylabel(..., fontsize=20)# 設定圖例字型大小ax.legend(..., fontsize=20)選擇如何顯示刻度 ax.xaxis.set_ticks_position(‘none’) ax.yaxis.set_ticks_position(‘right’)import matplotlib.pyplot as pltimport numpy as npx = np.arange(1, 11)fig = plt.figure(1)ax1 = plt.subplot(2, 1, 1)ax2 = plt.subplot(2, 1, 2)l1, = ax1.plot(x, x*x, 'r')             #這裡關鍵哦l2, = ax2.plot(x, x*x, 'b')           # 注意plt.legend([l1, l2], ['first', 'second'], loc = 'upper right')             #其中,loc表示位置的;plt.show()'best'         : 0, (only implemented for axes legends)(自適應方式)'upper right'  : 1,'upper left'   : 2,'lower left'   : 3,'lower right'  : 4,'right'        : 5,'center left'  : 6,'center right' : 7,'lower center' : 8,'upper center' : 9,'center'       : 10,KeywordDescriptionloca location codepropthe font property (matplotlib.font_manager.FontProperties 對象)egsong_font = matplotlib.font_manager.FontProperties(fname='simsun.ttc', size=8)fontsizethe font size (和prop互斥,不可同時使用)markerscalethe relative size of legend markers vs. originalnumpointsthe number of points in the legend for linescatterpointsthe number of points in the legend for scatter plotscatteryoffsetsa list of yoffsets for scatter symbols in legendframeonif True, draw a frame around the legend. If None, use rcfancyboxif True, draw a frame with a round fancybox. If None, use rcshadowif True, draw a shadow behind legendncolnumber of columnsborderpadthe fractional whitespace inside the legend borderlabelspacingthe vertical space between the legend entrieshandlelengththe length of the legend handleshandleheightthe length of the legend handleshandletextpadthe pad between the legend handle and textborderaxespadthe pad between the axes and legend bordercolumnspacingthe spacing between columnstitlethe legend titlebbox_to_anchorthe bbox that the legend will be anchored.bbox_transformthe transform for the bbox. transAxes if None.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.