Show More
@@ -120,6 +120,56 b' calling :func:`display`, you can specify ``--pylab=inline`` when you start the' | |||||
120 | console, and each time you make a plot, it will show up in your document, as if |
|
120 | console, and each time you make a plot, it will show up in your document, as if | |
121 | you had called :func:`display(fig)`. |
|
121 | you had called :func:`display(fig)`. | |
122 |
|
122 | |||
|
123 | The inline backend can use either SVG or PNG figures (PNG being the default). | |||
|
124 | To switch between them, set the ``InlineBackend.figure_format`` configurable | |||
|
125 | in a config file, or via the ``%config`` magic: | |||
|
126 | ||||
|
127 | .. sourcecode:: ipython | |||
|
128 | ||||
|
129 | In [10]: %config InlineBackend.figure_format = 'svg' | |||
|
130 | ||||
|
131 | .. note:: | |||
|
132 | ||||
|
133 | Changing the inline figure format also affects calls to :func:`display` above, | |||
|
134 | even if you are not using the inline backend for all figures. | |||
|
135 | ||||
|
136 | By default, IPython closes all figures at the completion of each execution. This means you | |||
|
137 | don't have to manually close figures, which is less convenient when figures aren't attached | |||
|
138 | to windows with an obvious close button. It also means that the first matplotlib call in | |||
|
139 | each cell will always create a new figure: | |||
|
140 | ||||
|
141 | .. sourcecode:: ipython | |||
|
142 | ||||
|
143 | In [11]: plot(range(100)) | |||
|
144 | <single-line plot> | |||
|
145 | ||||
|
146 | In [12]: plot([1,3,2]) | |||
|
147 | <another single-line plot> | |||
|
148 | ||||
|
149 | ||||
|
150 | However, it does prevent the list of active figures surviving from one input cell to the | |||
|
151 | next, so if you want to continue working with a figure, you must hold on to a reference to | |||
|
152 | it: | |||
|
153 | ||||
|
154 | .. sourcecode:: ipython | |||
|
155 | ||||
|
156 | In [11]: fig = gcf() | |||
|
157 | ....: fig.plot(rand(100)) | |||
|
158 | <plot> | |||
|
159 | In [12]: fig.title('Random Title') | |||
|
160 | <redraw plot with title> | |||
|
161 | ||||
|
162 | This behavior is controlled by the :attr:`InlineBackend.close_figures` configurable, and | |||
|
163 | if you set it to False, via %config or config file, then IPython will *not* close figures, | |||
|
164 | and tools like :func:`gcf`, :func:`gca`, :func:`getfigs` will behave the same as they | |||
|
165 | do with other backends. You will, however, have to manually close figures: | |||
|
166 | ||||
|
167 | .. sourcecode:: ipython | |||
|
168 | ||||
|
169 | # close all active figures: | |||
|
170 | In [13]: [ fig.close() for fig in getfigs() ] | |||
|
171 | ||||
|
172 | ||||
123 |
|
173 | |||
124 | .. _saving: |
|
174 | .. _saving: | |
125 |
|
175 | |||
@@ -132,6 +182,22 b' will be PNG in HTML, or inlined as SVG in XHTML. PNG images have the option to' | |||||
132 | be either in an external folder, as in many browsers' "Webpage, Complete" |
|
182 | be either in an external folder, as in many browsers' "Webpage, Complete" | |
133 | option, or inlined as well, for a larger, but more portable file. |
|
183 | option, or inlined as well, for a larger, but more portable file. | |
134 |
|
184 | |||
|
185 | .. note:: | |||
|
186 | ||||
|
187 | Export to SVG+XHTML requires that you are using SVG figures, which is *not* | |||
|
188 | the default. To switch the inline figure format to use SVG during an active | |||
|
189 | session, do: | |||
|
190 | ||||
|
191 | .. sourcecode:: ipython | |||
|
192 | ||||
|
193 | In [10]: %config InlineBackend.figure_format = 'svg' | |||
|
194 | ||||
|
195 | Or, you can add the same line (c.Inline... instead of %config Inline...) to | |||
|
196 | your config files. | |||
|
197 | ||||
|
198 | This will only affect figures plotted after making this call | |||
|
199 | ||||
|
200 | ||||
135 | The widget also exposes the ability to print directly, via the default print |
|
201 | The widget also exposes the ability to print directly, via the default print | |
136 | shortcut or context menu. |
|
202 | shortcut or context menu. | |
137 |
|
203 | |||
@@ -146,6 +212,7 b' See these examples of :download:`png/html<figs/jn.html>` and' | |||||
146 | :download:`svg/xhtml <figs/jn.xhtml>` output. Note that syntax highlighting |
|
212 | :download:`svg/xhtml <figs/jn.xhtml>` output. Note that syntax highlighting | |
147 | does not survive export. This is a known issue, and is being investigated. |
|
213 | does not survive export. This is a known issue, and is being investigated. | |
148 |
|
214 | |||
|
215 | ||||
149 | Colors and Highlighting |
|
216 | Colors and Highlighting | |
150 | ======================= |
|
217 | ======================= | |
151 |
|
218 |
General Comments 0
You need to be logged in to leave comments.
Login now