Re: [Matplotlib-users] clean way to build subplots with sharex only on same colomn and sharey only on same row?
Hi Ben, I tried it. Installing the development version is much easier than I expect. and the subplots() function works very well as expect. it's too awesome. thanks a lot. cheers, Chao 2012/7/7 Benjamin Root ben.r...@ou.edu On Fri, Jul 6, 2012 at 5:39 PM, Chao YUE chaoyue...@gmail.com wrote: dear all, I want to build a 5X3 subplots matrix that I want the xaxis is shared only on the same column and yaxis shared only on the same row. While using plt.subplots(5,3,sharex=True, sharey=True) will put all subplots as both shared xaxis and yaxis. The other option is to do like this to create 2X2 subplots with desired feature, Yet I guess doing the same for 5X3 subplots could be tedious? Does anyone has some idea? fig=figure() ax1=fig.add_subplot(221) ax2=fig.add_subplot(222,sharey=ax1) ax3=fig.add_subplot(223,sharex=ax1) ax4=fig.add_subplot(224,sharex=ax2,sharey=ax3) Thanks a lot et cheers, Chao Chao, Such a feature is not in any of the current releases, (although it can be done manually, but it is tedious). However, in the development branch, the subplots() function now accepts strings of row, col, all, or none for both the sharex and sharey kwargs. So, for you, you can call subplots() with sharex=col and sharey=row to get what you want. This will also have a side-effect of having the y-tick labels show up only on the first column and the x-tick labels show up only on the last row. This is a new feature, so bug reports would be welcomed! Cheers! Ben Root -- *** 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 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] [matplotlib-users] How to plot digamma function (psi)
Hello everyone, I try to plot the digamma function of (1/2 + 1/x) but I'm not sure that I'm plotting the good one. I've tried: special.polygamma(0, (1/2 + 1/x)) and special.polygamma(1, (1/2 + 1/x)) but I don't have the same result as with mathcad. I've tried to code it like that: def F(x): return mpmath.diff(lambda x: gamma(1/2 + 1/x),1)/gamma(1/2 + 1/x) But It returns zero division error even when x is in ]0,1] Any idea? -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-users] How to plot digamma function (psi)
On Tue, Jul 10, 2012 at 12:27:59PM +0200, Fabien Lafont wrote: Hello everyone, I try to plot the digamma function of (1/2 + 1/x) but I'm not sure that I'm plotting the good one. I've tried: special.polygamma(0, (1/2 + 1/x)) and special.polygamma(1, (1/2 + 1/x)) You want special.polygamma(0, (1/2 + 1/x)). See http://docs.scipy.org/doc/scipy/reference/generated/scipy.special.polygamma.html The number specifies which derivative of the digamma function you want. Surely you want the 0th derivative? But It returns zero division error even when x is in ]0,1] I think it blows up at x = 0. What is the type of x in your usecase? Is it an array? If x contains the element 0, you will get a zero division error. You could try plotting the points explicitly: from numpy import linspace from pylab import * x = linspace(0.5, 2, num=100, endpoint=True) y = special.polygamma(0, (1/2 + 1/x)) plot(x, y) show() You can compare output against this: http://www.wolframalpha.com/input/?i=digamma%281%2F2+%2B+1%2Fx%29+between+0.5+and+2 Hope this helps. -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-users] How to plot digamma function (psi)
On Tue, Jul 10, 2012 at 7:05 AM, Damon McDougall damon.mcdoug...@gmail.comwrote: On Tue, Jul 10, 2012 at 12:27:59PM +0200, Fabien Lafont wrote: Hello everyone, I try to plot the digamma function of (1/2 + 1/x) but I'm not sure that I'm plotting the good one. I've tried: special.polygamma(0, (1/2 + 1/x)) and special.polygamma(1, (1/2 + 1/x)) You want special.polygamma(0, (1/2 + 1/x)). See http://docs.scipy.org/doc/scipy/reference/generated/scipy.special.polygamma.html The number specifies which derivative of the digamma function you want. Surely you want the 0th derivative? But It returns zero division error even when x is in ]0,1] I think it blows up at x = 0. What is the type of x in your usecase? Is it an array? If x contains the element 0, you will get a zero division error. You could try plotting the points explicitly: from numpy import linspace from pylab import * x = linspace(0.5, 2, num=100, endpoint=True) y = special.polygamma(0, (1/2 + 1/x)) plot(x, y) show() You can compare output against this: http://www.wolframalpha.com/input/?i=digamma%281%2F2+%2B+1%2Fx%29+between+0.5+and+2 Hope this helps. Another problem might be the 1/2 part, which in python2.x would yield 0 unless one does from __future__ import division. Ben Root -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-users] How to plot digamma function (psi)
On Tue, Jul 10, 2012 at 08:57:24AM -0400, Benjamin Root wrote: On Tue, Jul 10, 2012 at 7:05 AM, Damon McDougall damon.mcdoug...@gmail.comwrote: On Tue, Jul 10, 2012 at 12:27:59PM +0200, Fabien Lafont wrote: But It returns zero division error even when x is in ]0,1] I think it blows up at x = 0. What is the type of x in your usecase? Is it an array? If x contains the element 0, you will get a zero division error. You could try plotting the points explicitly: Another problem might be the 1/2 part, which in python2.x would yield 0 unless one does from __future__ import division. Ben Root Wow, I can't believe I didn't spot that. Nice one. I will update my answer according to Ben's astute observation: from scipy import special from pylab import * x = linspace(0.5, 2.0, num=100, endpoint=True) y = special.polygamma(0, 0.5 + 1.0/x) plot(x, y) show() Thanks Ben. -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-users] How to plot digamma function (psi)
Thanks! The problem came from the 1/2 ! For convenience I've found the function digamma on numpy *http://docs.scipy.org/doc/scipy/reference/generated/scipy.special.psi.html But it's quite hard to find it! Maybe we can ask to add digamma in the title between parenthesis? Fabien * 2012/7/10 Damon McDougall damon.mcdoug...@gmail.com On Tue, Jul 10, 2012 at 08:57:24AM -0400, Benjamin Root wrote: On Tue, Jul 10, 2012 at 7:05 AM, Damon McDougall damon.mcdoug...@gmail.comwrote: On Tue, Jul 10, 2012 at 12:27:59PM +0200, Fabien Lafont wrote: But It returns zero division error even when x is in ]0,1] I think it blows up at x = 0. What is the type of x in your usecase? Is it an array? If x contains the element 0, you will get a zero division error. You could try plotting the points explicitly: Another problem might be the 1/2 part, which in python2.x would yield 0 unless one does from __future__ import division. Ben Root Wow, I can't believe I didn't spot that. Nice one. I will update my answer according to Ben's astute observation: from scipy import special from pylab import * x = linspace(0.5, 2.0, num=100, endpoint=True) y = special.polygamma(0, 0.5 + 1.0/x) plot(x, y) show() Thanks Ben. -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] ANN: mpltools 0.1 release
Announcement: mpltools 0.1 == mpltools is a package of tools for matplotlib. For the most part, these tools are only loosely-connected in functionality, but there are two that may prove particularly useful: Styles and plot2rst --- The `style` package provides a simple way to define and reuse matplotlibrc-like config files. For example, there's an included style that mimics R's plotting package, ggplot. You can use this style by calling:: from mpltools import style style.use('ggplot') (Thanks to Huy Nguyen for these settings.) The second tool of note is `plot2rst`, which provides a simple way to generate (Sphinx-flavored) reStructuredText examples from normal python files. See the Getting Started page and `plot2rst` example for details: http://tonysyu.github.com/mpltools/getting_started.html http://tonysyu.github.com/mpltools/auto_examples/sphinx/plot_plot2rst.html Other tools --- This package provides other tools for tweaking colors, layouts, etc. The easiest way to get started is to look at the example gallery: http://tonysyu.github.com/mpltools/auto_examples/index.html Download You can grab the 0.1 release on PyPI: http://pypi.python.org/pypi/mpltools/0.1 or clone the repo on github: https://github.com/tonysyu/mpltools.git Contributors Thanks the following people for reporting bugs and contributing fixes and enhancements: - Alex Arsenovic - Guillaume Calmettes - Huy Nguyen - Sergey Karayev Special thanks to Alex, who came up with an early implementation of stylesheets that started me down this path. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ANN: mpltools 0.1 release
On Tue, Jul 10, 2012 at 12:58 PM, Tony Yu tsy...@gmail.com wrote: Announcement: mpltools 0.1 == mpltools is a package of tools for matplotlib. For the most part, these tools are only loosely-connected in functionality, but there are two that may prove particularly useful: Styles and plot2rst --- The `style` package provides a simple way to define and reuse matplotlibrc-like config files. For example, there's an included style that mimics R's plotting package, ggplot. You can use this style by calling:: from mpltools import style style.use('ggplot') (Thanks to Huy Nguyen for these settings.) The second tool of note is `plot2rst`, which provides a simple way to generate (Sphinx-flavored) reStructuredText examples from normal python files. See the Getting Started page and `plot2rst` example for details: http://tonysyu.github.com/mpltools/getting_started.html http://tonysyu.github.com/mpltools/auto_examples/sphinx/plot_plot2rst.html Other tools --- This package provides other tools for tweaking colors, layouts, etc. The easiest way to get started is to look at the example gallery: http://tonysyu.github.com/mpltools/auto_examples/index.html Download You can grab the 0.1 release on PyPI: http://pypi.python.org/pypi/mpltools/0.1 or clone the repo on github: https://github.com/tonysyu/mpltools.git Contributors Thanks the following people for reporting bugs and contributing fixes and enhancements: - Alex Arsenovic - Guillaume Calmettes - Huy Nguyen - Sergey Karayev Special thanks to Alex, who came up with an early implementation of stylesheets that started me down this path. Neat work, Tony! I especially like the errorfill feature: http://tonysyu.github.com/mpltools/auto_examples/special/plot_errorfill.html#example-special-plot-errorfill-py Ben Root -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ANN: mpltools 0.1 release
On Tue, Jul 10, 2012 at 1:10 PM, Benjamin Root ben.r...@ou.edu wrote: On Tue, Jul 10, 2012 at 12:58 PM, Tony Yu tsy...@gmail.com wrote: Announcement: mpltools 0.1 == mpltools is a package of tools for matplotlib. For the most part, these tools are only loosely-connected in functionality, but there are two that may prove particularly useful: Styles and plot2rst --- The `style` package provides a simple way to define and reuse matplotlibrc-like config files. For example, there's an included style that mimics R's plotting package, ggplot. You can use this style by calling:: from mpltools import style style.use('ggplot') (Thanks to Huy Nguyen for these settings.) The second tool of note is `plot2rst`, which provides a simple way to generate (Sphinx-flavored) reStructuredText examples from normal python files. See the Getting Started page and `plot2rst` example for details: http://tonysyu.github.com/mpltools/getting_started.html http://tonysyu.github.com/mpltools/auto_examples/sphinx/plot_plot2rst.html Other tools --- This package provides other tools for tweaking colors, layouts, etc. The easiest way to get started is to look at the example gallery: http://tonysyu.github.com/mpltools/auto_examples/index.html Download You can grab the 0.1 release on PyPI: http://pypi.python.org/pypi/mpltools/0.1 or clone the repo on github: https://github.com/tonysyu/mpltools.git Contributors Thanks the following people for reporting bugs and contributing fixes and enhancements: - Alex Arsenovic - Guillaume Calmettes - Huy Nguyen - Sergey Karayev Special thanks to Alex, who came up with an early implementation of stylesheets that started me down this path. Neat work, Tony! I especially like the errorfill feature: http://tonysyu.github.com/mpltools/auto_examples/special/plot_errorfill.html#example-special-plot-errorfill-py Ben Root Thanks Ben! Like a lot of things in the package, that's a fairly simple function, but I just wanted a simple interface to do it. Cheers, -Tony -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ANN: mpltools 0.1 release
On Tue, Jul 10, 2012 at 01:44:41PM -0400, Tony Yu wrote: On Tue, Jul 10, 2012 at 1:10 PM, Benjamin Root ben.r...@ou.edu wrote: On Tue, Jul 10, 2012 at 12:58 PM, Tony Yu tsy...@gmail.com wrote: Announcement: mpltools 0.1 == mpltools is a package of tools for matplotlib. For the most part, these tools are only loosely-connected in functionality, but there are two that may prove particularly useful: Styles and plot2rst --- The `style` package provides a simple way to define and reuse matplotlibrc-like config files. For example, there's an included style that mimics R's plotting package, ggplot. You can use this style by calling:: from mpltools import style style.use('ggplot') (Thanks to Huy Nguyen for these settings.) The second tool of note is `plot2rst`, which provides a simple way to generate (Sphinx-flavored) reStructuredText examples from normal python files. See the Getting Started page and `plot2rst` example for details: http://tonysyu.github.com/mpltools/getting_started.html http://tonysyu.github.com/mpltools/auto_examples/sphinx/plot_plot2rst.html Other tools --- This package provides other tools for tweaking colors, layouts, etc. The easiest way to get started is to look at the example gallery: http://tonysyu.github.com/mpltools/auto_examples/index.html Download You can grab the 0.1 release on PyPI: http://pypi.python.org/pypi/mpltools/0.1 or clone the repo on github: https://github.com/tonysyu/mpltools.git Contributors Thanks the following people for reporting bugs and contributing fixes and enhancements: - Alex Arsenovic - Guillaume Calmettes - Huy Nguyen - Sergey Karayev Special thanks to Alex, who came up with an early implementation of stylesheets that started me down this path. Neat work, Tony! I especially like the errorfill feature: http://tonysyu.github.com/mpltools/auto_examples/special/plot_errorfill.html#example-special-plot-errorfill-py Ben Root Thanks Ben! Like a lot of things in the package, that's a fairly simple function, but I just wanted a simple interface to do it. Cheers, -Tony Would there be any interest in porting some of that functionality into the main mpl codebase? Like Ben said, that error function is nifty... :) -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ANN: mpltools 0.1 release
On Tue, Jul 10, 2012 at 12:49 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: Would there be any interest in porting some of that functionality into the main mpl codebase? Like Ben said, that error function is nifty... :) I also think the styles would be widely appreciated, and we might get more styles contributors if it was part of the mainline. We'd ideally like to be able to support remote styles, eg via gist. Nice stuff, Tony. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ANN: mpltools 0.1 release
On Tue, Jul 10, 2012 at 1:52 PM, John Hunter jdh2...@gmail.com wrote: On Tue, Jul 10, 2012 at 12:49 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: Would there be any interest in porting some of that functionality into the main mpl codebase? Like Ben said, that error function is nifty... :) I also think the styles would be widely appreciated, and we might get more styles contributors if it was part of the mainline. We'd ideally like to be able to support remote styles, eg via gist. Nice stuff, Tony. Damon and John: Thanks for your interest. I would be happy to help port anything that can find a home in Matplotlib. I'm low on bandwidth, so if I'm too slow with any of it, feel free to grab the code and submit your own PR for the port (just let me know so we don't duplicate our efforts). As for porting the stylesheet implementation: Currently, the style files must be ConfigObj-readable files (which has a different syntax than matplotlibrc files). I've been planning to rewrite the implementation to use either file-type, but it may be best to just leave things as-is in mpltools, and create a matplotlib PR that uses matplotlibrc-style files. Right now, matplotlib's rc-machinery is not easily reusable: I would want to wait until after PR 861, which helps a bit: https://github.com/matplotlib/matplotlib/pull/861 There may need to be some more refactoring on that front before styles are added to the mainline, but I'm happy to help. Cheers, -Tony -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users