Rnotebook中用python画图
生活随笔
收集整理的這篇文章主要介紹了
Rnotebook中用python画图
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
- 如果notebook需要轉化為pdf, 能想到辦法是保存圖片文件,嵌入mardown語法中。
- 但是如果在html中顯示, 可以考慮下面思慮, 比較取巧。
``` {python, engine.path="/opt/anaconda3/bin/python", results='asis'}
import matplotlib matplotlib.use('Agg') import iodef m_show(p):img = io.StringIO()p.savefig(img, format='svg')img.seek(0)print("<div style='width:60px'>" + img.getvalue() + "</div>")""" Prepare your plot here ... """ from pylab import * plt.plot(np.arange(10)) # Use the custom show function instead of plt.show() m_show(plt)```
轉載于:https://www.cnblogs.com/bregman/p/6053506.html
總結
以上是生活随笔為你收集整理的Rnotebook中用python画图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 屠龙之路_战胜View对DataBase
- 下一篇: 生成对象---工厂方法模式