Re: [Matplotlib-users] ipython --pylab: Figure not showing in simple plot(1, 1) command [v1.2]

2012-12-13 Thread Benjamin Root
On Mon, Dec 10, 2012 at 5:49 PM, Timothy Duly timdu...@gmail.com wrote:

 Paul,

 Actually, I didn't realize that you had to change the backend in the
 matplotlibrc file.  Once I changed it to 'Qt4Agg', everything worked.
  Thanks!

 (to find out where your matplotlibrc file is:
 matplotlib.matplotlib_fname() )

 Tim



Usually, you don't have to, but I guess something happened with your
install at some point that messed around with your rc file.  Glad to see it
fixed.

Ben Root
--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] colorbars with multiple subplots

2012-12-13 Thread Claus
Hi,

I am trying to plot a colorbar next to each subplot in a figure. In the 
following example, I create two figures. In the second figure, I try to add the 
colorbars. Is there a way to show the colorbar next to each subplot. The way I 
did it, all the colorbars appear next to the last subplot, take away space from 
it, and all are plotted using the jet colormap.
Unfortunately, I am not sure how to do this better, and would appreciate hints.


import numpy as np
import matplotlib.pylab as plt

def main():

# four subplots, no colorbar, so far so good
f, axarr = plt.subplots(2, 2)
axarr[0, 0].imshow(np.random.rand(5,5)*10)
axarr[0, 1].imshow(np.random.rand(5,5))
axarr[1, 0].imshow(np.random.rand(5,5)*100)
axarr[1, 1].imshow(np.random.rand(5,5)*1000)
plt.show()

# four subplots, four colorbars
f, axarr = plt.subplots(2, 2)
a = axarr[0, 0].imshow(np.random.rand(5,5)*10)
cbar1 = f.colorbar(a, cmap='jet')
b = axarr[0, 1].imshow(np.random.rand(5,5))
cbar2 = f.colorbar(b, cmap='Reds')
c = axarr[1, 0].imshow(np.random.rand(5,5)*100)
cbar2 = f.colorbar(c, cmap='Blues')
d = axarr[1, 1].imshow(np.random.rand(5,5)*1000)
cbar2 = f.colorbar(d, cmap='Greens')
plt.show()

if __name__ == '__main__':
main()
--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbars with multiple subplots

2012-12-13 Thread Benjamin Root
On Thu, Dec 13, 2012 at 10:45 AM, Claus clausena...@gmail.com wrote:

 Hi,

 I am trying to plot a colorbar next to each subplot in a figure. In the
 following example, I create two figures. In the second figure, I try to add
 the colorbars. Is there a way to show the colorbar next to each subplot.
 The way I did it, all the colorbars appear next to the last subplot, take
 away space from it, and all are plotted using the jet colormap.
 Unfortunately, I am not sure how to do this better, and would appreciate
 hints.


 import numpy as np
 import matplotlib.pylab as plt

 def main():

 # four subplots, no colorbar, so far so good
 f, axarr = plt.subplots(2, 2)
 axarr[0, 0].imshow(np.random.rand(5,5)*10)
 axarr[0, 1].imshow(np.random.rand(5,5))
 axarr[1, 0].imshow(np.random.rand(5,5)*100)
 axarr[1, 1].imshow(np.random.rand(5,5)*1000)
 plt.show()

 # four subplots, four colorbars
 f, axarr = plt.subplots(2, 2)
 a = axarr[0, 0].imshow(np.random.rand(5,5)*10)
 cbar1 = f.colorbar(a, cmap='jet')
 b = axarr[0, 1].imshow(np.random.rand(5,5))
 cbar2 = f.colorbar(b, cmap='Reds')
 c = axarr[1, 0].imshow(np.random.rand(5,5)*100)
 cbar2 = f.colorbar(c, cmap='Blues')
 d = axarr[1, 1].imshow(np.random.rand(5,5)*1000)
 cbar2 = f.colorbar(d, cmap='Greens')
 plt.show()

 if __name__ == '__main__':
 main()


I think you are looking for the AxesGrid object from the
mpl_toolkits.axes_grid1 module:

http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axes-grid1

Ben Root
--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbars with multiple subplots

2012-12-13 Thread Sterling Smith
Claus,

