将 ob-ipython 输出的图像大小加倍
Double the size of images output from ob-ipython
我在 org-mode 上使用 ob-ipython,它会自动定位来自 matpllotlib 的图像。
不过,它输出的图像很小。
搜索源码,没有找到'pic'或'img'的关键字。
https://github.com/gregsexton/ob-ipython
如何将图片大小翻倍?
这是 matplotlib 设置。
#+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
对我来说,默认值似乎是 [6,4]
。显然它是以英寸为单位测量的;还有一个 DPI 设置。它猜测我的 DPI 错误(默认为 72,根据 xdpyinfo 和标尺,我的实际 DPI 为 87),而且即使假设为 72 DPI,图像大小也不太正确,但相差不远。
顺便说一句,这是我第一次真正让 ob-ipython 工作,看起来很不错。
我在 org-mode 上使用 ob-ipython,它会自动定位来自 matpllotlib 的图像。
不过,它输出的图像很小。
搜索源码,没有找到'pic'或'img'的关键字。
https://github.com/gregsexton/ob-ipython
如何将图片大小翻倍?
这是 matplotlib 设置。
#+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
对我来说,默认值似乎是 [6,4]
。显然它是以英寸为单位测量的;还有一个 DPI 设置。它猜测我的 DPI 错误(默认为 72,根据 xdpyinfo 和标尺,我的实际 DPI 为 87),而且即使假设为 72 DPI,图像大小也不太正确,但相差不远。
顺便说一句,这是我第一次真正让 ob-ipython 工作,看起来很不错。