matplotlib / matplotlib/matplotlib
Support partial usetex in ps output
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 23.2k
- 分支
- 8.5k
- 平均合併
- 1 天 6 小時
- 30 天內合併 PR
- 66
描述
I am trying to save some figures I made as .ps or .eps but I am getting an error. I narrowed the error down to the fact that I am using Latex for some of the text in my figure but using rc.params['text.usetex'] = False. Here is some code that reproduces the bug:
import matplotlib
import matplotlib.pyplot as plt
fig = plt.figure()
plt.text(0.5, 0.5, 'Here is some text, $math mode$', ha='center', va='center', usetex=True)
fig.savefig('test.ps')
The error you get is AttributeError: 'RendererPS' object has no attribute 'textcnt'
When looking at this code in in the RendererPS class the textcnt attribute is only added when rc.params['text.usetex'] = True. However I am just using Latex for specific text objects with the option usetex=True. Is there a way to save these figures as .ps or .eps?
I am using Matplotlib 1.5.1 installed via conda on Windows with python 2.7. I also tested it with Matplotlib 2.0.0b4 which also produced the same error, however I would prefer a solution for 1.5.1 if possible.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 lib/matplotlib/backends/backend_ps.py 和 RendererPS 對 textcnt 的處理開始,然後執行 issue 中將圖形儲存為 test.ps 的最小 Python 範例。確認在全域設定為 false 時使用 usetex=True 的文字物件行為;當 PS 和 EPS 輸出能夠在不出現所回報的 AttributeError 的情況下儲存時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- latex, matplotlib, python
- 領域
- backend, data-visualization
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100