SourceForge logo
SourceForge logo
Menu

matplotlib-devel — matplotlib developers

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
(1)
Nov
(33)
Dec
(20)
2004 Jan
(7)
Feb
(44)
Mar
(51)
Apr
(43)
May
(43)
Jun
(36)
Jul
(61)
Aug
(44)
Sep
(25)
Oct
(82)
Nov
(97)
Dec
(47)
2005 Jan
(77)
Feb
(143)
Mar
(42)
Apr
(31)
May
(93)
Jun
(93)
Jul
(35)
Aug
(78)
Sep
(56)
Oct
(44)
Nov
(72)
Dec
(75)
2006 Jan
(116)
Feb
(99)
Mar
(181)
Apr
(171)
May
(112)
Jun
(86)
Jul
(91)
Aug
(111)
Sep
(77)
Oct
(72)
Nov
(57)
Dec
(51)
2007 Jan
(64)
Feb
(116)
Mar
(70)
Apr
(74)
May
(53)
Jun
(40)
Jul
(519)
Aug
(151)
Sep
(132)
Oct
(74)
Nov
(282)
Dec
(190)
2008 Jan
(141)
Feb
(67)
Mar
(69)
Apr
(96)
May
(227)
Jun
(404)
Jul
(399)
Aug
(96)
Sep
(120)
Oct
(205)
Nov
(126)
Dec
(261)
2009 Jan
(136)
Feb
(136)
Mar
(119)
Apr
(124)
May
(155)
Jun
(98)
Jul
(136)
Aug
(292)
Sep
(174)
Oct
(126)
Nov
(126)
Dec
(79)
2010 Jan
(109)
Feb
(83)
Mar
(139)
Apr
(91)
May
(79)
Jun
(164)
Jul
(184)
Aug
(146)
Sep
(163)
Oct
(128)
Nov
(70)
Dec
(73)
2011 Jan
(235)
Feb
(165)
Mar
(147)
Apr
(86)
May
(74)
Jun
(118)
Jul
(65)
Aug
(75)
Sep
(162)
Oct
(94)
Nov
(48)
Dec
(44)
2012 Jan
(49)
Feb
(40)
Mar
(88)
Apr
(35)
May
(52)
Jun
(69)
Jul
(90)
Aug
(123)
Sep
(112)
Oct
(120)
Nov
(105)
Dec
(116)
2013 Jan
(76)
Feb
(26)
Mar
(78)
Apr
(43)
May
(61)
Jun
(53)
Jul
(147)
Aug
(85)
Sep
(83)
Oct
(122)
Nov
(18)
Dec
(27)
2014 Jan
(58)
Feb
(25)
Mar
(49)
Apr
(17)
May
(29)
Jun
(39)
Jul
(53)
Aug
(52)
Sep
(35)
Oct
(47)
Nov
(110)
Dec
(27)
2015 Jan
(50)
Feb
(93)
Mar
(96)
Apr
(30)
May
(55)
Jun
(83)
Jul
(44)
Aug
(8)
Sep
(5)
Oct
Nov
(1)
Dec
(1)
2016 Jan
Feb
Mar
(1)
Apr
May
Jun
(2)
Jul
Aug
(3)
Sep
(1)
Oct
(3)
Nov
Dec
2017 Jan
Feb
(5)
Mar
Apr
May
Jun
Jul
(3)
Aug
Sep
(7)
Oct
Nov
Dec
2018 Jan
Feb
Mar
Apr
May
Jun
Jul
(2)
Aug
Sep
Oct
Nov
Dec
S M T W T F S

1
2
3
4
5
6
7
8
(3)
9
(5)
10
(8)
11
12
(4)
13
14
15
(1)
16
(6)
17
(4)
18
(7)
19
(3)
20
21
22
(2)
23
24
25
26
(1)
27
(1)
28
(1)
29
(3)
30
(2)
31



Showing 5 results of 5

