[Live-demo] ipython overview

Luca Delucchi lucadeluge at gmail.com
Wed Aug 6 02:10:43 PDT 2014


On 5 August 2014 00:06, Luca Delucchi <lucadeluge at gmail.com> wrote:

> we can create a interactive documentation, in the next days I'll add a
> simple example using GDAL
>

I have a ipython notebook example; now some questions.

For OSGeo live guru:
- where I can put the ipython examples? I thought in doc/en/ipython/
so for translator should be simplier to find and translate
- it is possible to launch "ipython notebook" directly for
documentation, maybe quickstart. otherwise we could add a menu entry
or explanation how to run it

For ipython guru:
- before submit the GDAL example I have a bug to fix, I'm not able to
see my plot if I use "%matplotlib inline", without the inline it is
working fine.
This is the relevant part of code related to matplotlib

%matplotlib inline
%config InlineBackend.figure_format = 'svg'
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure(1, figsize=(10, 4), dpi=180)
ax = fig.add_subplot(111)
ax.set_xlim(bbox[0],bbox[1])
ax.set_ylim(bbox[2],bbox[3])
ax.fill(x, y, "y")
ax.plot(x, y, "k-")
ax.axis('scaled')
fig.show()

this is the error that I obtain

/usr/lib/pymodules/python2.7/matplotlib/figure.py:371: UserWarning:
matplotlib is currently using a non-GUI backend, so cannot show the
figure
  "matplotlib is currently using a non-GUI backend, "

any idea how to fix it?

Just to complicate a little bit the situation, I also run the
following code the plot in inline mode and it is working

plt.imshow(arr, extent=extent, interpolation='nearest',
aspect='equal', cmap=plt.cm.gist_earth)
plt.colorbar()
plt.show()

-- 
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org



More information about the Osgeolive mailing list