ipython-notebook

IPython (Jupyter) MathJaX preamble

China☆狼群 提交于 2019-12-03 05:54:43
问题 Question How can I setup a MathJax "preamble" for use in IPython (or Jupyter) notebooks for repeated use in a way that is convenient for others to read my documents (on http://nbviewer.org) and that works for LaTeX/PDF generation? Background I would like to use IPython (now Jupyter) notebooks for documents that I later convert to PDF via LaTeX (using ipython nbconvert ). The problem is how to include a bunch of macro definitions that I use in almost every document. Something like: \newcommand

Plot Size - Using ggplot2 in IPython Notebook (via rmagic)

若如初见. 提交于 2019-12-03 05:01:05
问题 I have started integrating R usage into Notebook to get, from my perspective, the best of both worlds (data management in python while exploiting the comparative analytical/graphical advantages of R). Unfortunately I am hung up on a seemingly easy element, adjusting plot size for ggplot2 graphics. Adjusting plot sizes is pretty straightforward with pandas, and in a purely R environment (like RStudio), I can adjust plots with dev.new() or PNG(), etc. However, attempting to do this is Notebook

Retrieving files from remote IPython notebook server?

ぃ、小莉子 提交于 2019-12-03 05:00:35
问题 If I don't want to give out SSH access to users of my remote IPython notebook server. Is there a way to let users browse non .ipynb files and download them? 回答1: You can use FileLink and FileLinks that are built-in: from IPython.display import FileLink, FileLinks FileLinks('.') #lists all downloadable files on server The code above generates: ./ some_python_file.py some_xml_file.xml some_ipynb_file.ipynb The three items above are links that you can click to download. Click here for an example

Setting Yaxis in Matplotlib using Pandas

家住魔仙堡 提交于 2019-12-03 04:40:57
Using Pandas to plot in I-Python Notebook, I have several plots and because Matplotlib decides the Y axis it is setting them differently and we need to compare that data using the same range. I have tried several variants on: (I assume I'll need to apply the limits to each plot.. but since I can't get one working... From the Matplotlib doc it seems that I need to set ylim, but can't figure the syntax to do so. df2250.plot(); plt.ylim((100000,500000)) <<<< if I insert the ; I get int not callable and if I leave it out I get invalid syntax. anyhow, neither is right... df2260.plot() df5.plot()

Edit IPython cell in an external editor

微笑、不失礼 提交于 2019-12-03 04:13:24
It would be great to have a keyboard short-cut in IPython notebook, which would allow to edit the content of the current cell in an external editor (e.g. gvim). Maybe just copy the content of the current cell into a temporary file, launch gvim on it, and update the current cell each time the file is saved (and delete the temporary file when exiting gvim). Also, maybe update the temporary file if the cell is edited from the browser, so that gvim knows the file has changed. I am aware of projects like vim-ipython and ipython-vimception, but they don't correspond to my needs. I think the browser

How do I configure mathjax for iPython notebooks?

一笑奈何 提交于 2019-12-03 03:38:42
I'm trying to find a way for mathjax to not use STIX fonts for math in my iPython notebook. Instead, I'd much rather have it use the 'TeX' fonts. According to the documentation for Mathjax I should use: MathJax.Hub.Config({ "HTML-CSS": { preferredFont: "TeX" } }); That being said, I'm not sure where to put this. I've already tried putting this chunk of code into my custom.js file pertaining to my own ipython profile, but it doesn't work. Ideally, I'd like to make ipython profile specific adjustments for mathjax. A simple test to make sure that you're getting the configuration correct is to

“Zebra Tables” in IPython Notebook?

試著忘記壹切 提交于 2019-12-03 03:36:41
I'm building some interactive workflows in IPython using the fantastic Notebook for interactive analysis and Pandas. Some of the tables I'm displaying would be much easier to read with a little bit of formatting. I'd really like something like "zebra tables" where every other row is shaded. I read here about how this formatting can be implemented via css. Is there a really straight forward way to apply a css to an IPython Notebook and then have tables rendered using the style sheet? You can run arbitrary javascript (with jQuery) either in markdown cells inside <script> tags, or via IPython's

Keep Jupyter notebook running after closing browser tab

穿精又带淫゛_ 提交于 2019-12-03 03:05:00
问题 I use Jupyter Notebook to run a series of experiments that take some time. Certain cells take way too much time to execute so it's normal that I'd like to close the browser tab and come back later. But when I do the kernel interrupts running. I guess there is a workaround for this but I can't find it 回答1: The simplest workaround to this seems to be the built-in cell magic %%capture : %%capture output # Time-consuming code here Save, close tab, come back later. The output is now stored in the

IPython Notebook widgets for Matplotlib interactivity

怎甘沉沦 提交于 2019-12-03 02:52:43
I would like to use the ipython notebook widgets to add some degree of interactivity to inline matplotlib plots. In general the plot can be quite heavy and I want to only update a specific element of the plot. I understand that widgets have a throttling feature built-in that helps to don't flood the kernel, but when the plot takes let say 30s I don't want to wait so long just to update a line. By reading the example notebooks I was able to create a basic example in which I add a cross cursor (driven by 2 sliders) to a mpl axis. The problem is that the figure is displayed twice. Here is the

Using IPython console along side IPython notebook

拥有回忆 提交于 2019-12-03 02:42:25
问题 While working on an IPython notebook, I'm increasingly finding myself wishing that the notebook would have a console attached to it, for interactive programming. I find myself adding lines to test snippets of code and then deleting them and that's the good usage. In the worse usage I'm changing the commands in the same line, evaluating the line over and over, changing entirely the purpose of the line until I get it right, and then I'm Ctrl-Z ing all the way back to the original cell content.