f.colorbar may be trying to place the colorbar on the 'current axes'.  Does 
placing 
plt.axes(axarr[0,0])
before each f.colorbar help?  Also, the plt.colorbar function [1] (maybe 
f.colorbar also) can take a keyword argument for the axes in which to draw the 
colorbar.

-Sterling

[1] http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.colorbar


On Dec 13, 2012, at 7:45AM, Claus wrote:

 Hi,
 
 I am trying to plot a colorbar next to each subplot in a figure. In the 
 following example, I create two figures. In the second figure, I try to add 
 the colorbars. Is there a way to show the colorbar next to each subplot. The 
 way I did it, all the colorbars appear next to the last subplot, take away 
 space from it, and all are plotted using the jet colormap.
 Unfortunately, I am not sure how to do this better, and would appreciate 
 hints.
 
 
 import numpy as np
 import matplotlib.pylab as plt
 
 def main():
 
# four subplots, no colorbar, so far so good
f, axarr = plt.subplots(2, 2)
axarr[0, 0].imshow(np.random.rand(5,5)*10)
axarr[0, 1].imshow(np.random.rand(5,5))
axarr[1, 0].imshow(np.random.rand(5,5)*100)
axarr[1, 1].imshow(np.random.rand(5,5)*1000)
plt.show()
 
# four subplots, four colorbars
f, axarr = plt.subplots(2, 2)
a = axarr[0, 0].imshow(np.random.rand(5,5)*10)
cbar1 = f.colorbar(a, cmap='jet')
b = axarr[0, 1].imshow(np.random.rand(5,5))
cbar2 = f.colorbar(b, cmap='Reds')
c = axarr[1, 0].imshow(np.random.rand(5,5)*100)
cbar2 = f.colorbar(c, cmap='Blues')
d = axarr[1, 1].imshow(np.random.rand(5,5)*1000)
cbar2 = f.colorbar(d, cmap='Greens')
plt.show()
 
 if __name__ == '__main__':
main()
 --
 LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
 Remotely access PCs and mobile devices and provide instant support
 Improve your efficiency, and focus on delivering more value-add services
 Discover what IT Professionals Know. Rescue delivers
 http://p.sf.net/sfu/logmein_12329d2d
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbars with multiple subplots

2012-12-13 Thread Steven Boada
I echo using the AxesGrid object from the toolkits. Protip -- I have had 
trouble making it work with semilog plots. So if that is what you are 
doing, it might be worth trying another thing or two first.


Steven

On 12/13/12 9:56 AM, Benjamin Root wrote:



On Thu, Dec 13, 2012 at 10:45 AM, Claus clausena...@gmail.com 
mailto:clausena...@gmail.com wrote:


Hi,

I am trying to plot a colorbar next to each subplot in a figure.
In the following example, I create two figures. In the second
figure, I try to add the colorbars. Is there a way to show the
colorbar next to each subplot. The way I did it, all the colorbars
appear next to the last subplot, take away space from it, and all
are plotted using the jet colormap.
Unfortunately, I am not sure how to do this better, and would
appreciate hints.


import numpy as np
import matplotlib.pylab as plt

def main():

# four subplots, no colorbar, so far so good
f, axarr = plt.subplots(2, 2)
axarr[0, 0].imshow(np.random.rand(5,5)*10)
axarr[0, 1].imshow(np.random.rand(5,5))
axarr[1, 0].imshow(np.random.rand(5,5)*100)
axarr[1, 1].imshow(np.random.rand(5,5)*1000)
plt.show()

# four subplots, four colorbars
f, axarr = plt.subplots(2, 2)
a = axarr[0, 0].imshow(np.random.rand(5,5)*10)
cbar1 = f.colorbar(a, cmap='jet')
b = axarr[0, 1].imshow(np.random.rand(5,5))
cbar2 = f.colorbar(b, cmap='Reds')
c = axarr[1, 0].imshow(np.random.rand(5,5)*100)
cbar2 = f.colorbar(c, cmap='Blues')
d = axarr[1, 1].imshow(np.random.rand(5,5)*1000)
cbar2 = f.colorbar(d, cmap='Greens')
plt.show()

if __name__ == '__main__':
main()


I think you are looking for the AxesGrid object from the 
mpl_toolkits.axes_grid1 module:


http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axes-grid1

Ben Root



--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d


___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--

Steven Boada

Doctoral Student
Dept of Physics and Astronomy
Texas AM University
bo...@physics.tamu.edu

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users