笔记本中的中心输出(绘图) [英] Center output (plots) in the notebook

查看:39
本文介绍了笔记本中的中心输出(绘图)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚升级到 IPython 1.0,新的笔记本界面表现非常好.在我的屏幕上,它现在的默认宽度约为页面的 50%,这提高了可读性.但是,我经常使用很长的时间序列,我更喜欢显示尽可能宽的时间序列.

I just upgraded to IPython 1.0 and the new notebook interface performs really well. On my screen it now has a default width of about 50% of the page which improves readability. However, i often work with long timeseries which i prefer to display as wide as possible.

非常宽的图片只会向右延伸.有没有办法将输出显示得比默认值更宽,然后以居中方式展开?

Very wide pictures will only extend further to the right. Is there a way to display output wider then the default to expand in a centered matter?

所附图片显示第一个单元格中的正常内嵌图,其宽度小于默认笔记本宽度.第二个图更宽并向右扩展.这使得我的屏幕左四分之一未使用.

The attached picture shows a normal inline plot in the first cell, which is less wide then the default notebook width. The second plot is wider and expands to the right. This leaves about the left quarter of my screen unused.

推荐答案

@tooblippe 给出的答案,虽然改变了笔记本的风格,但没有解决问题.但是,使用该解决方案的第一部分,您将能够实现图的居中.此解决方案适用于 ipython==3.1.0.对于包含 Jupyter 的更高版本,您可能需要编辑 Jupyter 的样式.

The answer given by @tooblippe, although changes the style of the notebook, does not address the question. However, using the first part of that solution, you would be able to achieve the centering of the plots. This solution works for ipython==3.1.0. For higher versions that include Jupyter, you would want to edit the styling of Jupyter instead.

所以,解决方案是:您可以修改上面的 css 文件,也可以将此行添加到 ipython 文件夹中 ipython 环境的样式中:

So, the solution would be: You can either modify the above css file or add this line to the styling of your ipython environment in the ipython folder:

    .output_png {
        display: table-cell;
        text-align: center;
        vertical-align: middle;
    }

这篇关于笔记本中的中心输出(绘图)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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