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






Showing 1 results of 1

Hi Eric,
I think I understand the two approaches you mention, I have about the 
same mental distinction although with a different spin, maybe because 
I come from finite element/data visualisation instead of image 
manipulation: I see basically two type of 2D data that can be 
visualized as a colormapped image:
 a) point data, where you provide a collection of values with 
associated coordinates. Algorithm is then fully responsible for 
computing the "best" value to associate to other coordinates (not 
provided by the user, but nonetheless needed to build a full image, 
because there was a change of resolution or just some data lacking). 
One can distinguish sub categories: are the points given on
 - an regular rectangular grid, *
 - a regular hexagonal/triangular grid,
 - an irregular rectangular grid *
 - another pattern? like mapped rectangular grid, ...
 - at arbitrary locations, without pattern
 for now in matplotlib only *-marked subcategories are supported, AFAIK
b) cell data, where you provide a collection of cell (polygons), with 
vertex coordinates and color-mapped data. Again we can distinguish su 
categories:
 - cell-wise data, no interpolation needed *
 - or vertex-wise data, interpolation needed
 -averaging on the cell
 -proximity based interpolation
 -(bi)linear interpolation
 -higher order interpolation
 and also it can be subdivided using cell geometry criterium
 - cell part of a regular rectangular grid *
 - cell part of an irregular rectangular grid *
 - cell part of a mapped rectangular *
 - arbitray cells, but paving the plane (vertex coodinate + 
connectivity table)
 - fully arbitrary cells, not necessarily continuously connected
 Again, AFAIK for now the *-marked categories are currently suported 
in matplotlib.
In addition to those categories, one additional thing can be 
considered when any kind of interpolation/extrapolation is performed: 
Does the interpolation happen on the data, and then the interpolated 
data is mapped to color (phong mapping/interpolation/shading in matlab 
speach), or are is the interpolation performed on colors after the 
initial user-provided data have been mapped (gouraud 
mapping/interpolation/shading in matlab speach).
Some equivalences exists between cell based image and point based 
image, in particular my patch can be seen as irregular rectangular 
grid patches bith bilinear interpolation, or point data with bilinear 
interpolation. It is more of the second one, as for example in 
cell-data, one can expect to be able to set line styles for cell 
boundaries, while in point data this would have no sense.
I do not see the fact that for point data the interpolation is choosen 
by the algorithm as a bad thing: in fact, if one use point data, it is 
because there is no cell information as such, so the fact that the 
algorithm choose automatically the boundaries is an advantage.
For example, your NonUniformImage is a point-data image generator, 
which work for non-uniform rectangular grids. It associate with each 
pixel the data of the closest (using non-cartesian distance, but a 
"manhatan distance" given by abs(x-x0) + abs(y-y0)) available point 
data.
My patch added bilinear interpolation, using x and y bilinear 
interpolation between the four closest. Other type of interpolation 
are possible, but more complex to implement.
The context in which we want to use NonUniformImage is not for image 
processing, but for data visualisation: we have measurement data 
dependent on two variables (RPM and frequency), and a classic way to 
present such data is what is known in the field (acoustic radiation) 
as a "waterfall diagram". However, the samples are not necessarily 
taken on a regular grid. They are taken at best on an irregular grid 
(especially for the RPM), and at worst using a non-obvious pattern. 
There is no cell data here, boudaries are not really relevant, the 
only thing that matter is to provide an attractive and 
visualy-easy-to-parse image of 2D data which was sampled (or 
simulated) on a set of points. In this context both interpolation 
(nearest, usefull because if present only measured data extended in 
the best way so that they cover the whole figure, without any actual 
interpolation), and bilinear (show smoother variations, making more 
easy to visually detect some pattern and interresting RPM/FREQUENCY 
regions ) are interresting for our users...
A small example as you requested (a is withing the data, b is outside, 
c is completely oustide)
 c
 11 12 13
 a b
 21 22 23
 31 32 33