From: Perry G. <pe...@st...> - 2004年03月09日 23:15:38
John Hunter writes:
> I'm starting to think about adding image support and wanted to get
> some input about what it should include and how it should be designed.
> The ideas are still pretty nascent but here is where I was planning to
> start.
> 
> Create an image extension built around agg (not backend_agg). This
> would be a free standing extension not tied to any of the backends
> with the responsibility of loading image data from a variety of
> sources into a pixel buffer, and resizing it to a desired pixel size
> (dependent on the axes window) with customizable interpolation.
> 
I guess I'm confused by terminology. What do you intend "backend"
to mean for images. A common interface for reading different
image formats? Speaking of which...
> Inputs: what file formats should be supported? 
> 
> * I can do PNG rather easily since I already had to interface agg
> with png for save capabilities in backend_agg.
> 
I guess I would argue for what you refer to below, that the
functionality to read image formats should be decoupled, at least
initially, from the plotting (display?) package. In fact, initially
it may make sense just to use PIL for that functionality alone until
we understand better what really needs to be integrated into the 
display package. (The main drawback of PIL is that it doesn't support
either Numeric or numarray, and Lundt isn't inclined to support
either unless either is part of the Python Standard Library. It
may turn out that we could add it to PIL, or extract from PIL
the image file support component for our purposes. I suspect that
that stuff is pretty stable). But initially, reading images into
arrays seems like the most flexible and straightforward thing to
do.
> * As for raw pixel data, should we try to support
> grayscale/luminance, rgb and rgba with the platform dependent byte
> ordering problems, or leave it to the user to load these into a
> numeric/numarray and init the image with that? Should we follow
> PILs lead here and just provide a fromstring method with format
> strings?
> 
I haven't given this a great deal of thought, but again, arguing
for simplicity, that the array representations should be simple.
For example, nxm dim array implies luminance, nxmx3 implies
rgb, nxmx4 implies rgba. The I/O module always fills the arrays
in native byte order. I suppose that some thought should be given
to the default array type. One possibility is to use Float32 with
normalized values (1.0=max), but it is probably important to keep
integer values from some image formats (like png). Floats give
the greatest flexibility and independence from the display hardware,
if sometimes wasteful of memory. The second type to support would be
UInt8 (I admit I could be stupidly overlooking something).
These arrays are passed to matplotlib rendering methods
or functions and the dimensionality will tell the rendering engine
how to interpret it. The question is how much the engine needs to
know about the depth and representation of the display buffer
and how much of these details are handled by agg (or other backends)
> * What raw types should be supported: 8 bit luminance, 16 bit
> luminance, 8 bit rgb, 8bit rgba, 16 bit rgb or rgba?
> 
> Resizing: Generally the axes viewport and the image dimensions will
> not agree. Several possible solutions - perhaps all need to be
> supported:
> 
> * a custom axes creation func that fits the image when you just want
> to view and draw onto single image (ie no multiple subplots).
> 
> * resize to fit, resize constrained aspect ratio, plot in current
> axes and clip image outside axes viewlim
> 
> * with resizing, what pixel interpolation schemes are critical? agg
> supports several: nearest neighbor, blinear, bicubic, spline,
> sinc.
>
Here again I would argue that the resizing functions could be separated 
into a separate module until we understand better how they should
be integrated into the interface. So for now, require a user to
apply a resampling function to an image. Something like this might
be a good initial means of handling images.
im = readpng("mypicture.png") # returns a rgb array (nxmx3) unless alpha
 # is part of png files (I'm that ignorant).
rebinned_im = bilinear(im, axisinfo...)
Then use rebinned_im for a pixel-to-pixel display in the plot canvas
(with appropriate offset and clipping). This isn't quite as convenient
as one step from file to display, but it should get us some flexible 
functionality faster and doesn't restrict more integrated means of
displaying images. There are other approaches to decoupling that are
probably more object oriented.
I'll think more about this (and you can clarify more what you mean
as well if I'm confused about what you are saying).
Perry 
From: John H. <jdh...@ac...> - 2004年03月09日 17:54:44
>>>>> "John" == John N S Gill <jn...@eu...> writes:
 John> Quite often I find myself with numbers for different parts
 John> of the world that I want to map, shading regions different
 John> colours according to the numbers.
 John> The problem I've tended to run into with mapping projects
 John> has been getting shape files that aren't distributed under a
 John> restrictive licence.
I've experimented with this a bit using shapefiles from the national
atlas (I think they are distributed under a permissive license).
thuban has a nice python interface for reading shape files and their
associated db files. I've held off on pursuing this functionality
until we get an efficient path/polygon extension, which has been
discussed a number of times but is still on the TODO list. 
The example below renders the US map from 2000 polygons, and is slow
for interactive use with that many polygons.
 http://nitace.bsd.uchicago.edu:8080/files/share/map.png
