You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
| 2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
| 2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
| 2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
| 2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
| 2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
| 2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
| 2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
| 2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
| 2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
| 2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
| 2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
| 2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
| 2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
1
(2) |
2
(3) |
3
|
|
4
(3) |
5
(11) |
6
(3) |
7
(2) |
8
(6) |
9
(6) |
10
(8) |
|
11
(3) |
12
(7) |
13
(8) |
14
(5) |
15
(11) |
16
(11) |
17
(3) |
|
18
(2) |
19
(7) |
20
(11) |
21
(6) |
22
(5) |
23
(1) |
24
|
|
25
|
26
(6) |
27
(3) |
28
(8) |
29
(2) |
30
(1) |
|
|
From: Chao Y. <cha...@gm...> - 2012-11-10 16:37:27
|
Thanks, I think cbar.ax.invert_yaxis() is what I am looking for. Chao On Sat, Nov 10, 2012 at 4:51 PM, Damon McDougall <dam...@gm...>wrote: > On Sat, Nov 10, 2012 at 9:41 AM, Paul Hobson <pmh...@gm...> wrote: > > On Sat, Nov 10, 2012 at 7:07 AM, Chao YUE <cha...@gm...> wrote: > >> > >> Dear all, > >> > >> Is there a way to reverse the colorbar label, the default is small > value at the bottom and big value at the top, yet I would like the big > value at the bottom and small value at the top. > >> > >> all code in pylab mode. > >> > >> import numpy as np > >> import matplotlib as mat > >> > >> a = np.arange(100).reshape(10,10) > >> contourf(a,levels=np.arange(0,101,10)) > >> colorbar() > >> > >> in the above figure, colorbar label shows 0 at the bottom and 100 at > the top. > >> Yet I want the 0 at the top and the 100 at the bottom, with the same > sequence of colors in the colorbar. > >> > >> One way is to reverse the cmap, and then reverse the colorbar labels at > the same time: > >> a = np.arange(100).reshape(10,10) > >> contourf(a,levels=np.arange(0,101,10),cmap=mat.cm.jet_r) > >> cbar = colorbar() > >> cbar.set_ticks(np.arange(0,101,10)) > >> cbar.set_ticklabels(np.arange(100,-1,-10)) > > > > Chao, > > > > I think it's as simple as: > > > > import numpy as np > > import matplotlib.pyplot as plt > > > > a = np.arange(100).reshape(10,10) > > fig, ax1 = plt.subplots() > > CS = ax1.contourf(a,levels=np.arange(0,101,10)) > > cbar = plt.colorbar(CS) > > cbar.ax.invert_yaxis() > > > > Does that produce the desired results? > > -p > > Or, you could plot -a instead of a. > > -- > Damon McDougall > http://www.damon-is-a-geek.com > Institute for Computational Engineering Sciences > 201 E. 24th St. > Stop C0200 > The University of Texas at Austin > Austin, TX 78712-1229 > -- *********************************************************************************** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 ************************************************************************************ |
|
From: Chao Y. <cha...@gm...> - 2012-11-10 16:36:14
|
Thanks a lot Paul. Oh, I even didn't think about the second point raised by you. but it would be great to have. The main point is the first point raised by you, I just didn't know how to put the label (in the example figure it's value range) exactly beside the colorbar. In the attached figure you can see the labels (here the label is a number) are put at the place of connection interface of two different colors but not beside the colorbar. like for the first top blue block, I would like to have 0-10 beside it, but not to put 0 at the top and 10 at the bottom. I hope I am clear. The code that generate attached figure is here: a = np.arange(100).reshape(10,10) contourf(a,levels=np.arange(0, 101,10)) cbar = colorbar() cbar.set_ticks(np.arange(0,101,10)) cbar.set_ticklabels(np.arange(0,101,10)) could you please indicate how can I have the first and second points raised by you? thanks a lot! Chao On Sat, Nov 10, 2012 at 4:53 PM, Paul Hobson <pmh...@gm...> wrote: > On Sat, Nov 10, 2012 at 6:25 AM, Chao YUE <cha...@gm...> wrote: > > Dear all, > > > > In the colorbar label for contourf or imshow plot, I want the effect like > > that in the attached figure. Is there some way to move the position of > > colorbar label? could someone give any hints? > > > Chao, > > It's not clear what you mean. What's distinctive about the image you > attached? Is it: > - The ranges of values listed to the side? > - The discrete blocks for each value range? > - The units being listed above the colorbar? > > I think I can help you do any of those things. I just need to know > what you're specifically trying to do. > -paul > -- *********************************************************************************** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 ************************************************************************************ |
|
From: Paul H. <pmh...@gm...> - 2012-11-10 15:53:38
|
On Sat, Nov 10, 2012 at 6:25 AM, Chao YUE <cha...@gm...> wrote: > Dear all, > > In the colorbar label for contourf or imshow plot, I want the effect like > that in the attached figure. Is there some way to move the position of > colorbar label? could someone give any hints? Chao, It's not clear what you mean. What's distinctive about the image you attached? Is it: - The ranges of values listed to the side? - The discrete blocks for each value range? - The units being listed above the colorbar? I think I can help you do any of those things. I just need to know what you're specifically trying to do. -paul |
|
From: Damon M. <dam...@gm...> - 2012-11-10 15:51:12
|
On Sat, Nov 10, 2012 at 9:41 AM, Paul Hobson <pmh...@gm...> wrote: > On Sat, Nov 10, 2012 at 7:07 AM, Chao YUE <cha...@gm...> wrote: >> >> Dear all, >> >> Is there a way to reverse the colorbar label, the default is small value at the bottom and big value at the top, yet I would like the big value at the bottom and small value at the top. >> >> all code in pylab mode. >> >> import numpy as np >> import matplotlib as mat >> >> a = np.arange(100).reshape(10,10) >> contourf(a,levels=np.arange(0,101,10)) >> colorbar() >> >> in the above figure, colorbar label shows 0 at the bottom and 100 at the top. >> Yet I want the 0 at the top and the 100 at the bottom, with the same sequence of colors in the colorbar. >> >> One way is to reverse the cmap, and then reverse the colorbar labels at the same time: >> a = np.arange(100).reshape(10,10) >> contourf(a,levels=np.arange(0,101,10),cmap=mat.cm.jet_r) >> cbar = colorbar() >> cbar.set_ticks(np.arange(0,101,10)) >> cbar.set_ticklabels(np.arange(100,-1,-10)) > > Chao, > > I think it's as simple as: > > import numpy as np > import matplotlib.pyplot as plt > > a = np.arange(100).reshape(10,10) > fig, ax1 = plt.subplots() > CS = ax1.contourf(a,levels=np.arange(0,101,10)) > cbar = plt.colorbar(CS) > cbar.ax.invert_yaxis() > > Does that produce the desired results? > -p Or, you could plot -a instead of a. -- Damon McDougall http://www.damon-is-a-geek.com Institute for Computational Engineering Sciences 201 E. 24th St. Stop C0200 The University of Texas at Austin Austin, TX 78712-1229 |
|
From: Paul H. <pmh...@gm...> - 2012-11-10 15:41:09
|
On Sat, Nov 10, 2012 at 7:07 AM, Chao YUE <cha...@gm...> wrote: > > Dear all, > > Is there a way to reverse the colorbar label, the default is small value at the bottom and big value at the top, yet I would like the big value at the bottom and small value at the top. > > all code in pylab mode. > > import numpy as np > import matplotlib as mat > > a = np.arange(100).reshape(10,10) > contourf(a,levels=np.arange(0,101,10)) > colorbar() > > in the above figure, colorbar label shows 0 at the bottom and 100 at the top. > Yet I want the 0 at the top and the 100 at the bottom, with the same sequence of colors in the colorbar. > > One way is to reverse the cmap, and then reverse the colorbar labels at the same time: > a = np.arange(100).reshape(10,10) > contourf(a,levels=np.arange(0,101,10),cmap=mat.cm.jet_r) > cbar = colorbar() > cbar.set_ticks(np.arange(0,101,10)) > cbar.set_ticklabels(np.arange(100,-1,-10)) Chao, I think it's as simple as: import numpy as np import matplotlib.pyplot as plt a = np.arange(100).reshape(10,10) fig, ax1 = plt.subplots() CS = ax1.contourf(a,levels=np.arange(0,101,10)) cbar = plt.colorbar(CS) cbar.ax.invert_yaxis() Does that produce the desired results? -p |
|
From: ChaoYue <cha...@gm...> - 2012-11-10 15:17:05
|
Hi, I once was indicated a way to extract colors from exsiting colormaps: I just answered a question on Stackoverflow and maybe you can have a look. all code in pylab mode a = np.arange(100).reshape(10,10) #here is the image with white and black end imshow(a,cmap=mat.cm.binary) colorbar() #we extract only the 0.2-->0.7 part of original colormap and make a new one #so that the white and black end are removed rgba_array = mat.cm.binary(np.linspace(0,1,num=10,endpoint=True)) extract_rgba_array_255 = rgba_array[2:8,0:3] imshow(a,cmap=mat.colors.ListedColormap(extract_rgba_array_255)) colorbar() cheers, Chao -- View this message in context: http://matplotlib.1069221.n5.nabble.com/colormap-shift-tp39660p39707.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Chao Y. <cha...@gm...> - 2012-11-10 15:07:42
|
Dear all, Is there a way to reverse the colorbar label, the default is small value at the bottom and big value at the top, yet I would like the big value at the bottom and small value at the top. all code in pylab mode. import numpy as np import matplotlib as mat a = np.arange(100).reshape(10,10) contourf(a,levels=np.arange(0,101,10)) colorbar() in the above figure, colorbar label shows 0 at the bottom and 100 at the top. Yet I want the 0 at the top and the 100 at the bottom, with the same sequence of colors in the colorbar. One way is to reverse the cmap, and then reverse the colorbar labels at the same time: a = np.arange(100).reshape(10,10) contourf(a,levels=np.arange(0,101,10),cmap=mat.cm.jet_r) cbar = colorbar() cbar.set_ticks(np.arange(0,101,10)) cbar.set_ticklabels(np.arange(100,-1,-10)) But the problem is, sometimes I used the customized colormap, and to increase the contrast, I do linear transformation for the data before I plot them. The the data that are really used for plotting are not the same. But in the colorbar label, I used the values before transformation. Is this complicated case, reverse the customized colormap could not solve the problem (unlike in the simple example above.) Does anyone have the same experience? Thanks et cheers, Chao -- *********************************************************************************** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 ************************************************************************************ |
|
From: Chao Y. <cha...@gm...> - 2012-11-10 14:25:34
|
Dear all, In the colorbar label for contourf or imshow plot, I want the effect like that in the attached figure. Is there some way to move the position of colorbar label? could someone give any hints? Thanks! Chao -- *********************************************************************************** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 ************************************************************************************ |
|
From: Michael D. <md...@st...> - 2012-11-09 13:51:11
|
Ah, I solved this by providing a URL to the github download, rather than trying to upload to PyPI. It's possible (I suppose) there is a file size limit on PyPI. "pip install matplotlib" now "works for me (TM)". Please let me know if it's still not working for you. Mike On 11/09/2012 08:44 AM, Michael Droettboom wrote: > Sorry about that. I tried this yesterday, and didn't notice that the > upload failed. > > Both the webform and the `setup.py upload` is still failing for me. > I'm posting the traceback below in case anyone has any thoughts -- in > the meantime I'll search/ask around the PyPI world. > > Mike > > Traceback (most recent call last): > File "setup.py", line 333, in <module> > **additional_params > File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup > dist.run_commands() > File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands > self.run_command(cmd) > File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command > cmd_obj.run() > File "/usr/lib64/python2.7/distutils/command/upload.py", line 60, in run > self.upload_file(command, pyversion, filename) > File "/usr/lib64/python2.7/distutils/command/upload.py", line 176, > in upload_file > result = urlopen(request) > File "/usr/lib64/python2.7/urllib2.py", line 126, in urlopen > return _opener.open(url, data, timeout) > File "/usr/lib64/python2.7/urllib2.py", line 400, in open > response = self._open(req, data) > File "/usr/lib64/python2.7/urllib2.py", line 418, in _open > '_open', req) > File "/usr/lib64/python2.7/urllib2.py", line 378, in _call_chain > result = func(*args) > File "/usr/lib64/python2.7/urllib2.py", line 1207, in http_open > return self.do_open(httplib.HTTPConnection, req) > File "/usr/lib64/python2.7/urllib2.py", line 1177, in do_open > raise URLError(err) > urllib2.URLError: <urlopen error [Errno 104] Connection reset by peer> > > > On 11/09/2012 08:11 AM, Ludwig Schwardt wrote: >> Excellent! >> >> I notice that the PyPI page has not been updated yet for poor sods >> like me... >> >> Regards, >> Ludwig >> >> >> >> ------------------------------------------------------------------------------ >> 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 >> Mat...@li... >> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Michael D. <md...@st...> - 2012-11-09 13:45:04
|
Sorry about that. I tried this yesterday, and didn't notice that the
upload failed.
Both the webform and the `setup.py upload` is still failing for me. I'm
posting the traceback below in case anyone has any thoughts -- in the
meantime I'll search/ask around the PyPI world.
Mike
Traceback (most recent call last):
File "setup.py", line 333, in <module>
**additional_params
File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib64/python2.7/distutils/command/upload.py", line 60, in run
self.upload_file(command, pyversion, filename)
File "/usr/lib64/python2.7/distutils/command/upload.py", line 176, in
upload_file
result = urlopen(request)
File "/usr/lib64/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib64/python2.7/urllib2.py", line 400, in open
response = self._open(req, data)
File "/usr/lib64/python2.7/urllib2.py", line 418, in _open
'_open', req)
File "/usr/lib64/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 1207, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib64/python2.7/urllib2.py", line 1177, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 104] Connection reset by peer>
On 11/09/2012 08:11 AM, Ludwig Schwardt wrote:
> Excellent!
>
> I notice that the PyPI page has not been updated yet for poor sods
> like me...
>
> Regards,
> Ludwig
>
>
>
> ------------------------------------------------------------------------------
> 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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Ludwig S. <lud...@gm...> - 2012-11-09 13:11:34
|
Excellent! I notice that the PyPI page has not been updated yet for poor sods like me… Regards, Ludwig |
|
From: Alexey S. <sh...@gm...> - 2012-11-09 11:20:33
|
Thank you for 1.2.0 release! Could you please make it clear that matplotlib requires python.org-Python sourceforge.net-NumPy? Telling about it during installation would be great. I've lost an hour trying to figure out why matplotlib installer [1] doesn't let me choose my system HD, saying "matplotlib requires System Python 2.7 to install". Figuring out the correct NumPy version was also confusing. First I made a mistake by install numpy via system `easy_install`: $ easy_install numpy Ooops, wrong numpy. Let's download and install official NumPy [2]: $ /usr/local/bin/python -c "import pylab" RuntimeError: module compiled against API version 6 but this version of numpy is 4 ... ImportError: numpy.core.multiarray failed to import Hmm, it still tries to use wrong numpy. Let's remove it: $ /usr/local/bin/python -c "import numpy; print numpy.__file__" /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/__init__.py $ sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy Hooray: $ /usr/local/bin/python -c "import pylab" [1]: https://github.com/downloads/matplotlib/matplotlib/matplotlib-1.2.0-py2.7-python.org-macosx10.6.dmg [2]: http://sourceforge.net/projects/numpy/files/NumPy/1.6.2/numpy-1.6.2-py2.7-python.org-macosx10.6.dmg/download -- Alexey On Fri, Nov 9, 2012 at 4:57 AM, Michael Droettboom <md...@st...> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: klo uo <kl...@gm...> - 2012-11-09 01:50:20
|
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 <md...@st...> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Michael D. <md...@st...> - 2012-11-09 00:57:17
|
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 |
|
From: Sebastian R. <seb...@gm...> - 2012-11-08 15:23:48
|
Hi guys,
I have a problem with the "set_array" function. In a example from the
matplotlib homepage this works fine, but when I tries to adaot to my needs,
the image just stays the same. No Update, but also no error messages:
see On Timer function --> the plot is just created during the start but
never updated again. If I use imshow all the time, it works, but my
intention was not to use imshow allover, just update the image data.
Any ideas?
Cheers,
Sebi
Here is the code:
#!/usr/bin/env python
"""
"""
import sys, time, os, gc
import matplotlib
matplotlib.use('WXAgg')
from matplotlib import rcParams
import matplotlib.cm as cm
import numpy as np
import optparse
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.figure import Figure
from wx import *
TIMER_ID = NewId()
class PlotFigure(Frame):
def __init__(self):
Frame.__init__(self, None, -1, "Test embedded wxFigure")
self.fig = Figure((8,6), 100)
self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
self.toolbar = NavigationToolbar2Wx(self.canvas)
self.toolbar.Realize()
# On Windows, default frame size behaviour is incorrect
# you don't need this under Linux
tw, th = self.toolbar.GetSizeTuple()
fw, fh = self.canvas.GetSizeTuple()
self.toolbar.SetSize(Size(fw, th))
# Create a figure manager to manage things
# Now put all into a sizer
sizer = BoxSizer(VERTICAL)
# This way of adding to sizer allows resizing
sizer.Add(self.canvas, 1, LEFT|TOP|GROW)
# Best to allow the toolbar to resize!
sizer.Add(self.toolbar, 0, GROW)
self.SetSizer(sizer)
self.Fit()
EVT_TIMER(self, TIMER_ID, self.onTimer)
def init_plot_data(self):
# initialize data array and plot for the 1st time
self.data = np.zeros([96])
# create matrix which will contain the number of counted cells
well96 = np.zeros([8,12])
# read in cell numbers
#Nr = 8 # number of rows
#Nc = 12 # number of columns
#labelx = ['1','2','3','4','5','6','7','8','9','10','11','12']
#labely = ['A','B','C','D','E','F','G','H']
ax1 = self.fig.add_axes([0.075,0.1,0.75,0.85])
self.cax = self.fig.add_axes([0.85,0.1,0.075,0.85])
self.im = ax1.imshow(well96, cmap=cm.jet, interpolation='nearest')
self.fig.colorbar(self.im, cax=self.cax, orientation='vertical')
#self.ax1.set_xticks(np.arange(0,12,1))
#self.ax1.set_xticklabels(labelx)
#self.ax1.set_yticks(np.arange(0,8,1))
#self.ax1.set_yticklabels(labely)
#self.ax1.set_title('Cell Count per Well')
def GetToolBar(self):
# You will need to override GetToolBar if you are using an
# unmanaged toolbar in your frame
return self.toolbar
def onTimer(self, evt):
datain = np.loadtxt(options.filename, delimiter=';')
self.data[0:len(datain[:,1])] = datain[:,1]
welldata = self.data.reshape(8,12)
print welldata
self.im.set_array(welldata)
#self.im = self.ax1.imshow(welldata, cmap=cm.jet, interpolation='nearest')
self.fig.colorbar(self.im, cax=self.cax,orientation='vertical')
self.canvas.draw()
def onEraseBackground(self, evt):
# this is supposed to prevent redraw flicker on some X servers...
pass
if __name__ == '__main__':
# configure parsing option for command line usage
parser = optparse.OptionParser()
parser.add_option('-f', '--file',
action="store", dest="filename",
help="query string", default="spam")
# read command line arguments
options, args = parser.parse_args()
print 'Filename:', options.filename
app = PySimpleApp()
frame = PlotFigure()
frame.init_plot_data()
# Initialise the timer - wxPython requires this to be connected to
# the receiving event handler
t = Timer(frame, TIMER_ID)
t.Start(1000)
frame.Show()
app.MainLoop()
|
|
From: Damon M. <dam...@gm...> - 2012-11-08 13:44:11
|
On Thursday, November 8, 2012, Alejandro Weinstein wrote: > If you are in a Linux machine, you can use `inotify`: "Inotify (inode > notify) is a Linux kernel subsystem that acts to extend filesystems to > notice changes to the filesystem". > > It seems that there are a few option to use this from Python: > > http://pyinotify.sourceforge.net/ > http://code.activestate.com/recipes/576375-low-level-inotify-wrapper/ > > Alejandro. > > On Thu, Nov 8, 2012 at 1:34 AM, Sebastian Rhode <seb...@gm...<javascript:;>> > wrote: > > Hi, > > > > I have a textfile where every second a line is written. Usually the look > > like this: > > > > 1; 124; 455 > > > > a second later > > > > 1; 124; 455 > > 2; 104; 600 > > > > ... > > > > Finally such a file is quite easy to plot using matplotlib. But what > would > > be very useful for me is a script, that is watching the TXT file and > updates > > the plot when a new row "arrives". Any good ideas? > > > > Cheers, > > > > Sebi > > > > > > > ------------------------------------------------------------------------------ > > 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 > > Mat...@li... <javascript:;> > > 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 > Mat...@li... <javascript:;> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > In bash: watch -n1 tail file.txt -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom |
|
From: Alejandro W. <ale...@gm...> - 2012-11-08 13:23:21
|
If you are in a Linux machine, you can use `inotify`: "Inotify (inode notify) is a Linux kernel subsystem that acts to extend filesystems to notice changes to the filesystem". It seems that there are a few option to use this from Python: http://pyinotify.sourceforge.net/ http://code.activestate.com/recipes/576375-low-level-inotify-wrapper/ Alejandro. On Thu, Nov 8, 2012 at 1:34 AM, Sebastian Rhode <seb...@gm...> wrote: > Hi, > > I have a textfile where every second a line is written. Usually the look > like this: > > 1; 124; 455 > > a second later > > 1; 124; 455 > 2; 104; 600 > > ... > > Finally such a file is quite easy to plot using matplotlib. But what would > be very useful for me is a script, that is watching the TXT file and updates > the plot when a new row "arrives". Any good ideas? > > Cheers, > > Sebi > > > ------------------------------------------------------------------------------ > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Miha P. <mp...@gm...> - 2012-11-08 08:48:59
|
Hi,
You could use the time module.
import time
while 1:
time.sleep(5) # freezes for 5 s
update plot
This should be less CPU consuming ...
lpmp
On Thu, Nov 8, 2012 at 9:41 AM, francesco oteri
<fra...@gm...>wrote:
> Hi,
> what about opening-closing the file every now and then, for example every
> 5seconds?
> you can do it using the function time(). It gives you the amount of time
> since I don't kno when,
> but you can count how many seconds are left using:
>
> a=time()
> while 1:
> b=time()
> left= b-a
> if left == 5sec:
> updating plot
>
> Actually is very cpu consuming, but it is the best I can propose :(
>
>
> Francesco
>
>
>
> 2012/11/8 Sebastian Rhode <seb...@gm...>
>
>> Hi,
>>
>> I have a textfile where every second a line is written. Usually the look
>> like this:
>>
>> 1; 124; 455
>>
>> a second later
>>
>> 1; 124; 455
>> 2; 104; 600
>>
>> ...
>>
>> Finally such a file is quite easy to plot using matplotlib. But what
>> would be very useful for me is a script, that is watching the TXT file and
>> updates the plot when a new row "arrives". Any good ideas?
>>
>> Cheers,
>>
>> Sebi
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
> --
> Cordiali saluti, Dr.Oteri Francesco
>
>
> ------------------------------------------------------------------------------
> 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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
|
|
From: francesco o. <fra...@gm...> - 2012-11-08 08:41:58
|
Hi,
what about opening-closing the file every now and then, for example every
5seconds?
you can do it using the function time(). It gives you the amount of time
since I don't kno when,
but you can count how many seconds are left using:
a=time()
while 1:
b=time()
left= b-a
if left == 5sec:
updating plot
Actually is very cpu consuming, but it is the best I can propose :(
Francesco
2012/11/8 Sebastian Rhode <seb...@gm...>
> Hi,
>
> I have a textfile where every second a line is written. Usually the look
> like this:
>
> 1; 124; 455
>
> a second later
>
> 1; 124; 455
> 2; 104; 600
>
> ...
>
> Finally such a file is quite easy to plot using matplotlib. But what would
> be very useful for me is a script, that is watching the TXT file and
> updates the plot when a new row "arrives". Any good ideas?
>
> Cheers,
>
> Sebi
>
>
>
> ------------------------------------------------------------------------------
> 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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Cordiali saluti, Dr.Oteri Francesco
|
|
From: Sebastian R. <seb...@gm...> - 2012-11-08 08:35:30
|
Hi, I have a textfile where every second a line is written. Usually the look like this: 1; 124; 455 a second later 1; 124; 455 2; 104; 600 ... Finally such a file is quite easy to plot using matplotlib. But what would be very useful for me is a script, that is watching the TXT file and updates the plot when a new row "arrives". Any good ideas? Cheers, Sebi |
|
From: Chloe L. <ch...@be...> - 2012-11-07 17:34:47
|
> > I think a histogram isn't the thing I need because it is not important > when (the time) the values between 60 and 90 have been "created". Only > the values and the amount of values is important. You can make the values the independent axis of the histogram. > > Also when talking about a colormap I'm not sure if this is required. In > the end I want only one color (blue) in a rectangle that changes the > color/appearance based on the density. So I guess to bluescale it is the > right way as you suggested. > I think custom blue scale can only be done as a custom colormap; but R and G will be constant throughout. &C |
|
From: <ra...@0x...> - 2012-11-07 13:26:24
|
Hi! I think a histogram isn't the thing I need because it is not important when (the time) the values between 60 and 90 have been "created". Only the values and the amount of values is important. Also when talking about a colormap I'm not sure if this is required. In the end I want only one color (blue) in a rectangle that changes the color/appearance based on the density. So I guess to bluescale it is the right way as you suggested. And as you said, the min density value would be 60 and the max density value would be 90. I think I will make those values fix. As you told the "colorbar" might not mean the same on a later time. This is no problem and basically the goal of it. Cool, I guess this is the concept to be implemented. I'm searching for ways to bluescale with matplotlib.. I have hacked a little code snipped. I think it does what I desire, except of one thing left. Some of the little "elements" I draw do overlap and I dont know why. I print the values to plot on the x-axis to the console. As you see the x-coordinates do not overlap.. Does anyone know what the problem is? from matplotlib.ticker import MultipleLocator import numpy as np import matplotlib.pyplot as plt import random import array from pylab import gca # Source: http://stackoverflow.com/questions/8500700/how-to-plot-a-gradient-color-line-in-matplotlib #CONSTANTS NPOINTS = 100 COLOR='blue' RESFACT=10 MAP='winter' # choose carefully, or color transitions will not appear smooth FIGRES=111.0 # figure size: must be float! # create random data np.random.seed() x = [] tmp = 0 while tmp < NPOINTS: x.append(random.randrange(60, 98, 1)) tmp = tmp+1 fake_y_array = np.array([0]) a = 0 while a < NPOINTS-1: fake_y_array = np.append(fake_y_array, 0) a = a+1 y = fake_y_array x = sorted(x) #print x fig = plt.figure() ax4 = fig.add_subplot(FIGRES) # high resolution alpha npointsHiRes = len(x) stats = dict() for index in x: #stats.insert(index, stats[index] + 1) try: stats[index] = stats[index] + 1 except: stats[index] = 1 print stats # alpha is the transparency parameter # based on the more values we have, the smaller is the # difference between transparency per element in the graph # we multiply this alpha with a given factor to make the elements # appear visible enough for the human eye alpha_steps = (1.0/len(stats))*1 for i in range(npointsHiRes): #print 'x: ' + str(x[i]) #print 'stats: ' + str(stats[x[i]]) + ' (a) ' + str(alpha_steps*stats[x[i]]) if x[i] is x[i-1]: # skip this round because we already # have drawn one element # and based on its transparency # it is expressed how many times this # value exists continue ytmp = y[i:i+2] xtmp = x[i:i+2] try: if xtmp[0] is xtmp[1]: # ok if they equal, we cannot draw a visible line # +1 to draw it.. xtmp[1] = xtmp[1]+1 except IndexError: # last element is sometimes "alone" # so we add an effectively last one # to draw it with eye-visibility xtmp.append(xtmp[0]+1) a = np.array([0]) ytmp = np.hstack((ytmp, a)) ax4.plot(xtmp,ytmp, alpha=alpha_steps*stats[x[i]], color=COLOR, lw=100) #drawstyle: [ 'default' | 'steps' | 'steps-pre' | 'steps-mid' | 'steps-post' ] ax4.set_xlim(min(x),max(x)+1) gca().xaxis.set_major_locator(MultipleLocator((round(len(x)/FIGRES))*2)) gca().yaxis.set_major_locator(MultipleLocator()) plt.grid(True) #fig.savefig('gradColorLine.png') plt.show() On 11/06/2012 01:25 AM, Chloe Lewis wrote: > You're translating a histogram of your data into a colormap, yes? > > The matplotlib histogram returns bins and patches, which you could translate into color intensities; but I bet scipy.stats.histogram would be easier. Then the bin centers are the segment boundaries of the colormap, and the weight in each bin is the respective color intensity. > > Also, color has a finite extent but the bin weight might not. You'll need to choose a nominal max value to norm the colors to, and decide whether to use the same max value all the time (so early plots might all be light, late plots all dark) or calculate it from the data each time you plot (in which case the colorbar this month might not mean the same thing as the color bar last month). > > I think using all three of RGB is too confusing -- do it bluescale or grayscale. > > &C > > > > > On Nov 5, 2012, at 7:13 AM, ra...@0x... wrote: > >> Hi Chloe >> >> Thank you for answering. >> >> I agree the way you suggest. Currently I have done this: >> >> import matplotlib >> import matplotlib.pyplot as plt >> >> # http://matplotlib.org/examples/api/colorbar_only.html >> # >> http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap >> >> >> # The lookup table is generated using linear interpolation for each >> primary color, with the 0-1 domain divided into any number of segments. >> # x, y0, y1 >> cdict = {'red': [(0.0, 0.0, 0.0), >> (0.5, 1.0, 1.0), >> (1.0, 1.0, 1.0)], >> >> 'green': [(0.0, 0.0, 0.0), >> (0.25, 0.0, 0.0), >> (0.75, 1.0, 1.0), >> (1.0, 1.0, 1.0)], >> >> 'blue': [(0.0, 0.0, 0.0), >> (0.5, 0.0, 0.0), >> (1.0, 1.0, 1.0)]} >> >> # create colormap >> my_cmap = matplotlib.colors.LinearSegmentedColormap("my_colormap", >> cdict, N=256, gamma=1.0) >> >> # optional: register colormap >> #plt.register_cmap(name='my_colormap', data=cdict) >> >> fig = plt.figure(figsize=(5,1)) >> fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) >> plt.axis("off") >> import numpy as np >> a = np.linspace(0, 1, 256).reshape(1,-1) >> a = np.vstack((a,a)) >> plt.imshow(a, aspect='auto', cmap=my_cmap, origin='lower') >> >> plt.show() >> >> Now the tricky part has still to be done. I have a varying number (ca. >> 500, increasing) of values between 60 and 90. Those values must be >> represented in the colorbar. White if there is no value, blue towards >> black the more values are in the same area. >> For this, I guess, I have to set a x for each value (and three x since >> the color is calculated using RGB). And the closer it is to the previous >> one the more I have to calculate the color between blue and black. >> >> Or do you suggest another way to implement this? >> >> I do not know of any other software that this issue has been implemented. >> >> cheers! >> >> >> On 10/26/2012 07:47 PM, Chloe Lewis wrote: >>> you'll be doing something like the second color bar, but making the >>> boundary and color definitions a lot more flexible. Where the discrete >>> color bar uses >>> >>> cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) >>> bounds = [1, 2, 4, 7, 8] >>> >>> you'll be making a whole LinearSegmentedColormap, see >>> >>> http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap >>> >>> and check out specifically the ascii-art explanation of interpolation between row[i] and row[i+1]. Red, green, blue will break based on your data density and how you want to express 'intensity'. And depending on whether you'll make it red-green-colorblindness neutral! >>> >>> Interesting problem. Has it been implemented in some other software? >>> >>> >>> Chloe Lewis >>> PhD candidate, Harte Lab >>> Division of Ecosystem Sciences, ESPM >>> University of California, Berkeley >>> 137 Mulford Hall >>> Berkeley, CA 94720 >>> ch...@be... <mailto:ch...@be...> >>> > |
|
From: mpelko <mp...@gm...> - 2012-11-06 09:49:20
|
I would also love to have this implemented. That is being able to not only set the colors, but also the alpha values as an array. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/scatter-plot-individual-alpha-values-tp21106p39671.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Marian J. <mja...@ta...> - 2012-11-06 08:03:27
|
Thanks for your reply. It's really nice. But, can you provide the code
(part of it) where the colormap start from "very light gray" to "black"
in the range (0,1). And all of the points >1 are black one and =0.0 IS
NOT white. I have 2D map with defined pair (x,y) and the values for
them, but also there are the pairs where I defined the value out of
range (z=5.). So I would like to show the 2D map in grayscale ((x,y),z)
but use WHITE color for z=5. Because when I set "cm.set_over('white')"
and the white is also for z=0.0 (not shifted colormap), you can't
distinguish these values - if it is z=5 or z=0. Of course, the possible
way is to use rgb colormaps (not grayscale) but I can't do it because I
need BW version of the figure.
Thanks in advance for your help.
Dňa Mon, 5 Nov 2012 22:50:31 +0100
klo uo <kl...@gm...> napísal:
> 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.000000, 0.000000, 0.000000),
> (0.000001, 1.000000, 1.000000),
> (0.500000, 0.500000, 0.500000),
> (1.000000, 0.000000, 0.000000)
> ),
> 'green' : (
> (0.000000, 0.000000, 0.000000),
> (0.000001, 1.000000, 1.000000),
> (0.500000, 0.500000, 0.500000),
> (1.000000, 0.000000, 0.000000)
> ),
> 'blue' : (
> (0.000000, 0.000000, 0.000000),
> (0.000001, 1.000000, 1.000000),
> (0.500000, 0.500000, 0.500000),
> (1.000000, 0.000000, 0.000000)
> )
> }
>
> 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()
> ========================================
|
|
From: Chloe L. <ch...@be...> - 2012-11-06 00:25:14
|
You're translating a histogram of your data into a colormap, yes? The matplotlib histogram returns bins and patches, which you could translate into color intensities; but I bet scipy.stats.histogram would be easier. Then the bin centers are the segment boundaries of the colormap, and the weight in each bin is the respective color intensity. Also, color has a finite extent but the bin weight might not. You'll need to choose a nominal max value to norm the colors to, and decide whether to use the same max value all the time (so early plots might all be light, late plots all dark) or calculate it from the data each time you plot (in which case the colorbar this month might not mean the same thing as the color bar last month). I think using all three of RGB is too confusing -- do it bluescale or grayscale. &C On Nov 5, 2012, at 7:13 AM, ra...@0x... wrote: > Hi Chloe > > Thank you for answering. > > I agree the way you suggest. Currently I have done this: > > import matplotlib > import matplotlib.pyplot as plt > > # http://matplotlib.org/examples/api/colorbar_only.html > # > http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap > > > # The lookup table is generated using linear interpolation for each > primary color, with the 0-1 domain divided into any number of segments. > # x, y0, y1 > cdict = {'red': [(0.0, 0.0, 0.0), > (0.5, 1.0, 1.0), > (1.0, 1.0, 1.0)], > > 'green': [(0.0, 0.0, 0.0), > (0.25, 0.0, 0.0), > (0.75, 1.0, 1.0), > (1.0, 1.0, 1.0)], > > 'blue': [(0.0, 0.0, 0.0), > (0.5, 0.0, 0.0), > (1.0, 1.0, 1.0)]} > > # create colormap > my_cmap = matplotlib.colors.LinearSegmentedColormap("my_colormap", > cdict, N=256, gamma=1.0) > > # optional: register colormap > #plt.register_cmap(name='my_colormap', data=cdict) > > fig = plt.figure(figsize=(5,1)) > fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) > plt.axis("off") > import numpy as np > a = np.linspace(0, 1, 256).reshape(1,-1) > a = np.vstack((a,a)) > plt.imshow(a, aspect='auto', cmap=my_cmap, origin='lower') > > plt.show() > > Now the tricky part has still to be done. I have a varying number (ca. > 500, increasing) of values between 60 and 90. Those values must be > represented in the colorbar. White if there is no value, blue towards > black the more values are in the same area. > For this, I guess, I have to set a x for each value (and three x since > the color is calculated using RGB). And the closer it is to the previous > one the more I have to calculate the color between blue and black. > > Or do you suggest another way to implement this? > > I do not know of any other software that this issue has been implemented. > > cheers! > > > On 10/26/2012 07:47 PM, Chloe Lewis wrote: >> you'll be doing something like the second color bar, but making the >> boundary and color definitions a lot more flexible. Where the discrete >> color bar uses >> >> cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) >> bounds = [1, 2, 4, 7, 8] >> >> you'll be making a whole LinearSegmentedColormap, see >> >> http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap >> >> and check out specifically the ascii-art explanation of interpolation between row[i] and row[i+1]. Red, green, blue will break based on your data density and how you want to express 'intensity'. And depending on whether you'll make it red-green-colorblindness neutral! >> >> Interesting problem. Has it been implemented in some other software? >> >> >> Chloe Lewis >> PhD candidate, Harte Lab >> Division of Ecosystem Sciences, ESPM >> University of California, Berkeley >> 137 Mulford Hall >> Berkeley, CA 94720 >> ch...@be... <mailto:ch...@be...> >> |