Nearest interpolation (patched (small error), but already present):
 color at a = color at 12 or 13 or 22 or 23, whichever is closest to a
 color at b = color at 13 or 23, whichever is closest to b
 color at c = color at 13
Bilinear interpolation (new):
 S=(x23-x12)(y12-y23)
 color at a = color(12) * (x23-xa)(ya-y23)/S
 + color(13) * (xa-x22)(ya-y22)/S
 + color(22) * (x13-xa)(y13-ya)/S
 + color(23) * (xa-x12)(y12-ya)/S
 color at b = color(13) * (yb-y23)/(y13-y23)
 + color(23) * (y13-yb)/(y13-y23)
 color at c = color at 13
As I mentioned in my first message, to complete the full array of 
image generation (point data, cell data, various interpolation scheme 
and geometric distribution of points or cell geometries, interpolation 
before or after the color mapping) is a tremendous work. Not even 
matlab has it completed, although it is far more complete than 
matploblib for now and can be considered a worthy goal... But I think 
this linear interpolation after color mapping on irregular rectangular 
point data is already a usefull addition ;-)
Regards,
Greg.
Quoting Eric Firing <ef...@ha...>:
> Grégory Lielens wrote:
>> Thanks a lot for reviewing my patch!
>> I have corrected most of the problems (I think ;-) )
>> I indeed introduced memory leak, I think it is fixed now, I have also
>> reorganized the code to avoid duplication of the cleanup code. I used an
>> helper function instead of the goto, because this cleanup is needed for
>> normal exit too, so the helper function can come in handy for that.
>> std::vector would have been nice, but I tried to respect the original
>> coding style, maybe this could be changed but I guess the original
>> author should have something to say about it....
>> Only thing I did not change is the allocation of acols/arows even when
>> they are not used. It is not difficult to do, but the code will be a
>> little more complex and I think that the extra memory used is not
>> significant: The memory for those mapping structure is doubled (1 float
>> and 1 int vector of size N, instead of a single int vector of size N),
>> but those mapping structures are an order of magnitude smaller than the
>> image buffer of size N*N of 4 char anyway...
>>
>> If one agree that this is to be saved at the (slight) expense of code
>> conciseness/simplicity, I can add this optimisation...
>>
>> Thanks for pointing the error at the left/bottom pixel lines, it is
>> corrected now :-)
>>
>> And I set interpolation to NEAREST by default, so that the behavior of
>> NonUniformImage remains the same as before if the user do not specify
>> otherwise (I forgot to do it in the first patch)...
>>
>>
>> I include the new patch,
>
> Gregory,
>
> I am sorry to be late in joining in, but I have a basic question about
> what you are trying to do. It arises from the fact that there are two
> styles of image-like plots:
>
> 1) In the original Image and NonuniformImage, the colors and locations
> of "pixel" (or patch or subregion or whatever) centers are specified.
>
> 2) In pcolor, quadmesh, and pcolorimage, the patch *boundaries* are
> specified. pcolorimage is my modification of the original
> NonuniformImage code to work with boundaries. I left the original in
> place, since presumably it meets some people's needs, even though it
> does not meet mine.
>
> When the grid is uniform, it doesn't really make any difference; but
> when the grid is nonuniform, then I don't think style #1 makes much
> sense for pcolor-style plotting, in which there is no interpolation;
> there is no unique way to specify the boundaries, so it is up to
> the plotting routine, and that is bad.
>
> For an image, it is clear how the interpolation should work: the color
> values are given at the centers of the "pixels" (meaning on the original
> image grid, not on the screen or other output device grid), which are
> uniformly spaced, and interpolated between.
>
> Exactly what is your patch supposed to do for the nonuniform case? Would
> you describe and demonstrate it, please, for a simple case with a 2x2
> array of colors and 3x3 arrays for boundary x and y?
>
> Thanks.
>
> Eric

Showing 1 results of 1

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 によって変換されたページ (->オリジナル) /