For nice map navigation, you would probably want a better navigation
toolbar (hand pan, zoom to region) which was discussed many moons ago
but has also languished due to lack of time -
http://sourceforge.net/mailarchive/message.php?msg_id=6542965
Here's some example code:
# shapefile from
# http://edcftp.cr.usgs.gov/pub/data/nationalatlas/statesp020.tar.gz
# shapefile lib from http://thuban.intevation.org
import shapelib, dbflib, shptree
from matplotlib.patches import Polygon
from matplotlib.matlab import *
filename = 'statesp020.shp'
dbfile = 'statesp020.dbf'
shp = shapelib.ShapeFile(filename)
numShapes, type, smin, smax = shp.info()
ax = gca()
dpi = ax.dpi
bbox = ax.bbox
transx = ax.xaxis.transData
transy = ax.yaxis.transData
left=[]; right=[]; bottom=[]; top=[]
db = dbflib.open(dbfile)
# just get the main polys for each state
seen = {}
for i in range(numShapes):
 rec = db.read_record(i)
 state = rec['STATE']
 area = rec['AREA']
 obj = shp.read_object(i)
 verts = obj.vertices()[0]
 if seen.has_key(state):
 have, tmp = seen[state]
 if area>have:
 seen[state] = area, verts
 else:
 seen[state] = area, verts 
 
for state, tup in seen.items(): 
 area, verts = tup
 poly = Polygon(dpi, bbox, verts,
 fill=False,
 transx=transx, transy=transy)
 x = [tx for tx, ty in verts]
 y = [ty for tx, ty in verts]
 ax.xaxis.datalim.update(x)
 ax.yaxis.datalim.update(y)
 ax.add_patch(poly)
set(gca(), 'xlim', ax.xaxis.datalim.bounds())
set(gca(), 'ylim', ax.yaxis.datalim.bounds())
savefig('map', dpi=150)
axis('Off')
show() 
From: John N S G. <jn...@eu...> - 2004年03月09日 16:40:15
 
> Any other thoughts welcome...
 
Not really related to images but... 
I've been thinking a bit about mapplotlib (no, that is not a typo).
Quite often I find myself with numbers for different parts of the world
that I want to map, shading regions different colours according to the
numbers.
In fact, one of my early experiments with python and wxPython was to
produce such a beast, but I'm not terribly happy with what I produced.
matplotlib has lots of the goodies that mapplotlib would require: it
has axes you can zoom and scroll, is great a drawing coloured polygons
and can do legends.
The problem I've tended to run into with mapping projects has been
getting shape files that aren't distributed under a restrictive licence.
Anyway, is there any interest out there in a mapplotlib?
John
From: John H. <jdh...@ac...> - 2004年03月09日 16:10:57
I'm starting to think about adding image support and wanted to get
some input about what it should include and how it should be designed.
The ideas are still pretty nascent but here is where I was planning to
start.
Create an image extension built around agg (not backend_agg). This
would be a free standing extension not tied to any of the backends
with the responsibility of loading image data from a variety of
sources into a pixel buffer, and resizing it to a desired pixel size
(dependent on the axes window) with customizable interpolation.
Inputs: what file formats should be supported? 
 * I can do PNG rather easily since I already had to interface agg
 with png for save capabilities in backend_agg.
 * As for raw pixel data, should we try to support
 grayscale/luminance, rgb and rgba with the platform dependent byte
 ordering problems, or leave it to the user to load these into a
 numeric/numarray and init the image with that? Should we follow
 PILs lead here and just provide a fromstring method with format
 strings?
 * What raw types should be supported: 8 bit luminance, 16 bit
 luminance, 8 bit rgb, 8bit rgba, 16 bit rgb or rgba?
Resizing: Generally the axes viewport and the image dimensions will
not agree. Several possible solutions - perhaps all need to be
supported:
 
 * a custom axes creation func that fits the image when you just want
 to view and draw onto single image (ie no multiple subplots).
 * resize to fit, resize constrained aspect ratio, plot in current
 axes and clip image outside axes viewlim
 * with resizing, what pixel interpolation schemes are critical? agg
 supports several: nearest neighbor, blinear, bicubic, spline,
 sinc.
Backends:
 I am thinking about using the same approach as in ft2font. Have the
 image backend provide the load/resize/interpolate methods and fill a
 pixel buffer of appropriate size and letting the backends do
 whatever they want with it. Agg can blend the image with the
 drawing buffer, gtk can draw from an rgba buffer. Not sure about PS
 yet. paint and wx can use their respective APIs to copy the pixel
 buffer.
Any other thoughts welcome...
JDH
From: John N S G. <jn...@eu...> - 2004年03月09日 13:18:20
Attachments: table.py
John,
Attached is a new version of table.py where I have added some methods to
allow auto-scaling of the fonts used in the tables. 
The code simply shrinks the fontsize until it finds a value that fits.
John

Showing 5 results of 5

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /