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




Showing 8 results of 8

From: Derek H. <de...@as...> - 2010年08月10日 23:04:55
Hi Friedrich,
>> for the latter: when building matplotlib against a fink-installed python
>> compiled in 64bit mode
>> I found the check for a framework-installed Python (rev 8365) fails, and
>> matplotlib fails to load,
>> because the MacOS module is not available in 64bit.
> 
> Hmm, do you claim that MacOS is in general not available in x86_64?
I intended to, since the fink porting description for Python under OS X 10.6 states so, 
and I was also mislead by the statement "not available in 64-bit mode" in 
http://docs.python.org/library/macos.html , but the latter, I realised, applied just to 
individual functions (in this case, the last one in the list). 
You are right, in principle MacOS.WMAvailable() should still be available (;-) on x86_64. 
> Just my 2 cents:
> 
> pb-d-128-141-26-145:~ Friedrich$ python-32
> Python 2.6.5 (r265:79063, Jul 18 2010, 12:14:53)
> [GCC 4.2.1 (Apple Inc. build 5659)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import MacOS
>>>> ^D
> pb-d-128-141-26-145:~ Friedrich$ python-64
> Python 2.6.5 (r265:79063, Jul 18 2010, 12:14:53)
> [GCC 4.2.1 (Apple Inc. build 5659)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import MacOS
>>>> ^D
> 
> This is a self-compiled python.org Python 2.6.5 residing in
> /Library/Frameworks/Python.framwork:
> ./configure --enable-framework --with-universal-archs=intel
> --enable-universalsdk=/
> with
> MACOSX_DEPLOYMENT_TARGET=10.4
> GCC=gcc-4.2
> 
> Please bear with me, but how does framework/not-framework interfere
> with the build of the MacOS module?
>> (assuming Python is not a framework installation if it lacks the MacOS
>> module).
> 
> Are there more implications? I always thought framework build just
> means to put it in /Library/Framworks/Python.framework.
Good question - all I can tell at this point is that in fink, python is not built as a framework, 
merely with 
./configure --enable-shared
and on Snow Leopard this fails:
miranda:2843> /sw/bin/python2.6
Python 2.6.5 (r265:79063, Jul 19 2010, 02:30:51) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MacOS
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: No module named MacOS
miranda:2844> /usr/bin/python 
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
 File "/Users/derek/.pythonrc", line 22, in <module>
 readline.read_history_file(historyPath)
IOError: [Errno 2] No such file or directory
>>> import MacOS
>>> MacOS.WMAvailable()
True
>>> ^D
There is no patch that would have explicitly removed the module in the fink install, 
so all I can think of is that not enabling framework and/or SDK build is responsible. 
I did not find any hint in the Mac build documentation towards this, though. 
If this is a fink-related problem only, of course we'd just need to apply the patch I've 
created to the fink package. But matplotlib will probably have to deal with it whenever 
it is going to be python3-ready.
Cheers,
							Derek
--
-------------------------------------------------------------------------
Derek Homeier Institut für Astrophysik Göttingen 
Georg-August-Universität Phone: +49 551 39-7980
Friedrich-Hund-Platz 1 Fax: +49 551 39-5043 
D-37077 Göttingen, Germany Feet: E.04.104
Web: http://www.astro.physik.uni-goettingen.de/~derek/
-------------------------------------------------------------------------
From: Friedrich R. <fri...@gm...> - 2010年08月10日 21:58:32
2010年8月10日 Eric Firing <ef...@ha...>:
> On 08/10/2010 10:27 AM, Friedrich Romstedt wrote:
>> So I think it is probably best to code it into the Colormap object
>> itself, so that each and ever derived class can define its own method
>> of how to create a greyscale version. What do you think about that?
>
> Good idea. The base class could define a default to_grayscale() method
> that would do the conversion near the very end of the Colormap.__call__
> method if an as_gray attribute, also defined in the base class, is True.
> No need for getters and setters--let it be a simple attribute. This
> is much simpler than generating a whole new colormap--instead, just set
> an attribute to switch an existing colormap to gray or back to color. I
> would leave the switch out of the __init__ args and kwargs.
> If someone
> wants grey, they can add one more line of code to set the attribute.
Hmm, one would have to do it for every colormap used. Also, it would
be not so obvious if using the default colormap.
> I
> suspect only a small fraction of users will need this.
I like this, it's a good idea enabling to not repeat all the stuff in
the code. But hey, wouldn't it be the same to just overload the
__call__ method?
class GrayColorbar(RgbColorbar):
 """A colorbar returning grayscaled version."""
 def __call__(self, value):
 """Transforms RgbColorbar's value into grayscale, and returns it.""""
 rgb = BaseClass.__call__(self, value)
 [do stuff]
 return grayscale
Agreed, one has to this for all the classes, while your solution works
generically in ColormapBase or whatever it's called.
Another option would be, to wrap the Colormap into a thin layer with
__call__, but this appears way too clumsy and too hacky to me. It's a
clumsy way of deriving from the class. Otherwise it's maybe also
nice, because it's generic, for all Colormaps. __getattr__ and
__setattr__ (iirc) could be used to simulate the wrapped instance
fully.
Is there some layer dealing with colors in the renderers, where the
conversion could also happen? I'm asking because of displaying color
images etc. and printing them as grayscale. With this, we would get
rid of the alpha stuff completely, too.
Maybe a general matplotlib.rc switch 'greyscale' would be possible.
It would leave room for tons of improvement, e.g. automatically
setting the color cycle to - -- -. etc., there was some monthes ago
discussion about how to achieve that. Another advantage: It's zero
loc if set in the config file ;-)
I think that would be a real neat new feature.
I agree what's not needed is mixed greyscale and colour display in the
same Figure.
Bear with me if my ideas are always too radical.
Friedrich
From: Benjamin R. <ben...@ou...> - 2010年08月10日 21:57:33
On Tue, Aug 10, 2010 at 4:21 PM, Eric Firing <ef...@ha...> wrote:
> On 08/10/2010 10:27 AM, Friedrich Romstedt wrote:
> > Ah, the list config got me ... (resending to list)
> >
> > 2010年8月10日 Benjamin Root<ben...@ou...>:
> >> I am working on a function that can take a Colormap object and return a
> >> grayscale form of it. Ideally, I would like to return the same type of
> >> Colormap that was provided, but I am wondering if this is necessary. I
> >> supposed it is sufficient to just create a LinearSegmentedColormap from
> the
> >> self._lut data?
> >>
> >> The problem I see with that approach is that there is still possibly
> some
> >> information loss, particularly with the alpha part of the rgba data.
> >> LinearSegmentedColormap has a .from_list() function, but it uses only
> the
> >> rgb part of the rgba array and does not take alpha data.
> >>
> >> Is the inability of setting alpha a problem? Or maybe I should use
> >> deepcopy() instead?
> >
> > If you mean me, I really don't know, but I think it is always better
> > to do things
> > properly than to publish something done with the attitute "just
> > working" ....
> >
> > So I think it is probably best to code it into the Colormap object
> > itself, so that each and ever derived class can define its own method
> > of how to create a greyscale version. What do you think about that?
>
> Good idea. The base class could define a default to_grayscale() method
> that would do the conversion near the very end of the Colormap.__call__
> method if an as_gray attribute, also defined in the base class, is True.
> No need for getters and setters--let it be a simple attribute. This
> is much simpler than generating a whole new colormap--instead, just set
> an attribute to switch an existing colormap to gray or back to color. I
> would leave the switch out of the __init__ args and kwargs. If someone
> wants grey, they can add one more line of code to set the attribute. I
> suspect only a small fraction of users will need this.
>
> If people really are going to want to fiddle with the conversion
> function, then the scheme above could easily be extended by allowing the
> as_gray attribute to be a callable; if it is a callable, then
> to_grayscale() would use it instead of the default function.
>
> Eric
>
> >
> > Friedrich
> >
>
>
Interesting ideas, I will try that out tonight.
Ben Root
From: Friedrich R. <fri...@gm...> - 2010年08月10日 21:27:02
2010年8月10日 Derek Homeier <de...@as...>:
> Hi again, cc'ing the matplotlib list this time,
>
> for the latter: when building matplotlib against a fink-installed python
> compiled in 64bit mode
> I found the check for a framework-installed Python (rev 8365) fails, and
> matplotlib fails to load,
> because the MacOS module is not available in 64bit.
Hmm, do you claim that MacOS is in general not available in x86_64?
Just my 2 cents:
pb-d-128-141-26-145:~ Friedrich$ python-32
Python 2.6.5 (r265:79063, Jul 18 2010, 12:14:53)
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MacOS
>>> ^D
pb-d-128-141-26-145:~ Friedrich$ python-64
Python 2.6.5 (r265:79063, Jul 18 2010, 12:14:53)
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MacOS
>>> ^D
This is a self-compiled python.org Python 2.6.5 residing in
/Library/Frameworks/Python.framwork:
./configure --enable-framework --with-universal-archs=intel
--enable-universalsdk=/
with
MACOSX_DEPLOYMENT_TARGET=10.4
GCC=gcc-4.2
Please bear with me, but how does framework/not-framework interfere
with the build of the MacOS module?
> (assuming Python is not a framework installation if it lacks the MacOS
> module).
Are there more implications? I always thought framework build just
means to put it in /Library/Framworks/Python.framework.
Friedrich
From: Eric F. <ef...@ha...> - 2010年08月10日 21:21:37
On 08/10/2010 10:27 AM, Friedrich Romstedt wrote:
> Ah, the list config got me ... (resending to list)
>
> 2010年8月10日 Benjamin Root<ben...@ou...>:
>> I am working on a function that can take a Colormap object and return a
>> grayscale form of it. Ideally, I would like to return the same type of
>> Colormap that was provided, but I am wondering if this is necessary. I
>> supposed it is sufficient to just create a LinearSegmentedColormap from the
>> self._lut data?
>>
>> The problem I see with that approach is that there is still possibly some
>> information loss, particularly with the alpha part of the rgba data.
>> LinearSegmentedColormap has a .from_list() function, but it uses only the
>> rgb part of the rgba array and does not take alpha data.
>>
>> Is the inability of setting alpha a problem? Or maybe I should use
>> deepcopy() instead?
>
> If you mean me, I really don't know, but I think it is always better
> to do things
> properly than to publish something done with the attitute "just
> working" ....
>
> So I think it is probably best to code it into the Colormap object
> itself, so that each and ever derived class can define its own method
> of how to create a greyscale version. What do you think about that?
Good idea. The base class could define a default to_grayscale() method 
that would do the conversion near the very end of the Colormap.__call__ 
method if an as_gray attribute, also defined in the base class, is True. 
 No need for getters and setters--let it be a simple attribute. This 
is much simpler than generating a whole new colormap--instead, just set 
an attribute to switch an existing colormap to gray or back to color. I 
would leave the switch out of the __init__ args and kwargs. If someone 
wants grey, they can add one more line of code to set the attribute. I 
suspect only a small fraction of users will need this.
If people really are going to want to fiddle with the conversion 
function, then the scheme above could easily be extended by allowing the 
as_gray attribute to be a callable; if it is a callable, then 
to_grayscale() would use it instead of the default function.
Eric
>
> Friedrich
>
From: Friedrich R. <fri...@gm...> - 2010年08月10日 20:27:20
Ah, the list config got me ... (resending to list)
2010年8月10日 Benjamin Root <ben...@ou...>:
> I am working on a function that can take a Colormap object and return a
> grayscale form of it. Ideally, I would like to return the same type of
> Colormap that was provided, but I am wondering if this is necessary. I
> supposed it is sufficient to just create a LinearSegmentedColormap from the
> self._lut data?
>
> The problem I see with that approach is that there is still possibly some
> information loss, particularly with the alpha part of the rgba data.
> LinearSegmentedColormap has a .from_list() function, but it uses only the
> rgb part of the rgba array and does not take alpha data.
>
> Is the inability of setting alpha a problem? Or maybe I should use
> deepcopy() instead?
If you mean me, I really don't know, but I think it is always better
to do things
properly than to publish something done with the attitute "just
working" ....
So I think it is probably best to code it into the Colormap object
itself, so that each and ever derived class can define its own method
of how to create a greyscale version. What do you think about that?
Friedrich
From: Derek H. <de...@as...> - 2010年08月10日 11:41:33
Attachments: MacOS-64bit.patch
Hi again, cc'ing the matplotlib list this time,
for the latter: when building matplotlib against a fink-installed 
python compiled in 64bit mode
I found the check for a framework-installed Python (rev 8365) fails, 
and matplotlib fails to load,
because the MacOS module is not available in 64bit. Actually Apple 
seems to have made it
still available in their system Python, but it's likely to be a 
general problem on 64bit OS X installations,
and will be for python3 as well.
>>
>> I believe I have fixed the patch file issue that came from an 
>> accidental edit of
>> the patch file (off by 1 space character). For the issues below, 
>> can you give
>> me some examples that show the behavior that is broken now, but 
>> fixed into your
>> updated patch? I haven't used matplotlib in a long time.
>
>
> thanks, the fixed patch in unstable compiles and runs now.
> Sorry for the late reply; I found that the issue that my extra patch 
> addressed
> actually only seems to exist for x86_64 on Snow Leopard.
> It is in fact not directly related to python being built as a 
> framework, but the
> "import MacOS" used to check for the framework version fails, since 
> the
> MacOS module is not available in 64bit. Or so the python docs state, 
> but Apple
> seems to have retrofitted it somehow into their system python, so my 
> test for
> "import MacOS" worked with /usr/bin/python even on Snow Leopard.
>
> So the test for MacOS.WMAvailable() that my patch removed can 
> obviously stay
> there for 32bit installations, and it would probably be better to 
> just catch the
> import error on 64bit systems. I'll try to work something out along 
> those lines,
> and probably send it upstream to the matplotlib folks as well, since 
> this should
> be a general problem on 64bit systems; and also the MacOS module is 
> going
> to be removed altogether in python3.x. I'll keep you posted.
>
I've put the import inside the check now and have it print the warning 
in both cases
(assuming Python is not a framework installation if it lacks the MacOS 
module).
I don't know if there might be an alternative way to check for the 
framework property
for later, and I just picked an error to raise that seemed sensible - 
feel free to change
that as necessary.
Cheers,
							Derek
From: Benjamin R. <ben...@ou...> - 2010年08月10日 01:29:27
On Mon, Aug 9, 2010 at 3:40 PM, Friedrich Romstedt <
fri...@gm...> wrote:
> 2010年8月6日 Benjamin Root <ben...@ou...>:
> > Actually, I have been looking at a somewhat related problem. It might be
> a
> > useful feature in matplotlib.color to provide a function that can take a
> > colormap and produce a grayscale version of it. In my limited amount of
> > research, I have found that one could convert the rgb values into hsv or
> hsl
> > and use the "value" or "lightness" respectively for the grayscale value.
> I
> > forget which one was aesthetically better, though.
>
> http://www.pythonware.com/library/pil/handbook/image.htm :
>
> "When from a colour image to black and white, the library uses the
> ITU-R 601-2 luma transform:
>
> L = R * 299/1000 + G * 587/1000 + B * 114/1000
> "
>
> That should also be easy to implement.
>
> Friedrich
>
I am working on a function that can take a Colormap object and return a
grayscale form of it. Ideally, I would like to return the same type of
Colormap that was provided, but I am wondering if this is necessary. I
supposed it is sufficient to just create a LinearSegmentedColormap from the
self._lut data?
The problem I see with that approach is that there is still possibly some
information loss, particularly with the alpha part of the rgba data.
LinearSegmentedColormap has a .from_list() function, but it uses only the
rgb part of the rgba array and does not take alpha data.
Is the inability of setting alpha a problem? Or maybe I should use
deepcopy() instead?
Thanks,
Ben Root

Showing 8 results of 8

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