[Matplotlib-users] Building 1.2.0 with Python 3.3 on Windows (MinGW)
`python3 setup.py build` fails with this error: ... running build_ext building 'matplotlib.ft2font' extension creating build\temp.win32-3.3 creating build\temp.win32-3.3\Release creating build\temp.win32-3.3\Release\src creating build\temp.win32-3.3\Release\cxx C:\MinGW\bin\gcc.exe -mdll -O -Wall -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -DPYCXX_PYTHON_2TO3=1 -Iwin32_static\include -Ic:\python33\lib\site-packages\numpy\core\include -I. -Iwin32_static\include\freetype2 -Ic:\python33\lib\site-packages\numpy\core\include\freetype2 -I.\freetype2 -Ic:\python33\include -Ic:\python33\include -c src/ft2font.cpp -o build\temp.win32-3.3\Release\src\ft2font.o In file included from src/ft2font.cpp:3:0: src/ft2font.h:16:22: fatal error: ft2build.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 It seems like it looks for freetype header file. How to supply this? Thanks -- Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812 ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Building 1.2.0 with Python 3.3 on Windows (MinGW)
Some more info I think I should have posted: BUILDING MATPLOTLIB matplotlib: 1.2.0 python: 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] platform: win32 Windows version: sys.getwindowsversion(major=5, minor=1, build=2600, platform=2, service_pack='Service Pack 3') REQUIRED DEPENDENCIES numpy: 1.7.0rc1 freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of 'win32_static\include', '.', * 'win32_static\include\freetype2', '.\freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of * 'win32_static\include', '.' Tkinter: no * Tkinter present, but header files are not found. * You may need to install development packages. Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to "import gtk" in your build/install environment Mac OS X native: no Qt: no Qt4: Qt: 4.8.4, PyQt4: 4.9.6 PySide: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES dateutil: matplotlib will provide pytz: matplotlib will provide six: matplotlib will provide OPTIONAL USETEX DEPENDENCIES dvipng: 1.12 ghostscript: 9.06 latex: MiKTeX 2.9 [Edit setup.cfg to suppress the above messages] Friday, January 11, 2013, 2:03:51 PM, you wrote: > `python3 setup.py build` fails with this error: > > ... > running build_ext > building 'matplotlib.ft2font' extension > creating build\temp.win32-3.3 > creating build\temp.win32-3.3\Release > creating build\temp.win32-3.3\Release\src > creating build\temp.win32-3.3\Release\cxx > C:\MinGW\bin\gcc.exe -mdll -O -Wall > -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 > -DPYCXX_PYTHON_2TO3=1 -Iwin32_static\include > -Ic:\python33\lib\site-packages\numpy\core\include -I. > -Iwin32_static\include\freetype2 > -Ic:\python33\lib\site-packages\numpy\core\include\freetype2 > -I.\freetype2 -Ic:\python33\include -Ic:\python33\include -c > src/ft2font.cpp -o build\temp.win32-3.3\Release\src\ft2font.o > In file included from src/ft2font.cpp:3:0: > src/ft2font.h:16:22: fatal error: ft2build.h: No such file or directory > compilation terminated. > error: command 'gcc' failed with exit status 1 > > It seems like it looks for freetype header file. > How to supply this? -- Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812 ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Building 1.2.0 with Python 3.3 on Windows (MinGW)
I found this: https://github.com/cournape/matplotlib-dependencies but what should I do with it? Should I try to compile or put it in some folder? How to instruct matplotlib to use those? site.cfg template doesn't have any entry for each of above packages. -- Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812 ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap
IMHO that's the most straightforward approach. He can use masked array for empty blocks (if contour data doesn't already contain the holes as masked array) and apply inpainting, then draw the land. For more details about inpainting: http://stackoverflow.com/a/17125125/992005 On Wed, Jan 29, 2014 at 6:22 PM, Eric Firing wrote: > On 2014/01/29 5:41 AM, A Short wrote: >> Is there any work around so it looks like the below image? > > It looks like with any reasonable contouring algorithm, this would > require interpolating into land regions, contouring, and then plotting > the land on top. The key is the interpolation, not the plotting. The > example you show might have been interpolated to a finer grid > everywhere, not just in the missing value regions. -- WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to shift colormap?
Like in Basemap examples: http://matplotlib.github.com/basemap/users/examples.html (topographic image in the middle of page) ground 0 has some yellow/orange color making seas and oceans coasts in that same, color instead light blue (as we'd all expect I guess) So how to shift this particular colormap (cm.GMT_haxby) up a bit, so that I get expected colors? -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Question about Basemap example
from http://matplotlib.github.com/basemap/users/examples.html:
from mpl_toolkits.basemap import Basemap, shiftgrid, cm
import numpy as np
import matplotlib.pyplot as plt
from netCDF4 import Dataset
# read in etopo5 topography/bathymetry.
etopodata =\
Dataset('http://ferret.pmel.noaa.gov/thredds/dodsC/data/PMEL/etopo5.nc')
topoin = etopodata.variables['ROSE'][:]
lons = etopodata.variables['ETOPO05_X'][:]
lats = etopodata.variables['ETOPO05_Y'][:]
# shift data so lons go from -180 to 180 instead of 20 to 380.
topoin,lons = shiftgrid(180.,topoin,lons,start=False)
# plot topography/bathymetry as an image.
# create the figure and axes instances.
fig = plt.figure()
ax = fig.add_axes([0.1,0.1,0.8,0.8])
# setup of basemap ('lcc' = lambert conformal conic).
# use major and minor sphere radii from WGS84 ellipsoid.
m =
Basemap(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\
rsphere=(6378137.00,6356752.3142),\
resolution='l',area_thresh=1000.,projection='lcc',\
lat_1=50.,lon_0=-107.,ax=ax)
# transform to nx x ny regularly spaced 5km native projection grid
nx = int((m.xmax-m.xmin)/5000.)+1; ny = int((m.ymax-m.ymin)/5000.)+1
topodat = m.transform_scalar(topoin,lons,lats,nx,ny)
...
Line (last but one):
nx = int((m.xmax-m.xmin)/5000.)+1; ny = int((m.ymax-m.ymin)/5000.)+1
(m.xmax-m.xmin) and (m.ymax-m.ymin) are very small compared to their
divider 5000, so nx and ny are always 1
Provided link for "etopo5.nc" is desperately slow (~20 Kb/s) so I can't
test the code, but I tried with other dataset (ETOPO2) and I can't get what
"topodat" varable should be. It's not clear to me from provided
documentation.
Thanks in advance for any help
--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Question about Basemap example
OK, soon I found out that m.xmax... are dependant on projection, and I
wasn't using Lambert projection
For default projection result are degrees and this way meters it sems
On Tue, Nov 8, 2011 at 9:13 PM, klo uo wrote:
> from http://matplotlib.github.com/basemap/users/examples.html:
>
>
> from mpl_toolkits.basemap import Basemap, shiftgrid, cm
> import numpy as np
> import matplotlib.pyplot as plt
> from netCDF4 import Dataset
>
> # read in etopo5 topography/bathymetry.
> etopodata =\
> Dataset('http://ferret.pmel.noaa.gov/thredds/dodsC/data/PMEL/etopo5.nc')
> topoin = etopodata.variables['ROSE'][:]
> lons = etopodata.variables['ETOPO05_X'][:]
> lats = etopodata.variables['ETOPO05_Y'][:]
> # shift data so lons go from -180 to 180 instead of 20 to 380.
> topoin,lons = shiftgrid(180.,topoin,lons,start=False)
>
> # plot topography/bathymetry as an image.
>
> # create the figure and axes instances.
> fig = plt.figure()
> ax = fig.add_axes([0.1,0.1,0.8,0.8])
> # setup of basemap ('lcc' = lambert conformal conic).
> # use major and minor sphere radii from WGS84 ellipsoid.
> m =
> Basemap(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\
> rsphere=(6378137.00,6356752.3142),\
>resolution='l',area_thresh=1000.,projection='lcc',\
> lat_1=50.,lon_0=-107.,ax=ax)
> # transform to nx x ny regularly spaced 5km native projection grid
> nx = int((m.xmax-m.xmin)/5000.)+1; ny = int((m.ymax-m.ymin)/5000.)+1
> topodat = m.transform_scalar(topoin,lons,lats,nx,ny)
> ...
>
>
> Line (last but one):
> nx = int((m.xmax-m.xmin)/5000.)+1; ny = int((m.ymax-m.ymin)/5000.)+1
>
> (m.xmax-m.xmin) and (m.ymax-m.ymin) are very small compared to their
> divider 5000, so nx and ny are always 1
>
> Provided link for "etopo5.nc" is desperately slow (~20 Kb/s) so I can't
> test the code, but I tried with other dataset (ETOPO2) and I can't get what
> "topodat" varable should be. It's not clear to me from provided
> documentation.
>
> Thanks in advance for any help
>
--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to shift colormap?
I learned some more about matplotlib colormaps from here:
http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps
and tried to grasp cmap creation workflow.
Here is GMT_haxby:
_GMT_haxby_data = {
'blue': [
(0.0, 0.474509805441, 0.474509805441),
(0.0322580635548, 0.588235318661, 0.588235318661),
(0.0645161271095, 0.686274528503, 0.686274528503),
(0.0967741906643, 0.784313738346, 0.784313738346),
(0.129032254219, 0.831372559071, 0.831372559071),
(0.161290317774, 0.878431379795, 0.878431379795),
(0.193548381329, 0.941176474094, 0.941176474094),
(0.225806444883, 0.972549021244, 0.972549021244),
(0.258064508438, 1.0, 1.0),
(0.290322571993, 1.0, 1.0),
(0.322580635548, 1.0, 1.0),
(0.354838699102, 0.941176474094, 0.941176474094),
(0.387096762657, 0.882352948189, 0.882352948189),
(0.419354826212, 0.784313738346, 0.784313738346),
(0.451612889767, 0.68235296011, 0.68235296011),
(0.483870953321, 0.658823549747, 0.658823549747),
(0.516129016876, 0.635294139385, 0.635294139385),
(0.548387110233, 0.552941203117, 0.552941203117),
(0.580645143986, 0.474509805441, 0.474509805441),
(0.612903237343, 0.407843142748, 0.407843142748),
(0.645161271095, 0.341176480055, 0.341176480055),
(0.677419364452, 0.270588248968, 0.270588248968),
(0.709677398205, 0.29411765933, 0.29411765933),
(0.741935491562, 0.305882364511, 0.305882364511),
(0.774193525314, 0.352941185236, 0.352941185236),
(0.806451618671, 0.486274510622, 0.486274510622),
(0.838709652424, 0.61960786581, 0.61960786581),
(0.870967745781, 0.68235296011, 0.68235296011),
(0.903225779533, 0.768627464771, 0.768627464771),
(0.93548387289, 0.843137264252, 0.843137264252),
(0.967741906643, 0.921568632126, 0.921568632126),
(1.0, 1.0, 1.0)],
'green': [
(0.0, 0.0, 0.0),
(0.0322580635548, 0.0, 0.0),
(0.0645161271095, 0.0196078438312, 0.0196078438312),
(0.0967741906643, 0.0392156876624, 0.0392156876624),
(0.129032254219, 0.0980392172933, 0.0980392172933),
(0.161290317774, 0.156862750649, 0.156862750649),
(0.193548381329, 0.4000596, 0.4000596),
(0.225806444883, 0.505882382393, 0.505882382393),
(0.258064508438, 0.686274528503, 0.686274528503),
(0.290322571993, 0.745098054409, 0.745098054409),
(0.322580635548, 0.792156875134, 0.792156875134),
(0.354838699102, 0.882352948189, 0.882352948189),
(0.387096762657, 0.921568632126, 0.921568632126),
(0.419354826212, 0.921568632126, 0.921568632126),
(0.451612889767, 0.92549020052, 0.92549020052),
(0.483870953321, 0.960784316063, 0.960784316063),
(0.516129016876, 1.0, 1.0),
(0.548387110233, 0.960784316063, 0.960784316063),
(0.580645143986, 0.92549020052, 0.92549020052),
(0.612903237343, 0.843137264252, 0.843137264252),
(0.645161271095, 0.741176486015, 0.741176486015),
(0.677419364452, 0.627451002598, 0.627451002598),
(0.709677398205, 0.458823531866, 0.458823531866),
(0.741935491562, 0.313725501299, 0.313725501299),
(0.774193525314, 0.352941185236, 0.352941185236),
(0.806451618671, 0.486274510622, 0.486274510622),
(0.838709652424, 0.61960786581, 0.61960786581),
(0.870967745781, 0.701960802078, 0.701960802078),
(0.903225779533, 0.768627464771, 0.768627464771),
(0.93548387289, 0.843137264252, 0.843137264252),
(0.967741906643, 0.921568632126, 0.921568632126),
(1.0, 1.0, 1.0)],
'red': [
(0.0, 0.0392156876624, 0.0392156876624),
(0.0322580635548, 0.156862750649, 0.156862750649),
(0.0645161271095, 0.0784313753247, 0.0784313753247),
(0.0967741906643, 0.0, 0.0),
(0.129032254219, 0.0, 0.0),
(0.161290317774, 0.0, 0.0),
(0.193548381329, 0.101960785687, 0.101960785687),
(0.225806444883, 0.0509803928435, 0.0509803928435),
(0.258064508438, 0.0980392172933, 0.0980392172933),
(0.290322571993, 0.196078434587, 0.196078434587),
(0.322580635548, 0.26680574, 0.26680574),
(0.354838699102, 0.380392163992, 0.380392163992),
(0.387096762657, 0.415686279535, 0.415686279535),
(0.419354826212, 0.486274510622, 0.486274510622),
(0.451612889767, 0.541176497936, 0.541176497936),
(0.483870953321, 0.674509823322, 0.674509823322),
(0.516129016876, 0.803921580315, 0.803921580315),
(0.548387110233, 0.874509811401, 0.874509811401),
(0.580645143986, 0.941176474094, 0.941176474094),
(0.612903237343, 0.96862745285, 0.96862745285),
(0.645161271095, 1.0, 1.0),
(0.677419364452, 1.0, 1.0),
(0.709677398205, 0.956862747669, 0.956862747669),
(0.741935491562, 0.93337307, 0.93337307),
(0.774193525314, 1.0, 1.0),
(0.806451618671, 1.0, 1.0),
(0.838709652424, 1.0, 1.0),
(0.870967745781, 0.960784316063, 0.960784316063),
(0.903225779533, 1.0, 1.0),
(0.93548387289, 1.0, 1.0),
(0.967741906643, 1.0, 1.0),
(1.0, 1.0, 1.0)]}
Now imagine tweaking this map by hand, i.e. lower 0 value (~ 2/3 from whole
cmap in example) from orange to green-blue without ruining it totally
So I want to ask this question differently: Is there some tool (Inkscape,
CorelDraw, Photoshop, ... anything) that would let me use GUI with some
sliders so that I can try adjust matplotlib colormap?
On Sun, Nov 6, 2011 at 9:58 PM, klo uo wrote:
> Like in Basemap examples:
>
Re: [Matplotlib-users] How to shift colormap?
Or are matplotlib colormaps compatible with any other programs? On Fri, Nov 11, 2011 at 4:19 PM, klo uo wrote: > > So I want to ask this question differently: Is there some tool (Inkscape, > CorelDraw, Photoshop, ... anything) that would let me use GUI with some > sliders so that I can try adjust matplotlib colormap? > -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to shift colormap?
Thanks Johann,
that is exactly what I asked for
I knew that matplotlib can do GUI tricks but I didn't felt skilled to go
there. Seeing you code it seems easy now, but it's always like that after
you see the solution :D
Cheers
On Fri, Nov 11, 2011 at 6:05 PM, johanngoetz wrote:
>
> I have this script that uses the matplotlib Slider object to control the
> colormap of a histogram. This could be very close to what you want. Here is
> the script:
>
> ### begin colormap_slider.py #
> import math, copy
> import numpy
> from matplotlib import pyplot, colors, cm
> from matplotlib.widgets import Slider
>
> def cmap_powerlaw_adjust(cmap, a):
>'''
>returns a new colormap based on the one given
>but adjusted via power-law:
>
>newcmap = oldcmap**a
>'''
>if a < 0.:
>return cmap
>cdict = copy.copy(cmap._segmentdata)
>fn = lambda x : (x[0]**a, x[1], x[2])
>for key in ('red','green','blue'):
>cdict[key] = map(fn, cdict[key])
>cdict[key].sort()
>assert (cdict[key][0]<0 or cdict[key][-1]>1), \
>"Resulting indices extend out of the [0, 1] segment."
>return colors.LinearSegmentedColormap('colormap',cdict,1024)
>
> def cmap_center_adjust(cmap, center_ratio):
>'''
>returns a new colormap based on the one given
>but adjusted so that the old center point higher
>(>0.5) or lower (<0.5)
>'''
>if not (0. < center_ratio) & (center_ratio < 1.):
>return cmap
>a = math.log(center_ratio) / math.log(0.5)
>return cmap_powerlaw_adjust(cmap, a)
>
> def cmap_center_point_adjust(cmap, range, center):
>'''
>converts center to a ratio between 0 and 1 of the
>range given and calls cmap_center_adjust(). returns
>a new adjusted colormap accordingly
>'''
>if not ((range[0] < center) and (center < range[1])):
>return cmap
>return cmap_center_adjust(cmap,
>abs(center - range[0]) / abs(range[1] - range[0]))
>
>
> if __name__ == '__main__':
>### create some 2D histogram-type data
>def func3(x,y):
>return (1- x/2 + x**5 + y**3)*numpy.exp(-x**2-y**2)
>x = numpy.linspace(-3.0, 3.0, 60)
>y = numpy.linspace(-3.0, 3.0, 60)
>X,Y = numpy.meshgrid(x, y)
>Z = func3(X, Y)
>extent = [x[0],x[-1],y[0],y[-1]]
>
>
>plotkwargs = {
>'extent' : extent,
>'origin' : 'lower',
>'interpolation' : 'nearest',
>'aspect' : 'auto'}
>
>### interactively adjustable with a slider
>fig = pyplot.figure(figsize=(6,4))
>fig.subplots_adjust(top=0.8)
>ax = fig.add_subplot(1,1,1)
>cmap = cm.seismic
>plt = ax.imshow(Z, cmap=cmap, **plotkwargs)
>cb = fig.colorbar(plt, ax=ax)
>
>axcmap = fig.add_axes([0.1, 0.85, 0.8, 0.05], axisbg='white')
>scmap = Slider(axcmap, '', 0.0, 1.0, valinit=0.5)
>
>def update(val):
>cmapcenter = scmap.val
>plt.set_cmap(cmap_center_adjust(cmap, cmapcenter))
>scmap.on_changed(update)
>
>
>
>pyplot.show()
> ### end colormap_slider.py ###
> --
> View this message in context:
> http://old.nabble.com/How-to-shift-colormap--tp32792283p32827012.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
>
> --
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MODIS data and true-color plotting
I think that paths needed to be passed to CPP/LDFLAGS like this: CPPFLAGS=-I/usr/include/hdf LDFLAGS=-L/usr/lib ./configure --enable-hdf4 && make then also package is dependent on latest hdf5 to be build (1.8.7), so installing it globally would break possible dependencies in any packaging system, and lastly it's just pain to build it if it's worth On Sun, Nov 13, 2011 at 10:12 PM, Gökhan Sever wrote: > When I remove hdf4 part from config, it builds successfully. Any ideas? -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] pcolor - color values argument
Quote: matplotlib.pyplot.pcolor(*args, **kwargs) Create a pseudocolor plot of a 2-D array. C is the array of color values. I tried to see how can I map custom color values to example array, but seems hard to understand. I created 2x2 mesh, and appropriate C array for it. Changing values in this C array changes colors on plotted mesh in what it seems irregular way. Does C array map colors from default colormap? If yes, in which way they are plotted according values in this C array? Or how can I tell matplotlib to use "this" RGB value for "this" cell in a mesh, then another RGB value for other cell and so on Thanks -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Visualizing data for scientists and engineers
It's same problem for which I asked assistance here: http://www.mail-archive.com/[email protected]/msg22520.html There, Johann provided nifty script with slider, with which help user can shift colormap and get more "meaningful" image Also speaking about great Basemap package, only shifting colormap can be of no use for different regions, as one region could have elevation from 200m to 3000m for example, while other -2000m to 4000m, making two region images incomparable. This is where "set_clim" function can help - if we make, let's nice hypsometric colormap from -13000 to 9000m we can use this function to plot region images with same visual information. Some new "hypsometric" colormaps in Basemap package could find usage On Wed, Nov 16, 2011 at 4:32 AM, Ben Root wrote: > I just came across this paper in my twitter feed. Thought it might be > relevant to this community. > > https://www.research.ibm.com/people/l/lloydt/color/color.HTM > > Cheers! > Ben Root > > -- > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Today's XKCD
I first opened GMail instead Google Reader and you show it to me first :D I don't know half of those projection but I guess I would choose Plate Cartee :D Cheers On Mon, Nov 14, 2011 at 3:28 PM, Michael Droettboom wrote: > Sorry for the slightly OT post, but I thought all of the basemap-using > geoprojection heads on this list would get a kick out of today's XKCD: > > http://xkcd.com/977/ > > Mike > > -- > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] UserWarning: Module dateutil was already imported
>>> from mpl_toolkits.basemap import Basemap
/usr/local/lib/python2.7/dist-packages/mpl_toolkits/__init__.py:2:
UserWarning: Module dateutil was already imported from
/usr/local/lib/python2.7/dist-packages/dateutil/__init__.pyc, but
/usr/lib/pymodules/python2.7 is being added to sys.path
__import__('pkg_resources').declare_namespace(__name__)
I always get this warning, and IIRC when importing some MPL module possibly
too
I removed MPL 1.0.1 and upgraded to 1.1.0 but nothing changed in regard to
this warning
Also Google did not reveal much - it's listed on IPython mailing list, and
also in "pyroms" forum again when someone tried to import Basemap package.
So why is this and what can I do to avoid this warning when I import Basemap
Thanks
--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Exception in Tkinter callback
Matplotlib 1.1.0 on Ubuntu 11.04
If MPL backand is set to TkAgg, drawing window dialog appears without plot
content, and then after closing it, this error is thrown:
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
return self.func(*args)
File
"/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py",
line 236, in resize
self.show()
File
"/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py",
line 240, in draw
tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
File
"/usr/local/lib/python2.7/dist-packages/matplotlib/backends/tkagg.py", line
19, in blit
tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode,
id(bbox_array))
TclError
Is this known, or maybe something is wrong at my side?
--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to tell savefig() image size in pixels
I browsed Google, and found mainly outdated code examples (also on scipy cookbook) then some 2008 posts on StackOverflow where at least I find some trace that matplotlib.figure.Figure has some instruments to change output image size, but it's in combination from inches and dpi set. However I just couldn't find how to tell my plt graph to use this matplotlib.figure.Figure settings, and ended editing matplotlibrc file and changing inches and DPI there Shouldn't be there some easier setting to set image size for savefig() output? -- RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Why are bars, errorbars... clipped
Assuming IPython in pylab mode: a = [0.1, 0.2, 0.1] errorbar(arange(3), a, yerr=a-sum(a)/len(a), fmt='ro') Result MPL output clips limit values in two different ways: 1. If GTK backend is used both left and right sides are clipped 2. If IPyhton inline mode is used, only right side is clipped I don't see any obvious argument in bar(), errorbar() doc strings, that would let me define X range, although I would expect MPL to take care of this by default, based on data entered. What is the easiest way I can correct this? I attached images for both cases: 1. GTK: [image: Inline image 2] 2. Inline: [image: Inline image 1] <><>-- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Why are bars, errorbars... clipped
On Sun, Mar 18, 2012 at 1:07 PM, Angus McMorland wrote: > > > The xlim command can be used to set the x limits. For example: > > xlim(-.5, 2.5) > > will prevent the points lying on the axis boundaries for your case. > > Thanks Angus, that worked with ease for separate MPL window, but not inline in IPython. I guess there is no setting, that will allow setting MPL to automatically adjust default plot window - add padding if bars (which can also be lines or points as in example) are drawn on axes; trim window if if there is no data to plot instead trimming based on grid range; and similar intuitive expectation -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Why are bars, errorbars... clipped
On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland wrote: > > For inline ipython, you want to switch to the object-oriented use of > pylab. Something like this should work with xlim. > > a = [0.1, 0.2, 0.1] > fig = plt.figure() > ax = fig.add_subplot(111) > ax.errorbar(arange(3), a, yerr=a-sum(a)/len(a), fmt='ro') > ax.set_xlim(-.5,2.5) > ax.show() > > I'm not aware of automatic settings for padding, but with this > set_xlim, it's easy enough to roll your own using the data limits. > > OK, thanks It's not very elegant (assuming pylab freedom) but I take it as only way to correct clipping example (or differently put - to use custom range for axis) -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Why are bars, errorbars... clipped
After parsing matplotlibrc, I browsed module where errorbars are defined (axes.py) and tried changing various variables without success. In bar() function (line 4628) there is "adjust_xlim = False" line which calls line 4768 if set True. So I set it True, to find it's buggy if x starts from 0 (most common start value). I didn't tried to copy this code block in errorbars because of that I browsed then axis.py and then - transforms.py - total mess. Retreat. Didn't even figured out why IPython inline mode pads left side x range in above example. Seems like IPython/core/pylabtools.py just calls "canvas.print_figure(pic-data)" and passes image in qt terminal, but I can't reproduce same range if not in inline mode. Idea was to learn how IPython inline mode sets one part of this range correctly, then use it to make what I wanted So, I guess wrapping some function that would calculate smart view range, like Tony replied, is the way to go Thanks Tony -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Export 3D plot to 3D file format
Does someone maybe knows of a project that allows exporting MPL 3D plot (mpl_toolkits.mplot3d.Axes3D) to 3D file format, like OBJ, 3DS, BLEND ... any kind? -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Export 3D plot to 3D file format
Ah mayavi... I find it complicated for building, and in Ubuntu repository (or launchpad) there is some old version I'll try later today to build it Thanks for your suggestion, Cheers On Tue, Mar 27, 2012 at 11:25 PM, Frédéric Vogt wrote: > Is the savefig function what you're looking for ? > > http://github.enthought.com/mayavi/mayavi/auto/mlab_figure.html > > Note that as far as I know, the .mtl file associated with a given .obj > file is not handled properly - all your colors will be white. Personally, I > export in .vrml which suits my needs better, as it does handle colors in a > satisfactory way. > > -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Export 3D plot to 3D file format
On Thu, Apr 5, 2012 at 3:53 AM, Benjamin Root wrote: > > With the way matplotlib is designed and structured, it may be a while > before that would be possible. It wouldn't be impossible, mind you, but I > just haven't thought about that. Could you file a wishlist item on > Github? Maybe I could steal some code from Mayavi for this idea... > > In the meantime, Mayavi would be your best bet, though. > Yes, Mayavi seem very nice for 3D and also runs very smooth I would expect that exporting is available by underlying VTK, but don't know I opened issue anyway, as suggested: https://github.com/matplotlib/matplotlib/issues/816 Cheers -- For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Possible to change MPL color scheme?
Hi, I read previous mail about "colormaps" which reminded me to a question I had about MPL colors. Colors in MPL plots are dark, and pale, and not is some specific color theme but it's just pale dark. I thought that usually people make plots brighter (as more attractive ;) ) If you can, have a look at this plot I just made, and same image with same named colors as set by CorelDraw for example: http://i.imgur.com/y29xD.png As you all probably know cyan is not cyan but teal, and green is with 50% green, and every color is not as expected, except red and blue. I don't know much about color systems and color space, so thought to ask why is it like this and if colors can be somehow differently defined at user end? -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Fwd: Possible to change MPL color scheme?
On Sat, Jul 21, 2012 at 7:37 PM, Felix Patzelt wrote: > Have you ever been in a talk where someone uses 100% green on a slide? The > result is usually that no one can see what is shown unless it is a really > large green area. No, but I would have expected in that case appropriate bg. I've seen a talk by MPL developer that he dislikes systems that help too much, like I want it to do what I tell it to do ;) Like cyan is not teal, and yellow is not 75% yellow etc. I really would have expected that MPL uses some nifty CMYK scheme (as in CorelDraw approxiamtion i.e.) instead the one usually defined as in html color names: http://www.w3schools.com/html/html_colornames.asp which are commonly used (gnuplot i.e.), but MPL doesn't even use that Can this colors be defined (i.e. in matplotlibrc) w/o changing MPL source? > My guess is that this happens because rod cells which are the most light > sensitive ones have very similar wavelength responsiveness to the cone cells > (the ones for color vision) which react to green light. Hence, you just don't > have as much contrast for green text on a white background as you have for > example for blue text. Also, green on black is much easier to read than blue > or red on black by the same argument. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fwd: Possible to change MPL color scheme?
Ah all right, thanks for the tips :) I somehow missed that setting while browsing matplotlibrc Cheers On Sat, Jul 21, 2012 at 9:33 PM, Felix Patzelt wrote: > You want this? > > > > import matplotlib as mpl > mpl.rcParams['axes.color_cycle'] = ['#FF', '#00FF00', '#FF', > '#00', 'FF00FF', '00', '00'] > > # test it > from pylab import * > import matplotlib.cm as cm > > x = linspace(0, 2*pi, num=100, endpoint=True) > > for i in range(1, 10): > plot(x, sin(x + pi*i/10.0)) > > show() > > > > I still think, that this is not a sensible default choice. Btw you can also > easily generate your color scheme from colormaps: > > mpl.rcParams['axes.color_cycle'] = [cm.winter(i/10.) for i in range(10)]. > > There also was an example in the Mailing list for how to do this on a > per-plot-basis: https://gist.github.com/3150091 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Possible to change MPL color scheme?
Thanks for your reply Ben, On Sun, Jul 22, 2012 at 4:39 PM, Benjamin Root wrote: > As for the assertion that HTML colors aren't used, that is incorrect. The > named colors follow the HTML list. Here is our list: > > https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/colors.py#L62 > > and here is the html list: > > http://html-color-codes.info/color-names/ sure that's correct, I just meant about default defined colors with abbrev color names, like 'y' (#BFBF00) in not 'yellow' (#00) etc. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Background basemaps in Basemap
I wanted to overlay some plot over map, and thought to use one of provided background maps that come with Basemap Result isn't that great as expected: loading bluemarble map took 1GB memory, and zooming i.e. Europe region on 1920x1080 screen is too blurred w/o details. As a consequence, using custom basemap with even greater resolution is out of consideration OTOH whatever I do in Google Earth, memory never exceeds 200MB and it's even lower with ArcGIS Explorer with any basemap on it. Maybe it's because these packages use advanced tilling features maybe it's else, but isn't there something that can be done with Basemap package so that topological maps can be useful with it? Like using some GIS webservice or similar? -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
On Sat, Aug 25, 2012 at 1:26 AM, Jeff Whitaker wrote:
>
> Oh sure, it's simple!
>
> http://www.google.com/patents?id=J4YOEBAJ&dq=6618053
Hi Jeff,
thanks for your reply.
I was hoping to get response if there are ideas how this unfortunate
performance can be avoided. If there are some thoughts or if it's
closed case.
About GIS web-services, I thought maybe extending Basemap and
providing interface to some of available online mapping services.
For example arcgis is just one of them, and allows using their online
map service to arbitrary application, while exposing REST
(http://resources.arcgis.com/en/help/rest/apiref/index.html?mapserver.html)
and SOAP service with full WSDL description
(http://services.arcgisonline.com/ArcGIS/services/World_Imagery/MapServer?wsdl)
and documentation. REST requests cover all of their services while
SOAP is limited and a bit harder to code in this example. Services
offer much more than it's needed to be paired in Basemap, as can be
seen from documentation, with any imaginable projection and what not.
As an example of using the service here is image: http://i.imgur.com/RpUFv.png
and here is it's simple source code that executes unnoticeable in second:
import matplotlib.pyplot as plt
import urllib2
lon1 = -10; lon2 = 30; lat1 = 30; lat2 = 60
basemap_url =
"http://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer/export?bbox=%d,%d,%d,%d&bboxSR=4326&size=1024,768&dpi=128&format=png32&f=image";
% (lon1, lat1, lon2, lat2)
overlay_url =
"https://ogcie.iblsoft.com/sigwx?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=ASXX&WIDTH=1024&HEIGHT=768&CRS=EPSG:4326&BBOX=%d,%d,%d,%d&TRANSPARENT=TRUE&STYLES=&FORMAT=image/png";
% (lon1, lat1, lon2, lat2)
plt.figure(figsize=(8, 6), dpi=128, facecolor='w')
plt.imshow(plt.imread(urllib2.urlopen(basemap_url)))
plt.imshow(plt.imread(urllib2.urlopen(overlay_url)))
plt.gca().axison = False
plt.savefig("scene.png", dpi=128, transparent=True)
As both "basemap map" and overlay image use same CRS, this seems
doable with just MPL.
Having such service paired in Basemap as a feature looks very
promising to me. I don't know much about MPL and Basemap design, as if
all above talk is easy and then acceptable for implementation, but
that's roughly what I had in mind for web-services - as additional
feature for replacing bloated background maps provided, which does not
have such quality to justify low performance.
Cheers
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
On Sat, Aug 25, 2012 at 3:24 PM, Jeff Whitaker wrote: > It looks like you are fetching an image over a specified region and > displaying it with matplotlib. That's very useful, but it doesn't solve > the zooming problem you mentioned. Still, it's a good start and would > be nice to have in basemap. Yes, I was thinking about fetching image resource only. I should have probably fetched more detailed and smaller region that would demonstrate superiority over Basemap bitmaps quality and performance, as I mentioned zooming problem in a context of very high memory usage while provided image is with low detail compared to what's potentially possible. > Sorry for sounding so dismissive in my earlier reply. How do you think > web map services could be integrated into Basemap? Do you see this > mainly as a faster and more general alternative to the 'bluemarble' or > 'warpimage' methods, where you can specify a web map service and have > the appropriate tile that fits the map projection region fetched and > displayed automatically? Exactly - as function to Basemap class that could be called as bluemarble() or shadedrelief() etc. on previously defined projection. Export Map (http://atlas.resources.ca.gov/arcgis/SDK/REST/export.html) seems like only function needed, but more knowledge about Basemap is needed, as my main problem with it is fitting projections right. I tried to overlay arcgis map over some Basemap projections like: m=Basemap(...) m.imshow(arcgis_map) m.drawcoastlines() But it never fits, and also aspect ratio should be considered. And same scheme for potentially other mapping webservices, as functions to Basemap class... Also for reference here are maps available to arcgis service: http://server.arcgisonline.com/ArcGIS/rest/services -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
On Sat, Aug 25, 2012 at 5:57 PM, Jeff Whitaker wrote: > > tilecache.org looks relevant too. > This is like more advanced, on a higher level. I imagine if you plan to add some interaction to Basemap, it would be fantastic, to say at least. While reading Google patent you linked the other day, I came also to this link: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection It was mentioned as a advanced feature to some server providing WMS capabilities Also, already mentioned GIS webservices IMHO provide interface to their caching/tiling mechanisms, but if there is backend to hold this feature in MPL/Basemap I have no idea. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
On Sat, Aug 25, 2012 at 5:50 PM, Jeff Whitaker wrote: > > Maybe such a thing could be built using owslib? > > http://geopython.github.com/OWSLib/ This is interesting. I didn't know about this module Using either simple REST (urllib) to access webservices or depend on additional module which exposes all kinds of services capabilities, that are not just basemaps, but services which are used to interface many public data through XML communication, that are potentially attractive to Basemap users IMHO It is kind of a dilemma ;) -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
> Export Map (http://atlas.resources.ca.gov/arcgis/SDK/REST/export.html) > seems like only function needed, but more knowledge about Basemap is > needed, as my main problem with it is fitting projections right. I > tried to overlay arcgis map over some Basemap projections like: > > m=Basemap(...) > m.imshow(arcgis_map) > m.drawcoastlines() > > But it never fits, and also aspect ratio should be considered. Success! :) It was that "imageSR" had to be set, as it doesn't seem to be deduced from the map: basemap_url = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer/export?\ bbox=%d,%d,%d,%d&\ bboxSR=4326&\ imageSR=4326&\ size=800,600&\ dpi=128&\ format=png32&\ f=image" % (lon1, lat1, lon2, lat2) \ Result with coastlines overlay attached! Jeff, I think it is easy to make this function to Basemap class, but I'm not confident doing it. If you can make it, I'll then try to use it as template and pair it to other available webservices Cheers -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
>> Result with coastlines overlay attached! > > Here is attachment Hm, image needs to be approved by moderator... Here is a link to it: http://i.imgur.com/1ZMoU.png -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
Well it seems ArcGIS web-services can't be bitten in public place. Google and Bing static maps have many limitations: - require account for providing key - draw logos on image - limited size: Bing basic account can return max 900x834 and Google 1280x1280 (while ArcGIS 2048x2048) - Google static maps has max 25K requests per day per application and not per IP - Bing static map doesn't return requested exact coordinates, and I can't see parameter that can define returned image SR (haven't checked Google) I'll have a look tomorrow at Nokia (img size limit 2048x2048), but considering OWSLib and providing arcgis webservice function to Basemap class seems fine. Also just reusing some of OWSLib solution for map services doesn't seem like bad idea - nothing is required except Python builtin XML parsing -- http://msdn.microsoft.com/en-us/library/ff701724.aspx https://developers.google.com/maps/documentation/staticmaps http://api.maps.nokia.com/en/restmaps/api.html -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
On Sun, Aug 26, 2012 at 12:18 AM, Jeff Whitaker wrote: > Klo: The image in interpolated to the Basemap projection region. This is > slow - the main reason to use the WMS is to avoid this by having it done on > the server side. All right, that's the right way anyway > The trick is to figure out what the EPSG projection code is based on the > Basemap projection info, and pass that information to the WMS server so it > can do the interpolation. Yes, and also to pass right `size` parameter as aspect ratio needs to be correct Do you want me to try to pair both projections (Basemap name and WKID and WKT as they call it)? > Here's an example for south polar stereographic: > > width = 12000.e3 > plt.figure() > basemap_url =\ > "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export?\ > bbox=%d,%d,%d,%d&\ > bboxSR=3412&\ > imageSR=3412&\ > size=800,800&\ > dpi=128&\ > format=png32&\ > f=image" % (-width/2,-width/2,width/2,width/2) > m =\ > Basemap(projection='stere',resolution='i',lon_0=0,lat_0=-90,lat_ts=-70,\ > width=width,height=width,rsphere=(6378273,6356889.449)) > m.imshow(plt.imread(urllib2.urlopen(basemap_url)),origin='upper') > m.drawmeridians(np.arange(-180,180,30),labels=[0,0,0,1],color='y') > m.drawparallels(np.arange(-80,-0,10),labels=[1,0,0,0],color='y') > m.drawcoastlines() > plt.show() > Looks beautifully :) As said later today I'll look at Nokia maps and then will try to look for WMS servers. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
> As said later today I'll look at Nokia maps and then will try to look > for WMS servers. Nokia map services are OK, and can be used even without applying for free account, but they brand every map with their logo even for professional licence. REST services (http://api.maps.nokia.com/en/restmaps/overview.html) are very limited, in one projection and mapped according central point instead bounding box. They offer (http://api.maps.nokia.com/en/index.html) other approaches like JS, JAVA, HTML5 and perhaps some more advanced service can be deduced from there in Python, but it's not worth perhaps. BTW I checked one WMS server (http://wms.jpl.nasa.gov/wms.cgi?request=GetCapabilities). It has tiling service (GetTileService) and mapping service (GetMap) but only in standard projection EPSG:4326 Here are maps provided: 1 - WMS Global Mosaic, pan sharpened 2 - WMS Global Mosaic, not pan sharpened 3 - CONUS mosaic of 1990 MRLC dataset 4 - SRTM reflectance magnitude, 30m 5 - Current global view of the earth, morning 6 - Current global view of the earth in the afternoon 7 - Blue Marble Next Generation, Global MODIS derived image 8 - Blue Marble, Global MODIS derived image 9 - SRTM derived global elevation, 3 arc-second, hue mapped 10 - Global 1km elevation, seamless SRTM land elevation and ocean depth 11 - SRTM derived global elevation, 3 arc-second 12 - United States elevation, 30m 13 - Digital Elevation Map of the United States, DTED dataset, 3 second resolution, grayscale 14 - Digital Elevation Map of the United States, DTED dataset, 3 second resolution, hue mapped 15 - ASTER DEM, tiled only, 1.5 arc-second per pixel Only first two offer international locations (from Landsat) -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
On Sun, Aug 26, 2012 at 9:56 PM, Jeff Whitaker wrote: > Klo: Since epsg codes comprise a very small subset of possible Basemap > projections, it may be better to just allow Basemap to accept an epsg kwarg. > That keyword would be required in order to use a WMS to display a map > background. This may be tricky though, since Basemap needs more information > to define a map projection region than is provided by the epsg code. We may > have to start with just a few supported epsg codes and then add more as > necessary. > > I added a testwms.py example to my fork > (https://github.com/jswhit/basemap.git) that shows how to use three > different map projections (epsg codes). I'm not sure if I understand projection problem, as arcgis webservice provides thousands of projections, but then you know better. I thought that the code will be just one function which would accept Map name, then coordinates and projection code will be deduced from Basemap function initiation? Here is same server from agency where you work according your signature: maps.ngdc.noaa.gov/rest/services it provides additional maps on same server as arcgis I also checked many WMS servers, first with XML editor but then with Gaia, which was excellent help in determining that many WMS servers just return their capabilities, but does not provide service as described in capabilities response. Some offer tilling features, for possible future interactive zooming in Basemap ;) Here is one http://maps.dwd.de/geoserver/wms?request=GetCapabilities&service=WMS&version=1.1.1 which offers bluemarble in many projection. Additionally it offers some German datasets, but does not offer tilling service. Perhaps we could look just for servers with get map service but also tilling support and support for various projections. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
On Mon, Aug 27, 2012 at 2:34 PM, Jeff Whitaker wrote: > Klo: WMS servers use EPSG codes to define map projections - Basemap uses a > set of kwargs. We need some way of inferring epsg codes from the Basemap > kwargs. Alternatively, we could extend Basemap so it can accept EPSG codes. > But, there are many EPSG codes that don't correspond to allowable Basemap > projections, and valid Basemap projections that don't correspond to EPSG > codes. It's not obvious to me how to proceed. >> >> Here is same server from agency where you work according your >> signature: maps.ngdc.noaa.gov/rest/services it provides additional >> maps on same server as arcgis >> >> I also checked many WMS servers, first with XML editor but then with >> Gaia, which was excellent help in determining that many WMS servers >> just return their capabilities, but does not provide service as >> described in capabilities response. Some offer tilling features, for >> possible future interactive zooming in Basemap ;) > > > Maybe it's better not have the function accept a OWSLib wms object - that > way we don't have to tie ourselves to a particular WMS server. Thanks for explaining Jeff, but aren't we using arcgis REST service which accepts more then 4500 projections? Are you saying Basemap offers projection that's not listed here: http://atlas.resources.ca.gov/arcgis/SDK/REST/gcs.html EPSG codes may be important to WMS. And providing WMS feature is maybe question how. Any GIS tool has WMS service support. Some WMS servers provide tiling capabilities and that also can be considered for future feature of fast zooming in Basemap. Most of them seem to offer just EPSG:4326 and there are servers with many projections (not as many as arcgis REST service) But at this point of static map servers we can just use urllib module and do requested WMS function which will return the map without using any additional function or package I'm validating public WMS servers and these days I'll report again. As mentioned many simply aren't working, many are localized, etc. Hope will find nice usage for some selected -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
On Mon, Aug 27, 2012 at 9:32 PM, Jeff Whitaker wrote: > > Klo: Yes. And vice versa, some of those 4500 projections aren't supported > by Basemap. > > Anyway, I went ahead and created a prototype 'wmsmap' method. You can try it > by cloning my fork (https://github.com/jswhit/basemap) and running > examples/testwms.py. I created an extra kward 'epsg' for creating Basemap > instances. To use the wmsmap function, you have to use that keyword. Give > it a try and let me know what you think. Jeff it looks great, everything is parametrized including server name and map name, so it should work for any additional service. However on Windows with Python 2.7 and Basemap 1.0.5 I get an error while trying to run the script: Traceback (most recent call last): File "testwms.py", line 39, in m=Basemap2(epsg=epsg,resolution='h',width=width,height=height) TypeError: __init__() got an unexpected keyword argument 'epsg' I than added initial empty "epsg" arg to original Basemap class declaration, but then after some time processing I get: warning: width and height keywords ignored for Cylindrical Equidistant projectionEPSG: Traceback (most recent call last): File "testwms.py", line 47, in m.drawparallels(np.arange(0,80,1),labels=[1,0,0,0]) File "testwms.py", line 15, in wmsmap if not hasattr(self,'epsg'): AttributeError: 'Basemap2' object has no attribute 'epsg' So I leave it for now and assume it's some tiny issue not obvious at this time to me. I'll continue WMS search, but yesterday I spent couple of hours just to look at those beautiful maps provided on arcgis server. I explored on all and it's so nicely done and with high resolution zoom. They are annotated though, but again, see i.e. Ocean Basemap, or overlay with transparency over some more colored topo map like GEBCO_08 from maps.ngdc.noaa.gov server - just great. World Topo also... -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
>> Jeff it looks great, everything is parametrized including server name >> and map name, so it should work for any additional service. >> However on Windows with Python 2.7 and Basemap 1.0.5 I get an error >> while trying to run the script: > > > Klo: Just added a pull request for this > > https://github.com/matplotlib/basemap/pull/73 > > Regarding your windows error - you have to rebuild basemap to get the needed > updates (it's not just a matter of running the testwms.py script). Thanks will do that right now. I was just investigating possibility of returning clear map without annotations where it is possible. For example World_Topo_Map (http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer) has additional layers and according layers parameter in export function (http://atlas.resources.ca.gov/arcgis/SDK/REST/export.html): Description: Determines which layers appear on the exported map. There are four ways to specify which layers are shown: show: Only the layers specified in this list will be exported. hide: All layers except those specified in this list will be exported. include: In addition to the layers exported by default, the layers specified in this list will be exported. exclude: The layers exported by default excluding those specified in this list will be exported. Syntax: [show | hide | include | exclude]:layerId1,layerId2 where layerId1, layerId2are the layer ids returned by the map service resource Example: layers=show:2,4,7 if we add additional parameter "&layers=hide:5,6,7,8,9" I expected annotations to be gone, but unfortunately not there yet Will look further if it's somehow possible to clear annotations. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
Jeff, I just thought to mention this: function name "wmsmap" maybe should be changed to "restmap" as for WMS servers will need to do another template. Here is example urllib call for sample WMS function GetMap: basemap_url = "\ http://geonetwork3.fao.org/ows/14097?\ request=GetMap&\ service=WMS&\ version=1.1.1&\ layers=country_bnd&\ format=image/svg%2Bxml&\ bgcolor=0xFF&\ transparent=TRUE&\ srs=EPSG:4326&\ bbox=-180,-137.464503042596,180,137.464503042596&\ width=986&\ height=753\ " -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Building Basemap on Windows
So I forked then cloned huge Basemap repository with idea to test latest code README file says it needs geos library, which README suggest: nmake /f makefile.vc MSVC_VER=1500 However, error is inevitable almost always and this time Google suggests that MS does not support C-99 (can't find inttypes.h). Easiest solution is to copy these: https://code.google.com/p/msinttypes include files in affected include folder and change line `#include ` in platform.h to `#include "inttypes.h"` so it picks it up from current folder That was it, geos compiled and products ended in src subfolder relative to geos folder: inlines.obj geos.lib geos_i.exp geos_i.lib geos.dll.manifest geos.pdb geos.ilk geos.dll geos_c_i.exp geos_c_i.lib geos_c.dll.manifest geos_c.pdb geos_c.ilk geos_c.dll Now, Basemap setup has *nix scenario for GEOS_DIR so I changed setup.py to: geos_include_dirs=["C:\\Temp\\basemap\\GEOS-3~1.3\\capi","C:\\Temp\\basemap\\GEOS-3~1.3\\include",numpy.get_include()] geos_library_dirs=["C:\\Temp\\basemap\\GEOS-3~1.3\\src"] after I learned that `python setup.py build" fails if Basemap source is in path with spaces Still no luck, and thought to ask for kind help: C:\Temp\basemap>python setup.py build Found executable c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe Found executable c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe Found executable c:\Program Files\Microsoft SDKs\Windows\v7.0\bin\mt.exe executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\alaska < datumgrid\alaska.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\conus < datumgrid\conus.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\FL < datumgrid\FL.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\hawaii < datumgrid\hawaii.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\MD < datumgrid\MD.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\null < datumgrid\null.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\prvi < datumgrid\prvi.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\stgeorge < datumgrid\stgeorge.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\stlrnc < datumgrid\stlrnc.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\stpaul < datumgrid\stpaul.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\TN < datumgrid\TN.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\WI < datumgrid\WI.lla Output Binary File Format: ctable2 executing C:\Temp\basemap\nad2bin lib\mpl_toolkits\basemap\data\WO < datumgrid\WO.lla Output Binary File Format: ctable2 running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src build_src building extension "mpl_toolkits.basemap._proj" sources building extension "_geoslib" sources build_src: building npy-pkg config files running build_py copying lib\mpl_toolkits\__init__.py -> build\lib.win32-2.7\mpl_toolkits copying lib\mpl_toolkits\basemap\accumulator.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\cm.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\constants.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\geodesic.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\geodesiccapability.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\geodesicline.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\geomath.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\polygonarea.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\proj.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\pyproj.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\shapefile.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\solar.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\test.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\__init__.py -> build\lib.win32-2.7\mpl_toolkits\basemap copying lib\mpl_toolkits\basemap\data\alaska -> build\l
Re: [Matplotlib-users] Building Basemap on Windows
On Thu, Aug 30, 2012 at 5:44 PM, Christoph Gohlke wrote: > > Try to remove 'geos_c' from the list of libraries in setup.py. Works for me. > > -libraries=['geos_c','geos'])) > +libraries=['geos'])) Thanks, that was it. It builds fine afterwards :) Using this opportunity to thank you once more, for publicly maintaining large and great selection of ready-made Python packages for Windows, thus lowering the entrance level to broader Python sci userbase Best wishes Cheers -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Accessing WMS and ESRI REST services in Matplotlib
Hi Rich, On Tue, Oct 9, 2012 at 10:38 PM, Rich Signell wrote: > It look like there was a "wmsimage" method in Basemap that was folded > into a "arcgisimage" method? > > IIRC, it was named like that in the test cycle, then renamed correctly to arcgis I made my first step in adding WMS method: https://gist.github.com/b05f1704127accc0a0da But I did not continue as, I saw no one interested and there were tons of non-working WMS servers, and those that do work were only US You can install basemap with by adding that function, and provide additional parameters options. It worked fine when I tested it -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Accessing WMS and ESRI REST services in Matplotlib
On Wed, Oct 10, 2012 at 11:28 PM, Jeff Whitaker wrote: > > I wonder whether it would be better to use OWSlib > (http://geopython.github.com/OWSLib/) for OGS/WMS support, instead of trying > to roll our own solution. It only has ElementTree as a dependency. Klo - > would you be interested in rewriting your wmsimage method using OWSlib? I > bet it would simplify the code quite a bit. Hi Jeff, that's good idea :D But really, OWSlib is very small package that doesn't depend on anything so why rewrite, right? I installed it and played with it shortly. It provides all sorts of useful functions for WMS service and it can return HTTPmessage suitable for writing to file object, but not for imshow()/imread() as it's chunked encoded, as I mentioned in that gist sample. So my suggestion is we just use warpimage() and handle WMS that way, as warpimage() uses temp file with urlretrieve(). Although we can use cStringIO and avoid temp file. So user handles WMS through OWSLib the way he likes and then passes it to warpimage() like this (taken from docs): m = Basemap(...) img = wms.getmap(layers=['global_mosaic'], styles=['visual_bright'], srs='EPSG:4326', bbox=(-112, 36, -106, 41), size=(300, 250), format='image/jpeg' ) m.warpimage(image=img.url) where obviously wms in OWSLib WebMapService class instance -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Accessing WMS and ESRI REST services in Matplotlib
On Thu, Oct 11, 2012 at 3:31 AM, Jeff Whitaker wrote: > But warpimage assumes the image is of global extent - perhaps we could > make warpimage smart enough to get the georeferencing from the wms > instance but that would require some work. There must be some way to > let the WMS server do the image warping and convert the result to > something imshow can read - perhaps by writing to a png file (or > CStringIO instance) and then reading it back in with imread? Not sure, but as in example posted, 'img' is HTTPmessage pointing to server, and I can't see how we can deduce georeference as 'wms' object is named arbitrary, it could have been named to anything: from owslib.wms import WebMapService server = ' http://motherlode.ucar.edu:8080/thredds/wms/fmrc/NCEP/NAM/CONUS_12km/NCEP-NAM-CONUS_12km-noaaport_best.ncd ' wms = WebMapService(server) ... I don't know how to make WebMapService instance for Basemap class, so can't even tell if that's good idea or not, but we can add optional parameter to warpimage() function which could help georeferencing? boundingbox? Also as I think you mentioned that warpimage() is kind of resource hog, so we should find other way if possible? Anyhow, here is function that can read chunked response, so tell what you think: def imshow_chunked(img): if img.headers['transfer-encoding'] == 'chunked': import cStringIO sio_img = cStringIO.StringIO() while True: chunk = img.read() if not chunk: break sio_img.write(chunk) sio_img.seek(0) wms_img = imread(sio_img) sio_img.close() else: wms_img = imread(img) img.close() return imshow(wms_img, origin='upper') Where 'img' is as in my previous mail - img = wms.getmap(...) -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Accessing WMS and ESRI REST services in Matplotlib
On Thu, Oct 11, 2012 at 4:40 AM, klo uo wrote:
> Not sure, but as in example posted, 'img' is HTTPmessage pointing to
> server, and I can't see how we can deduce georeference as 'wms' object is
> named arbitrary, it could have been named to anything:
>
What am I talking about? We can deduce from 'img.url' itself:
In [23]: import urlparse
In [24]: urlparse.parse_qs(img.url)
Out[24]:
{'COLORSCALERANGE': ['271.2,308'],
'CRS': ['EPSG:4326'],
'STYLES': ['boxfill/rainbow'],
'VERSION': ['1.3.0'],
'bbox': ['-118,22,-108,32'],
'bgcolor': ['0xFF'],
'exceptions': ['application/vnd.ogc.se_xml'],
'format': ['image/png'],
'height': ['250'],
'
http://motherlode.ucar.edu:8080/thredds/wms/fmrc/NCEP/NAM/CONUS_12km/NCEP-NAM-CONUS_12km-noaaport_best.ncd?layers':
['Temperature_height_above_ground'],
'request': ['GetMap'],
'srs': ['None'],
'transparent': ['TRUE'],
'version': ['1.1.1'],
'width': ['250']}
So we have all information about the the service in a nice dictionary,
reading it's url
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Accessing WMS and ESRI REST services in Matplotlib
I guess that's it? warpimage() as it is now, checks if passed image is url, so we can add additional check if image is url, with urlparse to deduce image coordinates and projection if present, then overlay it over already created Basemap object. -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Accessing WMS and ESRI REST services in Matplotlib
That's also what that snippet I linked does. You can add it to to Basemap and it should work. However Jeff suggested we use this tiny package OWSlib and handle WMS that way, which is better IMHO, but for some reason we did not got further reply. On Fri, Oct 12, 2012 at 1:31 PM, Rich Signell wrote: > WMS services are required to respond to "GetCapabiltiies" request, > reporting what layers, styles, times, elevations, and projections they > have available. So for example, using the Unidata WMS example below, > if we do: > > > http://motherlode.ucar.edu:8080/thredds/wms/fmrc/NCEP/NAM/CONUS_12km/NCEP-NAM-CONUS_12km-noaaport_best.ncd?service=WMS&request=GetCapabilities > > we can see from the XML response that the Coordinate Reference Systems > supported are: > > EPSG:4326 > CRS:84 > EPSG:41001 > EPSG:3857 > EPSG:27700 > EPSG:3408 > EPSG:3409 > EPSG:32661 > EPSG:32761 > > And for this server, the supported response types are: > image/jpeg > image/png > application/vnd.google-earth.kmz > image/gif > > So I guess one way to proceed if you wanted to use WMS in Matplotlib > and avoid reprojection in python would be to: > 1. do the WMS GetCapabilities request to find the available supported > Coordinate Reference Systems (which will vary with WMS server) > 2. setup Basemap to use one of these CRS > 3. use the bounding box of your current axis (in projection units) as > part of a GetMap request to the WMS. > > -Rich > > On Thu, Oct 11, 2012 at 12:16 AM, klo uo wrote: > > I guess that's it? > > > > warpimage() as it is now, checks if passed image is url, so we can add > > additional check if image is url, with urlparse to deduce image > coordinates > > and projection if present, then overlay it over already created Basemap > > object. > > > > > -- > > Don't let slow site performance ruin your business. Deploy New Relic APM > > Deploy New Relic app performance management and know exactly > > what is happening inside your Ruby, Python, PHP, Java, and .NET app > > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > > http://p.sf.net/sfu/newrelic-dev2dev > > ___ > > Matplotlib-users mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > -- > Dr. Richard P. Signell (508) 457-2229 > USGS, 384 Woods Hole Rd. > Woods Hole, MA 02543-1598 > -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] colormap shift
I asked same question with different problem here:
http://matplotlib.1069221.n5.nabble.com/How-to-shift-colormap-td18451.html
You can see there how to use Gimp and create mpl colormap and then later
there is nifty code that will allow you to shift colormaps with a slider
>From your problem I assume you would want the first.
Here is ready made for you:
import matplotlib as mpl
import matplotlib.pyplot as plt
ccm = {
'red' : (
(0.00, 0.00, 0.00),
(0.01, 1.00, 1.00),
(0.50, 0.50, 0.50),
(1.00, 0.00, 0.00)
),
'green' : (
(0.00, 0.00, 0.00),
(0.01, 1.00, 1.00),
(0.50, 0.50, 0.50),
(1.00, 0.00, 0.00)
),
'blue' : (
(0.00, 0.00, 0.00),
(0.01, 1.00, 1.00),
(0.50, 0.50, 0.50),
(1.00, 0.00, 0.00)
)
}
cm = mpl.colors.LinearSegmentedColormap('my_map', ccm)
from numpy import outer, arange, ones
a = outer(arange(0, 1, 0.01), ones(10))
plt.imshow(a, cmap=cm)
plt.show()
--
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ANN: matplotlib 1.2.0
Congratulation, team! Binary installer for 32-bit Windows, built using python.org's 2.7 and Numpy 1.6.2 is listed but file is not found. I guess it's boiling now, and will be available soon ;) On Fri, Nov 9, 2012 at 1:57 AM, Michael Droettboom wrote: > After months of hard work by a veritable army of contributors, I'm > pleased to announce the release of matplotlib 1.2.0. > > This is the first time we've released without the assistance of John > Hunter, who is sorely missed. I hope this is at least a small way to say > thanks for all of his great work. > > Release tarballs and binaries are available on github. (They are no > longer being made available on SourceForge). > > https://github.com/matplotlib/matplotlib/downloads > > This is the first release to support Python 3.x (and as a result drops > support for Pythons earlier than 2.6). There is new support for outputting > PGF/TikZ files. New plot types include 3D trisurface plots, and > streamplots. Tripcolor, boxplot, colorbars and contour plots have all > grown new features. And under the hood, numerous improvements in > stability, flexibility and robustness. For a complete list, see the > "what's new" page: > > http://matplotlib.org/users/whats_new.html > > For an even more detailed list of 698 issues (!) resolved since the last > release, see the github statistics page: > > http://matplotlib.org/users/github_stats.html > > Enjoy! As always, there are number of good ways to get help with > matplotlib listed on the homepage at http://matplotlib.org/ and I thank > everyone for their continued support of this project. > > Mike > > > -- > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_nov > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 'module' object has no attribute 'instancemethod'
Out of the blue, I started getting this messages while plotting with MPL 1.2.1: Traceback (most recent call last): File "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4.py", line 244, in mouseMoveEvent FigureCanvasBase.motion_notify_event( self, x, y ) File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py", line 1724, in motion_notify_event self.callbacks.process(s, event) File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 343, in process proxy(*args, **kwargs) File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 215, in __call__ mtd = new.instancemethod(self.func, self.inst(), self.klass) AttributeError: 'module' object has no attribute 'instancemethod' I didn't install any new package or change my Python installation in any way, which makes this hard for me to solve. The message appears when I move my mouse pointer inside plot window. I first removed matplotlibrc from my "home" folder, and it happens again regardless backend changed this way from wx to tk (which is default). I set backend to qt4 also, but it's just the same. Any ideas? -- Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Fwd: 'module' object has no attribute 'instancemethod'
Ah, right. There was indeed new.pyc file in folder I was working in. Thanks On Sat, May 25, 2013 at 9:47 PM, Christoph Gohlke wrote: > On 5/25/2013 12:37 PM, klo uo wrote: > > Out of the blue, I started getting this messages while plotting with MPL > > 1.2.1: > > > > > > Traceback (most recent call last): > >File > > "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4.py", line > > 244, in mouseMoveEvent > > FigureCanvasBase.motion_notify_event( self, x, y ) > >File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py", > > line 1724, in motion_notify_event > > self.callbacks.process(s, event) > >File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 343, > > in process > > proxy(*args, **kwargs) > >File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 215, > > in __call__ > > mtd = new.instancemethod(self.func, self.inst(), self.klass) > > AttributeError: 'module' object has no attribute 'instancemethod' > > > > > > I didn't install any new package or change my Python installation in any > > way, which makes this hard for me to solve. The message appears when I > > move my mouse pointer inside plot window. I first removed matplotlibrc > > from my "home" folder, and it happens again regardless backend changed > > this way from wx to tk (which is default). I set backend to qt4 also, > > but it's just the same. > > > > Any ideas? > > > > There is likely a `new` module in sys.path that shadows Python's builtin > new module. Add a `import new;print(new.__file__)` statement at the top > of your script. It should output 'X:\\Python27\\lib\\new.pyc' > > Christoph > > -- Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Font issue while trying to save PS/EPS/SVG but not PDF
As suggested by Phil, I'm reposting github issue #2067 on this list.
I use MPL 1.2.1 on Windows with Python 2.7.5. In my matplotlibrc I've
set sans-serif font to "Segoe UI".
Now, if I try to save a plot to PDF, MPL saves it fine, but if I try
PS or EPS or SVG it fails, because of the font set. (If I don't change
the font everything is fine)
Here is PDF info from mutool:
PDF-1.4
Info object (27 0 R):
<<
/CreationDate (D:20130528120149+02'00')
/Producer (matplotlib pdf backend)
/Creator (matplotlib 1.2.1, http://matplotlib.sf.net)
>>
Pages: 1
Retrieving info from pages 1-1...
Mediaboxes (1):
1 ( 10 0 R): [ 0 0 576 432 ]
Fonts (1):
1 ( 10 0 R): Type3 'SegoeUI' (14 0 R)
So I wonder how can MPL output PDF, but can't output PS/EPS, let aside SVG?
And here is full trace from IPython:
KeyError Traceback (most recent call last)
in ()
> 1 savefig('test.eps')
C:\Python27\lib\site-packages\matplotlib\pyplot.pyc in savefig(*args, **kwargs)
470 def savefig(*args, **kwargs):
471 fig = gcf()
--> 472 return fig.savefig(*args, **kwargs)
473
474 @docstring.copy_dedent(Figure.ginput)
C:\Python27\lib\site-packages\matplotlib\figure.pyc in savefig(self,
*args, **kwargs)
1368 kwargs.setdefault('edgecolor',
rcParams['savefig.edgecolor'])
1369
-> 1370 self.canvas.print_figure(*args, **kwargs)
1371
1372 if transparent:
C:\Python27\lib\site-packages\matplotlib\backend_bases.pyc in
print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
format, **kwargs)
2094 orientation=orientation,
2095 bbox_inches_restore=_bbox_inches_restore,
-> 2096 **kwargs)
2097 finally:
2098 if bbox_inches and restore_bbox:
C:\Python27\lib\site-packages\matplotlib\backend_bases.pyc in
print_eps(self, *args, **kwargs)
1841 from backends.backend_ps import FigureCanvasPS # lazy import
1842 ps = self.switch_backends(FigureCanvasPS)
-> 1843 return ps.print_eps(*args, **kwargs)
1844
1845 def print_pdf(self, *args, **kwargs):
C:\Python27\lib\site-packages\matplotlib\backends\backend_ps.pyc in
print_eps(self, outfile, *args, **kwargs)
972
973 def print_eps(self, outfile, *args, **kwargs):
--> 974 return self._print_ps(outfile, 'eps', *args, **kwargs)
975
976
C:\Python27\lib\site-packages\matplotlib\backends\backend_ps.pyc in
_print_ps(self, outfile, format, *args, **kwargs)
1005 self._print_figure(outfile, format, imagedpi,
facecolor, edgecolor,
1006orientation, isLandscape, papertype,
-> 1007**kwargs)
1008
1009 def _print_figure(self, outfile, format, dpi=72,
facecolor='w', edgecolor='w',
C:\Python27\lib\site-packages\matplotlib\backends\backend_ps.pyc in
_print_figure(self, outfile, format, dpi, facecolor, edgecolor,
orientation, isLandscape, papertype, **kwargs)
1098 bbox_inches_restore=_bbox_inches_restore)
1099
-> 1100 self.figure.draw(renderer)
1101
1102 if dryrun: # return immediately if dryrun (tightbbox=True)
C:\Python27\lib\site-packages\matplotlib\artist.pyc in
draw_wrapper(artist, renderer, *args, **kwargs)
52 def draw_wrapper(artist, renderer, *args, **kwargs):
53 before(artist, renderer)
---> 54 draw(artist, renderer, *args, **kwargs)
55 after(artist, renderer)
56
C:\Python27\lib\site-packages\matplotlib\figure.pyc in draw(self, renderer)
1004 dsu.sort(key=itemgetter(0))
1005 for zorder, a, func, args in dsu:
-> 1006 func(*args)
1007
1008 renderer.close_group('figure')
C:\Python27\lib\site-packages\matplotlib\artist.pyc in
draw_wrapper(artist, renderer, *args, **kwargs)
52 def draw_wrapper(artist, renderer, *args, **kwargs):
53 before(artist, renderer)
---> 54 draw(artist, renderer, *args, **kwargs)
55 after(artist, renderer)
56
C:\Python27\lib\site-packages\matplotlib\axes.pyc in draw(self,
renderer, inframe)
2084
2085 for zorder, a in dsu:
-> 2086 a.draw(renderer)
2087
2088 renderer.close_group('axes')
C:\Python27\lib\site-packages\matplotlib\artist.pyc in
draw_wrapper(artist, renderer, *args, **kwargs)
52 def draw_wrapper(artist, renderer, *args, **kwargs):
53 before(artist, renderer)
---> 54 draw(artist, renderer, *args, **kwargs)
55 after(artist, renderer)
56
C:\Python27\lib\site-packages\matplotlib\axis.pyc in draw(self,
renderer, *args, **kwargs)
1053
1054 fo
Re: [Matplotlib-users] Font issue while trying to save PS/EPS/SVG but not PDF
On Tue, May 28, 2013 at 4:40 PM, Michael Droettboom wrote: > Which version of Windows are you on? Apparently, the Segoe UI font is > different on Windows 7 and 8 and I'd like to download and test with the > correct one. I'm on Windows XP, but problem was with the name of the font. This font's name is "Segoe UI" and if I reference it in matplotlibrc as "SegoeUI" (without space), then it works in all above vector formats. "Segoe UI" works only in PDF. -- Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] plot axis and legend without anti-aliased lines
This code: import matplotlib.pyplot as plt plt.plot([1,2,5,3,4], label='line') plt.legend() plt.show() shows this image: http://i.imgur.com/KMPywSp.png I want axis and legend box with 1px line, like this: http://i.imgur.com/Qmb4e6C.png but can't find any pointers except turning anti-aliasing off for all plot lines, which is not what I want. Is this anyhow possible? -- This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot axis and legend without anti-aliased lines
Thanks Paul, that solved the problem. matplotlib.rcParams['axes.linewidth'] = 0.5 matplotlib.rcParams['patch.linewidth'] = 0.5 is what I wanted and I'll put that in matplotlibrc. Previously I thought that this is related to some anti-aliasing setting that would affect all lines drawn. But as it is possible to set this preference to custom plot elements, this is what I would always prefer. Default setting looks too blurry for horizontal and vertical lines. Cheers On Sat, Jun 29, 2013 at 11:49 PM, Paul Hobson wrote: > You need to thin out the default line widths in your matplotlibrc file. > > Something like: > import matplotlib > matplotlib.rcParams['axes.linewidth'] = 0.5 > matplotlib.rcParams['lines.linewidth'] = 0.5 > > ...if you don't want to edit your matplotlibrc file. > > Hope that helps, > -paul -- This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
