Double the size of images output from ob-ipython

偶尔善良 提交于 2020-01-16 16:49:09

问题


I am using ob-ipython on org-mode, which positions the images from matpllotlib automatically.

However, the images it output is quite small.

search through the source code and did not find keywords of 'pic' or 'img'.

https://github.com/gregsexton/ob-ipython

How could double the size of images?


回答1:


This is a matplotlib setting.

#+BEGIN_SRC ipython :session :results raw drawer
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['figure.figsize'] = [12, 8]
#+END_SRC

#+BEGIN_SRC ipython :session :exports both :results raw drawer
plt.hist(np.random.randn(20000), bins=200)
#+END_SRC

For me the default seemed to be [6,4]. Apparently it's measured in inches; there's also a DPI setting. It guesses my DPI wrong (default is 72, my actual DPI is 87 according to xdpyinfo and a ruler), and also the image size isn't quite right even assuming 72 DPI, but it's not super far off.

BTW, this is the first time I've actually got ob-ipython working, seems pretty nice.



来源:https://stackoverflow.com/questions/57194625/double-the-size-of-images-output-from-ob-ipython

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!