从ob-ipython输出的图像大小增加一倍 [英] Double the size of images output from ob-ipython

查看:136
本文介绍了从ob-ipython输出的图像大小增加一倍的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在org-mode上使用ob-ipython,它会自动定位来自matpllotlib的图像。

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

但是,它输出的图像很小。

However, the images it output is quite small.

在源代码中进行搜索,未找到 pic或 img的关键字。

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?

推荐答案

这是matplotlib设置。

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

对我来说,默认值似乎是 [6,4] 。显然,以英寸为单位;还有一个DPI设置。它猜测我的DPI错误(默认值为72,根据xdpyinfo和一个标尺,我的实际DPI为87),而且即使假设72 DPI,图像大小也不是很正确,但是距离也不算太远。

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.

顺便说一句,这是我第一次真正使用ob-ipython进行工作,看起来还不错。

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

这篇关于从ob-ipython输出的图像大小增加一倍的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