fix 'artist'

涓婄骇 763e97d0
......@@ -22,7 +22,7 @@ Matplotlib 鐨勮璁$悊蹇垫槸锛屼綘搴旇鑳藉浣跨敤鍑犱釜锛屾垨鑰呭彧鏈変竴涓
娌℃湁鎵惧埌閫傚悎鎴戠殑鍖咃紝鎴戝仛浜嗕换浣曡嚜绉 Python 绋嬪簭鍛樹細鍋氱殑浜嬫儏锛氭捀璧锋垜鐨勮瀛愬紑濮嬭嚜宸遍犮傛垜娌℃湁浠讳綍鐪熸鐨勮绠楁満鍥惧舰缁忛獙锛屽喅瀹氭ā浠 MATLAB 鐨勭粯鍥惧姛鑳斤紝鍥犱负 MATLAB 鍋氬緱寰堝ソ銆傝繖鏈夐澶栫殑浼樺娍锛岃澶氫汉鏈夊緢澶 MATLAB 鐨勭粡楠岋紝鍥犳锛屼粬浠彲浠ュ緢蹇紑濮嬪湪 python 涓粯鍥俱備粠寮鍙戜汉鍛樼殑瑙掑害鏉ョ湅锛屾嫢鏈夊浐瀹氱殑鐢ㄦ埛鎺ュ彛锛坧ylab 鎺ュ彛锛夐潪甯告湁鐢紝鍥犱负浠g爜搴撶殑鍐呭鍙互閲嶆柊璁捐锛岃屼笉浼氬奖鍝嶇敤鎴蜂唬鐮併
Matplotlib 浠g爜鍦ㄦ蹇典笂鍒嗕负涓変釜閮ㄥ垎锛歱ylab 鎺ュ彛鏄敱`matplotlib.pylab`鎻愪緵鐨勫嚱鏁伴泦锛屽厑璁哥敤鎴蜂娇鐢ㄩ潪甯哥被浼间簬 MATLAB 鍥剧敓鎴愪唬鐮侊紙[Pyplot 鏁欑▼](http://matplotlib.org/users/pyplot_tutorial.html#pyplot-tutorial)锛夌殑浠g爜鍒涘缓缁樺浘銆 Matplotlib 鍓嶇鎴 Matplotlib API 鏄竴缁勯噸瑕佺殑绫伙紝鍒涘缓鍜岀鐞嗗浘褰紝鏂囨湰锛岀嚎鏉★紝鍥捐〃绛夛紙[Artist 鏁欑▼](http://matplotlib.org/users/artists.html#artist-tutorial)锛夈傝繖鏄竴涓杈撳嚭鏃犳墍浜嗚В鐨勬娊璞℃帴鍙c傚悗绔槸璁惧鐩稿叧鐨勭粯鍥捐澶囷紝涔熺О涓烘覆鏌撳櫒锛屽皢鍓嶇琛ㄧず杞崲涓烘墦鍗颁欢鎴栨樉绀鸿澶囷紙浠涔堟槸鍚庣锛燂級銆傚悗绔ず渚嬶細PS 鍒涘缓 [PostScript庐](http://www.adobe.com/products/postscript/) 鎵撳嵃浠讹紝SVG 鍒涘缓[鍙缉鏀剧煝閲忓浘褰](http://www.w3.org/Graphics/SVG/)鎵撳嵃浠讹紝Agg 浣跨敤 Matplotlib 闄勫甫鐨勯珮璐ㄩ噺[鍙嶉绮掑嚑浣曞簱](http://antigrain.com/)鍒涘缓 PNG 杈撳嚭锛孏TK 鍦 [Gtk+](https://www.gtk.org/) 搴旂敤绋嬪簭涓祵鍏 Matplotlib锛孏TKAgg 浣跨敤鍙嶉绮掓覆鏌撳櫒鍒涘缓鍥惧舰骞跺皢鍏跺祵鍏ュ埌 Gtk+ 搴旂敤绋嬪簭涓紝浠ュ強鐢ㄤ簬 [PDF](https://acrobat.adobe.com/us/en/why-adobe/about-adobe-pdf.html)[WxWidgets](https://www.wxpython.org/)[Tkinter](https://docs.python.org/library/tkinter.html) 绛夈
Matplotlib 浠g爜鍦ㄦ蹇典笂鍒嗕负涓変釜閮ㄥ垎锛歱ylab 鎺ュ彛鏄敱`matplotlib.pylab`鎻愪緵鐨勫嚱鏁伴泦锛屽厑璁哥敤鎴蜂娇鐢ㄩ潪甯哥被浼间簬 MATLAB 鍥剧敓鎴愪唬鐮侊紙[Pyplot 鏁欑▼](http://matplotlib.org/users/pyplot_tutorial.html#pyplot-tutorial)锛夌殑浠g爜鍒涘缓缁樺浘銆 Matplotlib 鍓嶇鎴 Matplotlib API 鏄竴缁勯噸瑕佺殑绫伙紝鍒涘缓鍜岀鐞嗗浘褰紝鏂囨湰锛岀嚎鏉★紝鍥捐〃绛夛紙[鑹烘湳瀹鏁欑▼](http://matplotlib.org/users/artists.html#artist-tutorial)锛夈傝繖鏄竴涓杈撳嚭鏃犳墍浜嗚В鐨勬娊璞℃帴鍙c傚悗绔槸璁惧鐩稿叧鐨勭粯鍥捐澶囷紝涔熺О涓烘覆鏌撳櫒锛屽皢鍓嶇琛ㄧず杞崲涓烘墦鍗颁欢鎴栨樉绀鸿澶囷紙浠涔堟槸鍚庣锛燂級銆傚悗绔ず渚嬶細PS 鍒涘缓 [PostScript庐](http://www.adobe.com/products/postscript/) 鎵撳嵃浠讹紝SVG 鍒涘缓[鍙缉鏀剧煝閲忓浘褰](http://www.w3.org/Graphics/SVG/)鎵撳嵃浠讹紝Agg 浣跨敤 Matplotlib 闄勫甫鐨勯珮璐ㄩ噺[鍙嶉绮掑嚑浣曞簱](http://antigrain.com/)鍒涘缓 PNG 杈撳嚭锛孏TK 鍦 [Gtk+](https://www.gtk.org/) 搴旂敤绋嬪簭涓祵鍏 Matplotlib锛孏TKAgg 浣跨敤鍙嶉绮掓覆鏌撳櫒鍒涘缓鍥惧舰骞跺皢鍏跺祵鍏ュ埌 Gtk+ 搴旂敤绋嬪簭涓紝浠ュ強鐢ㄤ簬 [PDF](https://acrobat.adobe.com/us/en/why-adobe/about-adobe-pdf.html)[WxWidgets](https://www.wxpython.org/)[Tkinter](https://docs.python.org/library/tkinter.html) 绛夈
Matplotlib 琚緢澶氫汉鍦ㄨ澶氫笉鍚岀殑涓婁笅鏂囦腑浣跨敤銆傛湁浜涗汉甯屾湜鑷姩鐢熸垚 PostScript 鏂囦欢浠ュ彂閫佺粰鎵撳嵃鏈烘垨鍙戝竷鍟嗐傚叾浠栦汉鍦 Web 搴旂敤绋嬪簭鏈嶅姟鍣ㄤ笂閮ㄧ讲 Matplotlib 鏉ョ敓鎴 PNG 杈撳嚭锛屽苟鍖呭惈鍦ㄥ姩鎬佺敓鎴愮殑缃戦〉涓備竴浜涗汉鍦 Windows鈩 涓婄殑 Tkinter 鐨 Python shell 涓互浜や簰鏂瑰紡浣跨敤 Matplotlib銆傛垜鐨勪富瑕佺敤閫旀槸灏 Matplotlib 宓屽叆 Windows锛孡inux 鍜 Macintosh OS X 涓婅繍琛岀殑 Gtk+ EEG 搴旂敤绋嬪簭涓
......
# 鑹烘湳瀹舵暀绋
matplotlib API 鏈変笁涓眰绾с `matplotlib.backend_bases.FigureCanvas`鏄粯鍒跺浘褰㈢殑鍖哄煙锛`matplotlib.backend_bases.Renderer`鏄煡閬撳浣曞湪`ChartCanvas`涓婄粯鍒剁殑瀵硅薄锛岃`matplotlib.artist.Artist`鏄煡閬撳浣曚娇鐢ㄦ覆鏌撳櫒鍦ㄧ敾甯冧笂鐢诲浘鐨勫璞° `FigureCanvas``Renderer`澶勭悊涓庣敤鎴风晫闈㈠伐鍏峰寘锛堝 wxPython锛夋垨 PostScript庐 绛夌粯鍥捐瑷浜や簰鐨勬墍鏈夌粏鑺傦紝`Artist`澶勭悊鎵鏈夐珮绾х粨鏋勶紝濡傝〃绀哄拰甯冨眬鍥惧舰锛屾枃鏈拰绾挎潯銆閫氬父鐢ㄦ埛璇濊垂95锛呯殑鏃堕棿鏉ュ鐞 Artist
matplotlib API 鏈変笁涓眰绾с `matplotlib.backend_bases.FigureCanvas`鏄粯鍒跺浘褰㈢殑鍖哄煙锛`matplotlib.backend_bases.Renderer`鏄煡閬撳浣曞湪`ChartCanvas`涓婄粯鍒剁殑瀵硅薄锛岃`matplotlib.artist.Artist`鏄煡閬撳浣曚娇鐢ㄦ覆鏌撳櫒鍦ㄧ敾甯冧笂鐢诲浘鐨勫璞° `FigureCanvas``Renderer`澶勭悊涓庣敤鎴风晫闈㈠伐鍏峰寘锛堝 wxPython锛夋垨 PostScript庐 绛夌粯鍥捐瑷浜や簰鐨勬墍鏈夌粏鑺傦紝`Artist`澶勭悊鎵鏈夐珮绾х粨鏋勶紝濡傝〃绀哄拰甯冨眬鍥惧舰锛屾枃鏈拰绾挎潯銆鐢ㄦ埛閫氬父瑕佽姳璐95锛呯殑鏃堕棿鏉ュ鐞嗚壓鏈
鏈変袱绉嶇被鍨嬬殑 Artist锛氬熀鏈被鍨嬪拰瀹瑰櫒绫诲瀷銆傚熀鏈被鍨嬭〃绀烘垜浠兂瑕佺粯鍒跺埌鐢诲竷涓婄殑鏍囧噯鍥惧舰瀵硅薄锛`Line2D``Rectangle``Text``AxesImage`绛夛紝瀹瑰櫒鏄斁缃畠浠殑浣嶇疆锛`Axis``Axes``Figure`锛夈傛爣鍑嗙敤娉曟槸鍒涘缓涓涓`Figure`瀹炰緥锛屼娇鐢`Figure`鍒涘缓涓涓垨澶氫釜`Axes``Subplot`瀹炰緥锛屽苟浣跨敤`Axes`瀹炰緥鐨勮緟鍔╂柟娉曟潵鍒涘缓鍩烘湰绫诲瀷銆傚湪涓嬮潰鐨勭ず渚嬩腑锛屾垜浠娇鐢`matplotlib.pyplot.figure()`鍒涘缓涓涓`Figure`瀹炰緥锛岃繖鏄竴涓究鎹风殑鏂规硶锛岀敤浜庡疄渚嬪寲`Figure`瀹炰緥骞跺皢瀹冧滑涓庢偍鐨勭敤鎴风晫闈㈡垨缁樺浘宸ュ叿鍖`FigureCanvas`杩炴帴銆傛濡傛垜浠皢鍦ㄤ笅闈㈣璁虹殑锛岃繖涓嶆槸蹇呴』鐨 - 浣犲彲浠ョ洿鎺ヤ娇鐢 PostScript锛孭DF锛孏tk+ 鎴 wxPython `FigureCanvas`瀹炰緥锛岀洿鎺ュ疄渚嬪寲浣犵殑鍥惧舰骞惰繛鎺ュ畠浠 - 浣嗘槸鍥犱负鎴戜滑鍦ㄨ繖閲屽叧娉ㄨ壓鏈 API锛屾垜浠`pyplot`涓烘垜浠鐞嗕竴浜涚粏鑺傦細
鏈変袱绉嶇被鍨嬬殑鑹烘湳瀹锛氬熀鏈被鍨嬪拰瀹瑰櫒绫诲瀷銆傚熀鏈被鍨嬭〃绀烘垜浠兂瑕佺粯鍒跺埌鐢诲竷涓婄殑鏍囧噯鍥惧舰瀵硅薄锛`Line2D``Rectangle``Text``AxesImage`绛夛紝瀹瑰櫒鏄斁缃畠浠殑浣嶇疆锛`Axis``Axes``Figure`锛夈傛爣鍑嗙敤娉曟槸鍒涘缓涓涓`Figure`瀹炰緥锛屼娇鐢`Figure`鍒涘缓涓涓垨澶氫釜`Axes``Subplot`瀹炰緥锛屽苟浣跨敤`Axes`瀹炰緥鐨勮緟鍔╂柟娉曟潵鍒涘缓鍩烘湰绫诲瀷銆傚湪涓嬮潰鐨勭ず渚嬩腑锛屾垜浠娇鐢`matplotlib.pyplot.figure()`鍒涘缓涓涓`Figure`瀹炰緥锛岃繖鏄竴涓究鎹风殑鏂规硶锛岀敤浜庡疄渚嬪寲`Figure`瀹炰緥骞跺皢瀹冧滑涓庢偍鐨勭敤鎴风晫闈㈡垨缁樺浘宸ュ叿鍖`FigureCanvas`杩炴帴銆傛濡傛垜浠皢鍦ㄤ笅闈㈣璁虹殑锛岃繖涓嶆槸蹇呴』鐨 - 浣犲彲浠ョ洿鎺ヤ娇鐢 PostScript锛孭DF锛孏tk+ 鎴 wxPython `FigureCanvas`瀹炰緥锛岀洿鎺ュ疄渚嬪寲浣犵殑鍥惧舰骞惰繛鎺ュ畠浠 - 浣嗘槸鍥犱负鎴戜滑鍦ㄨ繖閲屽叧娉ㄨ壓鏈 API锛屾垜浠`pyplot`涓烘垜浠鐞嗕竴浜涚粏鑺傦細
```py
import matplotlib.pyplot as plt
......@@ -121,12 +121,12 @@ In [149]: matplotlib.artist.getp(fig.patch)
zorder = 1
```
鎵鏈夌被鐨勬枃妗e瓧绗︿覆涔熷寘鍚`Artist`灞炴э紝鍥犳鎮ㄥ彲浠ユ煡闃呬氦浜掑紡鈥滃府鍔┾濇垨 [Artist 妯″潡](http://matplotlib.org/api/artist_api.html#artist-api)锛屾潵鑾峰彇缁欏畾瀵硅薄鐨勫睘鎬у垪琛ㄣ
鎵鏈夌被鐨勬枃妗e瓧绗︿覆涔熷寘鍚`Artist`灞炴э紝鍥犳鎮ㄥ彲浠ユ煡闃呬氦浜掑紡鈥滃府鍔┾濇垨 [`Artist`妯″潡](http://matplotlib.org/api/artist_api.html#artist-api)锛屾潵鑾峰彇缁欏畾瀵硅薄鐨勫睘鎬у垪琛ㄣ
## 瀵硅薄瀹瑰櫒
鐜板湪鎴戜滑鐭ラ亾濡備綍妫鏌ュ拰璁剧疆鎴戜滑鎯宠閰嶇疆鐨勭粰瀹氬璞$殑灞炴э紝鐜板湪鎴戜滑闇瑕佸浣曡幏鍙栬瀵硅薄銆 鍓嶉潰鎻愬埌浜嗕袱绉嶅璞★細鍩烘湰绫诲瀷鍜屽鍣ㄧ被鍨嬨 鍩烘湰绫诲瀷閫氬父鏄綘鎯宠閰嶇疆鐨勪笢瑗匡紙`Text`瀹炰緥鐨勫瓧浣擄紝`Line2D`鐨勫搴︼級锛岃櫧鐒跺鍣ㄤ篃鏈変竴浜涘睘鎬 - 渚嬪 `Axes`鏄竴涓鍣 Artist锛屽寘鍚綘鐨勭粯鍥句腑鐨勮澶氬熀鏈被鍨嬶紝浣嗗畠涔熸湁灞炴э紝姣斿`xscale`鏉ユ帶鍒`xaxis`鏄滅嚎鎬р濊繕鏄滃鏁扳濄 鍦ㄦ湰鑺備腑锛屾垜浠皢鍥為【鍚勭瀹瑰櫒瀵硅薄瀛樺偍鎮ㄦ兂瑕佽闂殑鑹烘湳瀹剁殑浣嶇疆銆
鐜板湪鎴戜滑鐭ラ亾濡備綍妫鏌ュ拰璁剧疆鎴戜滑鎯宠閰嶇疆鐨勭粰瀹氬璞$殑灞炴э紝鐜板湪鎴戜滑闇瑕佸浣曡幏鍙栬瀵硅薄銆 鍓嶉潰鎻愬埌浜嗕袱绉嶅璞★細鍩烘湰绫诲瀷鍜屽鍣ㄧ被鍨嬨 鍩烘湰绫诲瀷閫氬父鏄綘鎯宠閰嶇疆鐨勪笢瑗匡紙`Text`瀹炰緥鐨勫瓧浣擄紝`Line2D`鐨勫搴︼級锛岃櫧鐒跺鍣ㄤ篃鏈変竴浜涘睘鎬 - 渚嬪 `Axes`鏄竴涓鍣鑹烘湳瀹锛屽寘鍚綘鐨勭粯鍥句腑鐨勮澶氬熀鏈被鍨嬶紝浣嗗畠涔熸湁灞炴э紝姣斿`xscale`鏉ユ帶鍒`xaxis`鏄滅嚎鎬р濊繕鏄滃鏁扳濄 鍦ㄦ湰鑺備腑锛屾垜浠皢鍥為【鍚勭瀹瑰櫒瀵硅薄瀛樺偍鎮ㄦ兂瑕佽闂殑鑹烘湳瀹剁殑浣嶇疆銆
## 鍥惧舰瀹瑰櫒
......
......@@ -35,7 +35,7 @@ handles, labels = ax.get_legend_handles_labels()
ax.legend(handles, labels)
```
`get_legend_handles_labels()`鍑芥暟杩斿洖杞村煙涓婂瓨鍦ㄧ殑鍙ユ焺/artist 鐨勫垪琛紝杩欎簺鍙ユ焺/artist 鍙互鐢ㄤ簬涓虹粨鏋滃浘渚嬬敓鎴愭潯鐩 - 浣嗗煎緱娉ㄦ剰鐨勬槸锛屽苟闈炴墍鏈夎壓鏈閮藉彲浠ユ坊鍔犲埌鍥句緥涓紝 杩欑鎯呭喌涓嬩細鍒涘缓銆庝唬鐞嗐忥紙璇峰弬闃[鐗瑰湴涓烘坊鍔犲埌鍥句緥鍒涘缓 artist锛堜篃绉颁负浠g悊 artist](http://matplotlib.org/users/legend_guide.html#proxy-legend-handles)锛屾潵浜嗚В鏇村璇︾粏淇℃伅锛夈
`get_legend_handles_labels()`鍑芥暟杩斿洖杞村煙涓婂瓨鍦ㄧ殑鍙ユ焺/鑹烘湳瀹剁殑鍒楄〃锛岃繖浜涘彞鏌/鑹烘湳瀹跺彲浠ョ敤浜庝负缁撴灉鍥句緥鐢熸垚鏉$洰 - 浣嗗煎緱娉ㄦ剰鐨勬槸锛屽苟闈炴墍鏈夎壓鏈閮藉彲浠ユ坊鍔犲埌鍥句緥涓紝 杩欑鎯呭喌涓嬩細鍒涘缓銆庝唬鐞嗐忥紙璇峰弬闃[鐗瑰湴涓烘坊鍔犲埌鍥句緥鍒涘缓鑹烘湳瀹讹紙涔熺О涓轰唬鐞嗚壓鏈](http://matplotlib.org/users/legend_guide.html#proxy-legend-handles)锛屾潵浜嗚В鏇村璇︾粏淇℃伅锛夈
涓轰簡瀹屽叏鎺у埗瑕佹坊鍔犲埌鍥句緥鐨勫唴瀹癸紝閫氬父灏嗛傚綋鐨勫彞鏌勭洿鎺ヤ紶閫掔粰`legend()`
......@@ -53,7 +53,7 @@ line_down, = plt.plot([3,2,1], label='Line 1')
plt.legend([line_up, line_down], ['Line Up', 'Line Down'])
```
## 鐗瑰湴涓烘坊鍔犲埌鍥句緥鍒涘缓 artist锛堜篃绉颁负浠g悊 artist
## 鐗瑰湴涓烘坊鍔犲埌鍥句緥鍒涘缓鑹烘湳瀹讹紙涔熺О涓轰唬鐞嗚壓鏈
骞堕潪鎵鏈夌殑鍙ユ焺閮藉彲浠ヨ嚜鍔ㄨ浆鎹负鍥句緥鏉$洰锛屽洜姝ら氬父闇瑕佸垱寤轰竴涓彲杞崲鐨勮壓鏈銆 鍥句緥鍙ユ焺涓嶅繀瀛樺湪浜庤鐢ㄥ埌鐨勫浘鍍忔垨杞村煙涓娿
......@@ -193,7 +193,7 @@ plt.legend([red_dot, (red_dot, white_cross)], ["Attr A", "Attr A+B"])
### 瀹炵幇鑷畾涔夊浘渚嬪鐞嗗櫒
鍙互瀹炵幇鑷畾涔夊鐞嗗櫒锛屽皢浠讳綍鍙ユ焺杞崲涓哄浘渚嬬殑閿紙鍙ユ焺涓嶅繀瑕佹槸`matplotlib`artist锛夈 澶勭悊鍣ㄥ繀椤诲疄鐜癭legend_artist`鏂规硶锛岃鏂规硶涓鸿浣跨敤鐨勫浘渚嬭繑鍥炲崟涓 artist銆 鏈夊叧`legend_artist`鐨勮缁嗕俊鎭紝璇峰弬闃匸`legend_artist()`](http://matplotlib.org/api/legend_api.html#matplotlib.legend_handler.HandlerBase.legend_artist)銆
鍙互瀹炵幇鑷畾涔夊鐞嗗櫒锛屽皢浠讳綍鍙ユ焺杞崲涓哄浘渚嬬殑閿紙鍙ユ焺涓嶅繀瑕佹槸`matplotlib`artist锛夈 澶勭悊鍣ㄥ繀椤诲疄鐜癭legend_artist`鏂规硶锛岃鏂规硶涓鸿浣跨敤鐨勫浘渚嬭繑鍥炲崟涓鑹烘湳瀹銆 鏈夊叧`legend_artist`鐨勮缁嗕俊鎭紝璇峰弬闃匸`legend_artist()`](http://matplotlib.org/api/legend_api.html#matplotlib.legend_handler.HandlerBase.legend_artist)銆
```py
import matplotlib.pyplot as plt
......
......@@ -6,11 +6,11 @@
> 鍗忚锛歔CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/)
Matplotlib 鐨`patheffects`妯″潡鎻愪緵浜嗕竴浜涘姛鑳斤紝鐢ㄤ簬灏嗗涓粯鍒跺眰娆″簲鐢ㄥ埌浠讳綍 Artist锛屽苟鍙互閫氳繃璺緞鍛堢幇銆
Matplotlib 鐨`patheffects`妯″潡鎻愪緵浜嗕竴浜涘姛鑳斤紝鐢ㄤ簬灏嗗涓粯鍒跺眰娆″簲鐢ㄥ埌浠讳綍鑹烘湳瀹锛屽苟鍙互閫氳繃璺緞鍛堢幇銆
鍙互瀵瑰叾搴旂敤璺緞鏁堟灉鐨勮壓鏈鍖呮嫭`Patch``Line2D``Collection`锛岀敋鑷虫枃鏈 姣忎釜鑹烘湳瀹剁殑璺緞鏁堟灉閮藉彲浠ラ氳繃`set_path_effects`鏂规硶锛`set_path_effects`锛夋帶鍒讹紝瀹冮渶瑕佷竴涓`AbstractPathEffect`鐨勫彲杩唬瀹炰緥銆
鏈绠鍗曠殑璺緞鏁堟灉鏄櫘閫氭晥鏋滐紝瀹冪畝鍗曞湴缁樺埗 Artist锛屽苟娌℃湁浠讳綍鏁堟灉锛
鏈绠鍗曠殑璺緞鏁堟灉鏄櫘閫氭晥鏋滐紝瀹冪畝鍗曞湴缁樺埗鑹烘湳瀹锛屽苟娌℃湁浠讳綍鏁堟灉锛
```py
import matplotlib.pyplot as plt
......@@ -28,7 +28,7 @@ plt.show()
## 娣诲姞闃村奖
姣旀甯告晥鏋滄洿鏈夎叮鐨勮矾寰勬晥鏋滄槸闃村奖锛屾垜浠彲浠ュ簲鐢ㄤ簬浠讳綍鍩轰簬璺緞鐨 Artist`SimplePatchShadow``SimpleLineShadow`绫婚氳繃鍦ㄥ熀鏈壓鏈涓嬮潰缁樺埗濉厖琛ヤ竵鎴栫嚎鏉¤ˉ涓佹潵瀹炵幇瀹冿細
姣旀甯告晥鏋滄洿鏈夎叮鐨勮矾寰勬晥鏋滄槸闃村奖锛屾垜浠彲浠ュ簲鐢ㄤ簬浠讳綍鍩轰簬璺緞鐨鑹烘湳瀹`SimplePatchShadow``SimpleLineShadow`绫婚氳繃鍦ㄥ熀鏈壓鏈涓嬮潰缁樺埗濉厖琛ヤ竵鎴栫嚎鏉¤ˉ涓佹潵瀹炵幇瀹冿細
```py
import matplotlib.pyplot as plt
......
......@@ -244,7 +244,7 @@ ax.add_artist(at)
`loc`鍏抽敭瀛椾笌`legend`鍛戒护涓惈涔夌浉鍚屻
涓涓畝鍗曠殑搴旂敤鏄綋鑹烘湳瀹讹紙鎴栬壓鏈鐨勯泦鍚堬級鐨勫儚绱犲ぇ灏忓湪鍒涘缓鏃跺凡鐭ャ 渚嬪锛屽鏋滆缁樺埗涓涓浐瀹氬ぇ灏忎负 20 鍍忕礌 脳20 鍍忕礌锛堝崐寰勪负 10 鍍忕礌锛夌殑鍦嗭紝鍒欏彲浠ヤ娇鐢`AnchoredDrawingArea`銆 瀹炰緥浣跨敤缁樺浘鍖哄煙鐨勫ぇ灏忓垱寤猴紙浠ュ儚绱犱负鍗曚綅锛夈 鐢ㄦ埛鍙互鍦ㄧ粯鍥惧尯浠绘剰娣诲姞 artist銆 娉ㄦ剰锛屾坊鍔犲埌缁樺浘鍖哄煙鐨勮壓鏈鐨勮寖鍥翠笌缁樺埗鍖哄煙鏈韩鐨勪綅缃棤鍏筹紝鍙拰鍒濆澶у皬鏈夊叧銆
涓涓畝鍗曠殑搴旂敤鏄綋鑹烘湳瀹讹紙鎴栬壓鏈鐨勯泦鍚堬級鐨勫儚绱犲ぇ灏忓湪鍒涘缓鏃跺凡鐭ャ 渚嬪锛屽鏋滆缁樺埗涓涓浐瀹氬ぇ灏忎负 20 鍍忕礌 脳20 鍍忕礌锛堝崐寰勪负 10 鍍忕礌锛夌殑鍦嗭紝鍒欏彲浠ヤ娇鐢`AnchoredDrawingArea`銆 瀹炰緥浣跨敤缁樺浘鍖哄煙鐨勫ぇ灏忓垱寤猴紙浠ュ儚绱犱负鍗曚綅锛夈 鐢ㄦ埛鍙互鍦ㄧ粯鍥惧尯浠绘剰娣诲姞鑹烘湳瀹銆 娉ㄦ剰锛屾坊鍔犲埌缁樺浘鍖哄煙鐨勮壓鏈鐨勮寖鍥翠笌缁樺埗鍖哄煙鏈韩鐨勪綅缃棤鍏筹紝鍙拰鍒濆澶у皬鏈夊叧銆
```py
from mpl_toolkits.axes_grid.anchored_artists import AnchoredDrawingArea
......@@ -279,7 +279,7 @@ box.drawing_area.add_artist(el)
![](http://matplotlib.org/_images/anchored_box03.png)
濡傚浘渚嬫墍绀猴紝鍙互璁剧疆`bbox_to_anchor`鍙傛暟銆 浣跨敤`HPacker``VPacker`锛屼綘鍙互鍍忓浘渚嬩腑涓鏍锋帓鍒 artist锛堜簨瀹炰笂锛岃繖鏄浘渚嬬殑鍒涘缓鏂瑰紡锛夈
濡傚浘渚嬫墍绀猴紝鍙互璁剧疆`bbox_to_anchor`鍙傛暟銆 浣跨敤`HPacker``VPacker`锛屼綘鍙互鍍忓浘渚嬩腑涓鏍锋帓鍒鑹烘湳瀹锛堜簨瀹炰笂锛岃繖鏄浘渚嬬殑鍒涘缓鏂瑰紡锛夈
[婧愪唬鐮](http://matplotlib.org/users/plotting/examples/anchored_box04.py)
......@@ -329,7 +329,7 @@ matplotlib 涓殑鏍囨敞鏀寔[鏍囨敞鏂囨湰](http://matplotlib.org/users/annotati
![](http://matplotlib.org/_images/annotate_simple_coord01.png)
璇锋敞鎰忥紝浣犵殑璐d换鏄湪缁樺埗`an2`涔嬪墠纭畾鍧愭爣 artist锛堜笂渚嬩腑鐨刞an1`锛夌殑鑼冨洿銆 鍦ㄥぇ澶氭暟鎯呭喌涓嬶紝杩欐剰鍛崇潃`an2`闇瑕佹櫄浜巂an1`銆
璇锋敞鎰忥紝浣犵殑璐d换鏄湪缁樺埗`an2`涔嬪墠纭畾鍧愭爣鑹烘湳瀹锛堜笂渚嬩腑鐨刞an1`锛夌殑鑼冨洿銆 鍦ㄥぇ澶氭暟鎯呭喌涓嬶紝杩欐剰鍛崇潃`an2`闇瑕佹櫄浜巂an1`銆
3. 涓涓繑鍥`BboxBase``Transform`鐨勫疄渚嬬殑鍙皟鐢ㄥ璞° 濡傛灉杩斿洖涓涓彉鎹紝瀹冧笌 1 鐩稿悓锛屽鏋滆繑鍥`bbox`锛屽畠涓 2 鐩稿悓銆傚彲璋冪敤瀵硅薄搴旇鎺ュ彈`renderer`瀹炰緥鐨勫崟涓弬鏁般 渚嬪锛屼互涓嬩袱涓懡浠や骇鐢熺浉鍚岀殑缁撴灉锛
......
......@@ -399,7 +399,7 @@ def pick_handler(event):
`artist`
鐢熸垚鎷惧彇浜嬩欢鐨`Artist `
鐢熸垚鎷惧彇浜嬩欢鐨`Artist`
鍙﹀锛屽儚`Line2D``PatchCollection`鐨勬煇浜涜壓鏈鍙互灏嗛檮鍔犵殑鍏冩暟鎹紙濡傜储寮曪級闄勫姞鍒版弧瓒抽夋嫨鍣ㄦ爣鍑嗙殑鏁版嵁涓紙渚嬪锛岃涓湪鎸囧畾 蔚 瀹瑰樊鍐呯殑鎵鏈夌偣锛
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
鍏堝畬鎴愭娑堟伅鐨勭紪杈戯紒
鎯宠璇勮璇 娉ㄥ唽