mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-05 09:01:40 -05:00
Document changes to ob-ein. Error when no :image header specified.
ob-ein will alert the user if they are generating an image in the ob-ein source block and no :image header has been supplied. Added some documentation for good measure, though people will probably still get tripped up by this.
This commit is contained in:
parent
7e222f3ebf
commit
5c945a174f
2 changed files with 20 additions and 0 deletions
|
@ -369,6 +369,22 @@ argument. The format for the session argument is
|
|||
sys.version
|
||||
#+END_SRC
|
||||
|
||||
If your code block generates an image, like from an matplotlib plot, then
|
||||
specify the file to save the image to using the `:image` argument as in the
|
||||
example below:
|
||||
|
||||
.. code:: python
|
||||
|
||||
#BEGIN_SRC ein :session 8888/Untitled.ipynb
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
%matplotlib inline
|
||||
x = np.linspace(0, 1, 100)
|
||||
y = np.random.rand(100,1)
|
||||
plt.plot(x,y)
|
||||
#+END_SRC
|
||||
|
||||
You can also link to an IPython notebook from org-mode_ files.
|
||||
|
||||
1. Call org-mode function :el:symbol:`org-store-link`
|
||||
|
|
|
@ -66,10 +66,14 @@
|
|||
(case key
|
||||
((svg image/svg)
|
||||
(progn
|
||||
(when (null file)
|
||||
(error "Please specify an :image header argument when generating images."))
|
||||
(ein:write-base64-decoded-image value file)
|
||||
(format "[[file:%s]]" file)))
|
||||
((png image/png jpeg image/jpeg)
|
||||
(progn
|
||||
(when (null file)
|
||||
(error "Please specify an :image header argument when generating images."))
|
||||
(ein:write-base64-image value file)
|
||||
(format "[[file:%s]]" file)))
|
||||
(t (plist-get json type)))))
|
||||
|
|
Loading…
Add table
Reference in a new issue