ipython-notebook

prevent plot from showing in jupyter notebook

烂漫一生 提交于 2019-11-28 06:10:22
How can I prevent a specific plot to be shown in Jupyter notebook? I have several plots in a notebook but I want a subset of them to be saved to a file and not shown on the notebook as this slows considerably. A minimal working example for a Jupyter notebook is: %matplotlib inline from numpy.random import randn from matplotlib.pyplot import plot, figure a=randn(3) b=randn(3) for i in range(10): fig=figure() plot(b) fname='s%03d.png'%i fig.savefig(fname) if(i%5==0): figure() plot(a) As you can see I have two types of plots, a and b. I want a's to be plotted and shown and I don't want the b

How to include two pictures side by side in Markdown for IPython Notebook (Jupyter)?

霸气de小男生 提交于 2019-11-28 05:31:19
I am trying to insert two pictures side by side in one Markdown cell on a notebook. The way I do it was: <img src="pic/scan_concept.png" alt="Drawing" style="width: 250px;"/> in order to be able to size the included picture. Can anyone gives suggestions on top of this? Thanks, JMann's solution didn't work for me. But this one worked from IPython.display import HTML, display display(HTML("<table><tr><td><img src='img1'></td><td><img src='img2'></td></tr></table>")) I took the idea from this notebook You can create tables using pipes and dashes like this. A | B - | - ![alt](yourimg1.jpg) | ![alt

Suppress code in NBConvert? IPython

余生长醉 提交于 2019-11-28 04:45:57
I have figured out how to suppress large code blocks from showing up in final NB convert (PDF) output. By putting the LaTex command in a "raw cell before the code I don't want to have in the final output \iffalse Followed By this at the end In a raw cell \fi But That still leaves me with some ugly code when I need to show figures and the like and while the base purpose of the notebook is to show code with results, sometimes for a non tech audience we only need the output.. Any Ideas? Somewhat related if anyone is inspired.. any way to include python variables in the markdown cells so one could

How do I delete/refresh available kernels for IPython/Jupyter notebook v4.0?

别说谁变了你拦得住时间么 提交于 2019-11-28 04:39:06
I've recently stopped using macports so the kernel.json files I had for various IPython kernels are out of date. I have renamed ~/.ipython and removed ~/.jupyter but kernels launched are failing to start with file not found errors. More tellingly, when I run jupyter-kernelspec list it still lists all the old kernels I had set up. Where is it getting this information from and what do I need to do to refresh/remove its cache? After a brute force search, Jupyter stores kernel info for OS X in /Users/${USER}/Library/Jupyter/kernels . This list got copied across from my .ipython/kernels list hence

Adding custom styled paragraphs in markdown cells

删除回忆录丶 提交于 2019-11-28 04:34:13
I want to add more formatting elements than provided by the Markdown synthax in an IPython Notebook . For example, I want to add a "Warning Box" or a "Memo Box" that are basically paragraph with different styles (for example different background color, border, an icon, etc...). I guess I can add HTML code in the cell, for example a <div> with an inline style. But what is the "proper" way to do that, I mean the one that ipython developer promote? Examples appreciated. NB: I'm using the current 1.0dev version from git master. Answering to my own question... Other solutions Jim proposed to add

Python & Matplotlib: Make 3D plot interactive in Jupyter Notebook

可紊 提交于 2019-11-28 04:05:56
I use Jupyter Notebook to make analysis of datasets. There are a lot of plots in the notebook, and some of them are 3d plots. I'm wondering if it is possible to make the 3d plot interactive, so I can later play with it in more details? Maybe we can add a button on it? Clicking it can pop out a 3d plot and people can zoom, pan, rotate etc. My thougths: 1. matplotlib, %qt This does not fit my case, because I need to continue plot after the 3d plot. %qt will interfere with later plots. 2. mpld3 mpld3 is almost ideal in my case, no need to rewrite anything, compatible with matplotlib. However, it

Converting to (not from) ipython Notebook format

感情迁移 提交于 2019-11-28 02:57:19
IPython Notebook comes with nbconvert , which can export notebooks to other formats. But how do I convert text in the opposite direction? I ask because I already have materials, and a good workflow, in a different format, but I would like to take advantage of Notebook's interactive environment. A likely solution: A notebook can be created by importing a .py file, and the documentation states that when nbconvert exports a notebook as a python script, it embeds directives in comments that can be used to recreate the notebook. But the information comes with a disclaimer about the limitations of

Execute Python script within Jupyter notebook using a specific virtualenv

孤街浪徒 提交于 2019-11-28 02:51:46
I would like to execute a long running Python script from within a Jupyter notebook so that I can hack on the data structures generated mid-run. The script has many dependencies and command line arguments and is executed with a specific virtualenv. Is it possible to interactively run a Python script inside a notebook from a specified virtualenv (different to that of the Jupyter installation)? Thanks! Here's what worked for me (non conda python): (MacOS, brew version of python. if you are working with system python, you may (will) need prepend each command with sudo ) first activate virtualenv

How to pickle or store Jupyter (IPython) notebook session for later

痞子三分冷 提交于 2019-11-28 02:49:52
Let's say I am doing a larger data analysis in Jupyter/Ipython notebook with lots of time consuming computations done. Then, for some reason, I have to shut down the jupyter local server I, but I would like to return to doing the analysis later, without having to go through all the time-consuming computations again. What I would like love to do is pickle or store the whole Jupyter session (all pandas dataframes, np.arrays, variables, ...) so I can safely shut down the server knowing I can return to my session in exactly the same state as before. Is it even technically possible? Is there a

Cheat sheet for caffe / pycaffe?

时光怂恿深爱的人放手 提交于 2019-11-28 02:47:01
Does anyone know whether there is a cheat sheet for all important pycaffe commands? I was so far using caffe only via Matlab interface and terminal + bash scripts. I wanted to shift towards using ipython and work through the ipython notebook examples. However I find it hard to get an overview of all the functions that are inside the caffe module for python. (I'm also quite new to python). The pycaffe tests and this file are the main gateway to the python coding interface. First of all, you would like to choose whether to use Caffe with CPU or GPU. It is sufficient to call caffe.set_mode_cpu()