ipython-notebook

inline images have low quality

坚强是说给别人听的谎言 提交于 2019-11-28 19:52:38
问题 I'm loading a TIF file with scikit-image and displaying it inline in an ipython notebook (version 2.2.0). This works, however, the image is quite small when first displayed, and when I resize it using the draggable handle on the bottom right of the image, it just rescales the image while retaining the resolution of the original, so it's very blurry when enlarged. It's basically as if ipython is converting my image into a thumbnail on the fly. I've tried using matplotlib's plt.imshow() as well

How to reference a IPython notebook cell in markdown?

无人久伴 提交于 2019-11-28 19:43:09
问题 How do I reference a cell in a IPython notebook markdown? I know how to make a reference to an external link. But is there a way to assign an ID to a cell and then refer to the cell in the markdown? 回答1: Yes, there's way to do just that in IPython. First, define the destination in the cell you want to link with a html anchor tag and give it an Id . For example: <a id='another_cell'></a> Note - When you run the above cell in markdown, it will become invisible. You can add some text above the

Share data between IPython Notebooks

会有一股神秘感。 提交于 2019-11-28 19:23:52
If I have several IPython notebooks running on the same server. Is there any way to share data between them? For example, importing a variable from another notebook? Thanks! This works for me : The %store command lets you pass variables between two different notebooks. data = 'this is the string I want to pass to different notebook' %store data Now, in a new notebook… %store -r data print(data) this is the string I want to pass to different notebook I've successfully tested with sklearn dataset : from sklearn import datasets dataset = datasets.load_iris() %store dataset in notebook to read

How to hide one specific cell (input or output) in IPython Notebook?

落花浮王杯 提交于 2019-11-28 18:38:52
Is there a way to selectively hide one specific input or output cell in IPython notebook? I could only find the below code to show / hide all input cells. http://blog.nextgenetics.net/?e=102 But what if I only want to hide the first input cell of a notebook? This is now built into nbconvert ( as of 5.3.0 ) using tags. Here's an example removing a specific cell from the output. Using this notebook . The example has three cells: a markdown cell, a code cell that will be hidden, and a code cell that will not be hidden. Add the remove_cell tag to any cells you want to hide using the tag editor

How to display line numbers in IPython Notebook code cell by default

大城市里の小女人 提交于 2019-11-28 18:15:48
I would like my default display for IPython notebook code cells to include line numbers. I learned from Showing line numbers in IPython/Jupyter Notebooks that I can toggle this with ctrl-M L, which is great, but manual. In order to include line numbers by default, I would need to add something to my ipython_notebook_config.py file. Unless I've missed something, there is not an explanation of how to do this in the documentation. In your custom.js file (location depends on your OS) put IPython.Cell.options_default.cm_config.lineNumbers = true; If you can't find custom.js, you can just search for

Automatically play sound in IPython notebook

这一生的挚爱 提交于 2019-11-28 18:14:26
I often run long-running cells in my IPython notebook. I'd like the notebook to automatically beep or play a sound when the cell is finished executing. Is there some way to do this in iPython notebook, or maybe some command I can put at the end of a cell that will automatically play a sound? I'm using Chrome if that makes any difference. Waylon Flinn TL;DR At the top of your notebook from IPython.display import Audio sound_file = './sound/beep.wav' sound_file should point to a file on your computer, or accessible from the internet. Then later, at the end of the long-running cell <code that

Reusing code from different IPython notebooks

喜欢而已 提交于 2019-11-28 17:46:15
I am using IPython and want to run functions from one notebook from another (without cutting and pasting them between different notebooks). Is this possible and reasonably easy to do? You can connect with a qtconsole to the same kernel. Just supply this at startup: ipython qtconsole --existing kernel-0300435c-3d07-4bb6-abda-8952e663ddb7.json Look at the output after starting the notebook for the long string. Matt Starting your notebook server with: ipython notebook --script will save the notebooks ( .ipynb ) as Python scripts ( .py ) as well, and you will be able to import them. Or have a look

How do I change the autoindent to 2 space in IPython notebook

不想你离开。 提交于 2019-11-28 17:29:53
I find that developing functions in IPython notebook allows me to work quickly. When I'm happy with the results I copy-paste to a file. The autoindent is 4 spaces, but the coding style for indentation at my company is 2 spaces. How do I change the autoindent to 2 spaces? Jakob Based on this question and the options found here : In your custom.js file (location depends on your OS) put IPython.Cell.options_default.cm_config.indentUnit = 2; On my machine the file is located in ~/.ipython/profile_default/static/custom Update: In IPython 3 the plain call does not work any more, thus it is required

Where should I place my settings and profiles for use with IPython/Jupyter 4.0?

人走茶凉 提交于 2019-11-28 17:09:51
问题 I've recently updated IPython (to 4.0) and have started using Notebooks after a period of some time not using them (since before The Big Split, I think), and have discovered that some of my settings need to be modified and moved from ~/.ipython/ to ~/.jupyter/ . For example, it appears that the NotebookManager.notebook_dir in ~/.ipython/profile_default/ipython_notebook_config.py is ignored and has had its functionality replaced by FileContentsManager.root_dir in ~/.jupyter/jupyter_notebook

How to (intermittently) skip certain cells when running IPython notebook?

筅森魡賤 提交于 2019-11-28 17:07:46
问题 I usually have to rerun (most parts of) a notebook when reopen it, in order to get access to previously defined variables and go on working. However, sometimes I'd like to skip some of the cells, which have no influence to subsequent cells (e.g., they might comprise a branch of analysis that is finished) and could take very long time to run. These cells can be scattered throughout the notebook, so that something like "Run All Below" won't help much. Is there a way to achieve this? Ideally,