Re: [Matplotlib-users] a break in the y-axis
Eric Firing, on 2011-01-22 17:49, wrote: Paul Ivanov, on 2011-01-22 18:28, wrote: Paul, Your example below is nice, and this question comes up quite often. If we don't already have a gallery example of this, you might want to add one. (Probably better to use deterministic fake data rather than random.) import numpy as np import matplotlib.pylab as plt pts = np.random.rand(30)*.2 pts[[7,11]] += .8 f,(ax,ax2) = plt.subplots(2,1,sharex=True) ax.plot(pts) ax2.plot(pts) ax.set_ylim(.78,1.) ax2.set_ylim(0,.22) ax.xaxis.tick_top() ax.spines['bottom'].set_visible(False) ax.tick_params(labeltop='off') ax2.xaxis.tick_bottom() ax2.spines['top'].set_visible(False) Done in r8935, see examples/pylab_examples/broken_axis.py I documented the above, used deterministic fake data, as Eric suggested, and added the diagonal cut lines that usually accompany a broken axis. Here's the tail end of the script which creates that effect (see updated attached image). # This looks pretty good, and was fairly painless, but you can # get that cut-out diagonal lines look with just a bit more # work. The important thing to know here is that in axes # coordinates, which are always between 0-1, spine endpoints # are at these locations (0,0), (0,1), (1,0), and (1,1). Thus, # we just need to put the diagonals in the appropriate corners # of each of our axes, and so long as we use the right # transform and disable clipping. d = .015 # how big to make the diagonal lines in axes coordinates # arguments to pass plot, just so we don't keep repeating them kwargs = dict(transform=ax.transAxes, color='k', clip_on=False) ax.plot((-d,+d),(-d,+d), **kwargs) # top-left diagonal ax.plot((1-d,1+d),(-d,+d), **kwargs)# top-right diagonal kwargs.update(transform=ax2.transAxes) # switch to the bottom axes ax2.plot((-d,+d),(1-d,1+d), **kwargs) # bottom-left diagonal ax2.plot((1-d,1+d),(1-d,1+d), **kwargs) # bottom-right diagonal # What's cool about this is that now if we vary the distance # between ax and ax2 via f.subplots_adjust(hspace=...) or # plt.subplot_tool(), the diagonal lines will move accordingly, # and stay right at the tips of the spines they are 'breaking' best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 attachment: broken_axis.png signature.asc Description: Digital signature -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Find the RMS from a PSD
Hello matplotlib users. I'm new to signal processing and I've read that RMS could be found from a PSD. I'm interested in as I would further like to know energy in a signal through it's frequencies. My problem is I don't find how to calculate the RMS from the PSD output. It seems it's a matter of scale (frequencies bandwith is taken in account already). I wrote a test case with a simple sinus. I should be able to find the same RMS value from the PSD method and direct RMS over signal method. Could you please have a look and tell me how to find good RMS value from PSD output? Thanks #!/usr/bin/python # -*- coding: utf-8 -*- import matplotlib, platform if platform.system() == 'Linux' : matplotlib.use(gtk) import pylab import scipy ## PSD vs RMS #Parameters samplerate = 48000 nfft = 1024*2 graph = False #create 1 sec sinus signal t = scipy.arange(0, 1 , 1/float(samplerate)) signal = .25*scipy.sin(2*scipy.pi*(samplerate/10.)*t) print len(signal) #RMS of an array def RMS(data): rms = data**2 rms = scipy.sqrt(rms.sum()/len(data)) return rms #PSD of an array. I want this to return the RMS def RMSfromPSD(data) : y, x = pylab.psd(data, NFFT = nfft, Fs = samplerate) ##Calculate the RMS #The energy returned by PSD depends on FFT size freqbandwith = x[1] y = y*freqbandwith #The energy returned by PSD depends on Samplerate y = y/float(samplerate) #Summing the power in freq domain to get RMS rms = scipy.sqrt(y.sum()) return rms print RMS method, RMS(signal) print RMS using PSD method, RMSfromPSD(signal) #Graph if graph == True : pylab.subplot(211) pylab.plot(t,signal) pylab.subplot(212) pylab.psd(signal, nfft, samplerate) pylab.show() -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] a break in the y-axis
On 01/23/2011 11:46 PM, Paul Ivanov wrote: [...] Done in r8935, see examples/pylab_examples/broken_axis.py Thank you. I documented the above, used deterministic fake data, as Eric suggested, and added the diagonal cut lines that usually accompany a broken axis. Here's the tail end of the script which creates that effect (see updated attached image). Beautiful! Eric # This looks pretty good, and was fairly painless, but you can # get that cut-out diagonal lines look with just a bit more # work. The important thing to know here is that in axes # coordinates, which are always between 0-1, spine endpoints # are at these locations (0,0), (0,1), (1,0), and (1,1). Thus, # we just need to put the diagonals in the appropriate corners # of each of our axes, and so long as we use the right # transform and disable clipping. d = .015 # how big to make the diagonal lines in axes coordinates # arguments to pass plot, just so we don't keep repeating them kwargs = dict(transform=ax.transAxes, color='k', clip_on=False) ax.plot((-d,+d),(-d,+d), **kwargs) # top-left diagonal ax.plot((1-d,1+d),(-d,+d), **kwargs)# top-right diagonal kwargs.update(transform=ax2.transAxes) # switch to the bottom axes ax2.plot((-d,+d),(1-d,1+d), **kwargs) # bottom-left diagonal ax2.plot((1-d,1+d),(1-d,1+d), **kwargs) # bottom-right diagonal # What's cool about this is that now if we vary the distance # between ax and ax2 via f.subplots_adjust(hspace=...) or # plt.subplot_tool(), the diagonal lines will move accordingly, # and stay right at the tips of the spines they are 'breaking' best, -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to get a Mac OS X version of Tcl/Tk rather than X11 version.
I have an installation of Python 2.6.4 on my MacBook Pro (OS X 10.6) that by default uses X11 windows and dialogs rather than the Mac version of those GUI items. In my googling and exchanges on other support groups I've come down to the problem may be with the Tcl/Tk installation using the generic X11 GUI rather than the Mac version. Does anyone know how I can change that in the Tk part of the python framework? I think this problem came up in the iPython email list, but I didn't get enough info from the messages there. More Info: The python framework is part of the SAGE package which I installed from source. I did this on my Mac Pro (system 10.4) and it works well with Mac windows for matplotlib and Mac open/save dialogs for Tk calls. But on my MacBook Pro I get X11 windows and dialogs. I want the Mac versions. Even more info: If you're interested, here's the original message I put up on the SAGE support group and was told it's a problem with the type of Tcl/Tk installed. -- Lou Pecora - I have an installation of SAGE (from source) on my Mac laptop in which using the tcl/tk library to plot (using TKAgg backend) or call tk file open/save dialogs calls the X11 versions and not the native Mac versions of dialogs and windows. I want to get the Mac versions. I posted about this on this list recently and now after a response here and much googling I have the sense that the problem is that I have a SAGE package with an X11 version of the tk library rather than the Mac one. I compiled SAGE from source on my Mac laptop. That went perfectly. I don't know how I got the X11 version since I also compiled SAGE from source on my Mac desktop where the plotting and file dialogs are the correct Mac versions, not X11. The only difference is that the laptop is Mac OS X 10.6 and the desktop is 10.4. If that matters, I don't know. Does anyone know how to get the Mac version installed in the SAGE source-compile installation? I have not found an answer to this elsewhere. I'm hoping someone here knows how this is done with the source installation. Thanks for any help or pointers. -- Lou Pecora -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] X and Y label position in axes_grid1.AxesGrid/ImageGrid
Hi All, I can't get the x label on the top row of an ImageGrid to display if there is more than one row in the grid. I suspect that something is being clipped somewhere, but have no idea what to do to fix it. (Note, this also happens on the right edge of a ride-sided y axis label.) I have included some minimal sample code below. I'd appreciate it if anyone can point me in the right direction. Cheers, Russ #--- import matplotlib.pyplot as plt import matplotlib.cm as cm import mpl_toolkits.axes_grid1 as ag import numpy as np fig1 = plt.figure() grid1 = ag.AxesGrid( fig1, 111, nrows_ncols = (1,2), axes_pad = 0.5) grid1[0].axes.xaxis.set_label_position('top') grid1[0].axes.xaxis.set_label_text('foo') grid1[1].axes.xaxis.set_label_position('top') grid1[1].axes.xaxis.set_label_text('bar') grid1[0].axes.yaxis.set_label_position('right') grid1[0].axes.yaxis.set_label_text('foo') grid1[1].axes.yaxis.set_label_position('right') grid1[1].axes.yaxis.set_label_text('bar') fig2 = plt.figure() grid2 = ag.AxesGrid( fig2, 111, nrows_ncols = (2,1), axes_pad = 0.5) grid2[0].axes.xaxis.set_label_position('top') grid2[0].axes.xaxis.set_label_text('bar') grid2[1].axes.xaxis.set_label_position('top') grid2[1].axes.xaxis.set_label_text('bar') grid2[0].axes.yaxis.set_label_position('right') grid2[0].axes.yaxis.set_label_text('foo') grid2[1].axes.yaxis.set_label_position('right') grid2[1].axes.yaxis.set_label_text('bar') plt.show() #--- -- Russell J. Hewett Ph.D. Candidate Department of Computer Science University of Illinois at Urbana-Champaign www.russellhewett.com -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] X and Y label position in axes_grid1.AxesGrid/ImageGrid
Russell Hewett, on 2011-01-24 13:56, wrote: Hi All, I can't get the x label on the top row of an ImageGrid to display if there is more than one row in the grid. I suspect that something is being clipped somewhere, but have no idea what to do to fix it. (Note, this also happens on the right edge of a ride-sided y axis label.) I have included some minimal sample code below. I'd appreciate it if anyone can point me in the right direction. Cheers, Russ Hi Russ, thanks for the report - at a glance, it appears to be a bug in AxesGrid removing redundant labels for shared axis when they align. I've included a temporary workaround for your script, but don't have time to look into it further at the moment. By the way, calling grid[0].axes is redundant, so I just modified it to use grid[0].xaxis, which is equivalent. #--- import matplotlib.pyplot as plt import matplotlib.cm as cm import mpl_toolkits.axes_grid1 as ag import numpy as np fig1 = plt.figure() grid1 = ag.AxesGrid( fig1, 111, nrows_ncols = (1,2), axes_pad = 0.5) grid1[0].xaxis.set_label_position('top') grid1[0].xaxis.set_label_text('foo') grid1[1].xaxis.set_label_position('top') grid1[1].xaxis.set_label_text('bar') grid1[0].yaxis.set_label_position('right') grid1[0].yaxis.set_label_text('foo') grid1[1].yaxis.set_label_position('right') grid1[1].yaxis.set_label_text('bar') grid1[1].yaxis.label.set_visible(True) # tmp workaround fig2 = plt.figure() grid2 = ag.AxesGrid( fig2, 111, nrows_ncols = (2,1), axes_pad = 0.5) grid2[0].xaxis.set_label_position('top') grid2[0].xaxis.set_label_text('bar') grid2[0].xaxis.label.set_visible(True) # tmp workaround grid2[1].xaxis.set_label_position('top') grid2[1].xaxis.set_label_text('bar') grid2[0].yaxis.set_label_position('right') grid2[0].yaxis.set_label_text('foo') grid2[1].yaxis.set_label_position('right') grid2[1].yaxis.set_label_text('bar') plt.show() #--- best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 signature.asc Description: Digital signature -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] floating bar chart?
I looked through the gallery, but didn't see this one and am not sure how to create it. It would be a floating bar chart (or floating column chart), like what is seen here: http://peltiertech.com/Excel/pix1/BloodSugarFloater.gif Thanks, Che -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] labels in ax = Axes3D(fig) are not aligned in parallel
Daniel Mader, on 2011-01-24 20:55, wrote: Hi, I have seen this ever since I use mpl_toolkits.mplot3d.Axes3D but it never bothered me too much until now: the labels are not aligned in paralled to the axes so that with longer labels or small figsizes, they run into the tick labels, besides looking odd. Hi Daniel, it does appear like a bug, though only for some views on the axes, thanks for the report. I'm not very familiar with this code, so I'll leave the bugfix for someone else, but here's the temporary workaround: Is there anything I can do to change the angle manually? # prevent the automatic rotation caused by view changes ax.yaxis.set_rotate_label(False) ax.yaxis.label.set_rotation(45) Beware that you'll have to adjust that angle on a per-view basis to get things to look right. best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 signature.asc Description: Digital signature -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] floating bar chart?
C M, on 2011-01-24 16:27, wrote: I looked through the gallery, but didn't see this one and am not sure how to create it. It would be a floating bar chart (or floating column chart), like what is seen here: http://peltiertech.com/Excel/pix1/BloodSugarFloater.gif Hi Che, just specify the 'bottom' keyword argument to bar. Note that the second parameter is height of the bar, *not* the top of the bar plt.bar([1,2,3,4], [2,2.5,5,3], bottom=[0,-1,1,2]) best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 signature.asc Description: Digital signature -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] X and Y label position in axes_grid1.AxesGrid/ImageGrid
Worked great, thanks! -r On Mon, Jan 24, 2011 at 2:32 PM, Paul Ivanov pivanov...@gmail.com wrote: Russell Hewett, on 2011-01-24 13:56, wrote: Hi All, I can't get the x label on the top row of an ImageGrid to display if there is more than one row in the grid. I suspect that something is being clipped somewhere, but have no idea what to do to fix it. (Note, this also happens on the right edge of a ride-sided y axis label.) I have included some minimal sample code below. I'd appreciate it if anyone can point me in the right direction. Cheers, Russ Hi Russ, thanks for the report - at a glance, it appears to be a bug in AxesGrid removing redundant labels for shared axis when they align. I've included a temporary workaround for your script, but don't have time to look into it further at the moment. By the way, calling grid[0].axes is redundant, so I just modified it to use grid[0].xaxis, which is equivalent. #--- import matplotlib.pyplot as plt import matplotlib.cm as cm import mpl_toolkits.axes_grid1 as ag import numpy as np fig1 = plt.figure() grid1 = ag.AxesGrid( fig1, 111, nrows_ncols = (1,2), axes_pad = 0.5) grid1[0].xaxis.set_label_position('top') grid1[0].xaxis.set_label_text('foo') grid1[1].xaxis.set_label_position('top') grid1[1].xaxis.set_label_text('bar') grid1[0].yaxis.set_label_position('right') grid1[0].yaxis.set_label_text('foo') grid1[1].yaxis.set_label_position('right') grid1[1].yaxis.set_label_text('bar') grid1[1].yaxis.label.set_visible(True) # tmp workaround fig2 = plt.figure() grid2 = ag.AxesGrid( fig2, 111, nrows_ncols = (2,1), axes_pad = 0.5) grid2[0].xaxis.set_label_position('top') grid2[0].xaxis.set_label_text('bar') grid2[0].xaxis.label.set_visible(True) # tmp workaround grid2[1].xaxis.set_label_position('top') grid2[1].xaxis.set_label_text('bar') grid2[0].yaxis.set_label_position('right') grid2[0].yaxis.set_label_text('foo') grid2[1].yaxis.set_label_position('right') grid2[1].yaxis.set_label_text('bar') plt.show() #--- best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk094eYACgkQe+cmRQ8+KPc/qACePreDR4ThGj/2PttN6OaMXm0K 17YAmwbIpf+++7fYVqI3asKiBf8Z3zlT =eG7W -END PGP SIGNATURE- -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Russell J. Hewett Ph.D. Candidate Department of Computer Science University of Illinois at Urbana-Champaign www.russellhewett.com -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] labels in ax = Axes3D(fig) are not aligned in parallel
Dear Paul, thank you very much for the quick reply! Unfortunately, I don't seem to get things right with your snippet of code: # prevent the automatic rotation caused by view changes ax.yaxis.set_rotate_label(False) ax.yaxis.label.set_rotation(45) Traceback (most recent call last): File example_mpl3D_spiral.py, line 41, in module ax.yaxis.set_rotate_label(False) AttributeError: 'YAxis' object has no attribute 'set_rotate_label' Am I missing something? Thanks in advance, best regards from a snowed up Salzburg, Daniel -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] floating bar chart?
On Mon, Jan 24, 2011 at 4:42 PM, Paul Ivanov pivanov...@gmail.com wrote: C M, on 2011-01-24 16:27, wrote: I looked through the gallery, but didn't see this one and am not sure how to create it. It would be a floating bar chart (or floating column chart), like what is seen here: http://peltiertech.com/Excel/pix1/BloodSugarFloater.gif Hi Che, just specify the 'bottom' keyword argument to bar. Note that the second parameter is height of the bar, *not* the top of the bar plt.bar([1,2,3,4], [2,2.5,5,3], bottom=[0,-1,1,2]) best, -- Paul Ivanov Thanks, Paul! Easy enough. -Che -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] X and Y label position in axes_grid1.AxesGrid/ImageGrid
On Monday, January 24, 2011, Russell Hewett rhewe...@illinois.edu wrote: Worked great, thanks! -r On Mon, Jan 24, 2011 at 2:32 PM, Paul Ivanov pivanov...@gmail.com wrote: Russell Hewett, on 2011-01-24 13:56, wrote: Hi All, I can't get the x label on the top row of an ImageGrid to display if there is more than one row in the grid. I suspect that something is being clipped somewhere, but have no idea what to do to fix it. (Note, this also happens on the right edge of a ride-sided y axis label.) I have included some minimal sample code below. I'd appreciate it if anyone can point me in the right direction. Cheers, Russ Hi Russ, thanks for the report - at a glance, it appears to be a bug in AxesGrid removing redundant labels for shared axis when they align. I've included a temporary workaround for your script, but don't have time to look into it further at the moment. By the way, calling grid[0].axes is redundant, so I just modified it to use grid[0].xaxis, which is equivalent. #--- import matplotlib.pyplot as plt import matplotlib.cm as cm import mpl_toolkits.axes_grid1 as ag import numpy as np fig1 = plt.figure() grid1 = ag.AxesGrid( fig1, 111, nrows_ncols = (1,2), axes_pad = 0.5) grid1[0].xaxis.set_label_position('top') grid1[0].xaxis.set_label_text('foo') grid1[1].xaxis.set_label_position('top') grid1[1].xaxis.set_label_text('bar') grid1[0].yaxis.set_label_position('right') grid1[0].yaxis.set_label_text('foo') grid1[1].yaxis.set_label_position('right') grid1[1].yaxis.set_label_text('bar') grid1[1].yaxis.label.set_visible(True) # tmp workaround fig2 = plt.figure() grid2 = ag.AxesGrid( fig2, 111, nrows_ncols = (2,1), axes_pad = 0.5) grid2[0].xaxis.set_label_position('top') grid2[0].xaxis.set_label_text('bar') grid2[0].xaxis.label.set_visible(True) # tmp workaround grid2[1].xaxis.set_label_position('top') grid2[1].xaxis.set_label_text('bar') grid2[0].yaxis.set_label_position('right') grid2[0].yaxis.set_label_text('foo') grid2[1].yaxis.set_label_position('right') grid2[1].yaxis.set_label_text('bar') plt.show() #--- best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk094eYACgkQe+cmRQ8+KPc/qACePreDR4ThGj/2PttN6OaMXm0K 17YAmwbIpf+++7fYVqI3asKiBf8Z3zlT =eG7W -END PGP SIGNATURE- -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Russell J. Hewett Ph.D. Candidate Department of Computer Science University of Illinois at Urbana-Champaign www.russellhewett.com Isn't it a feature? Axes_grid lets you choose the label mode which is 'L' by default. This means that only the outer labels are shown. Or am I missing something in the description of the problem? Ben Root -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] labels in ax = Axes3D(fig) are not aligned in parallel
On Monday, January 24, 2011, Daniel Mader danielstefanma...@googlemail.com wrote: Dear Paul, thank you very much for the quick reply! Unfortunately, I don't seem to get things right with your snippet of code: # prevent the automatic rotation caused by view changes ax.yaxis.set_rotate_label(False) ax.yaxis.label.set_rotation(45) Traceback (most recent call last): File example_mpl3D_spiral.py, line 41, in module ax.yaxis.set_rotate_label(False) AttributeError: 'YAxis' object has no attribute 'set_rotate_label' Am I missing something? Thanks in advance, best regards from a snowed up Salzburg, Daniel This problem with poorly rotated labels was fixed a couple of months ago in the development branch and I believe it is also in 1.0.1. Just to make sure, what version are you running? Ben Root -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Defining a precise x-axis max in plot()
Hello Gentlepeople, I am plotting an integer array using: matplotlib.pyplot.plot(). For my purposes it is imperative that the x-axis be explicitly defined. I have tried to achieve this by using: matplotlib.pyplot.axis(v). Where v is a list of integer values corresponding to the desired axes limits [xmin, xmax, ymin, ymax]. However, the x-axis that is displayed does not obey my explicit xmax declaration; the value is rounded up. Here is the relevant portion of my code: fig = pyplot.figure(figsize=(16,8)) ax1 = fig.add_axes([0.05, 0.15, 0.9, 0.8]) v = [0, len(myintvector), 0, max(myintvector, key=int)] ax1.axis(v) ax1.plot(myintvector, 'r--') The reason that I need the x-axis to match the length of my integer vector is because I am also drawing a colorbar immediately below the plot, the values of which describe the same integer vector. Therefore I need the colorbar coordinates to match the x-axis coordinates of my plot. I hope that I have described my issue coherently. Please be kind (N00b alert). Any help is greatly appreciated! Sincerely, Lionel 'Lee' Brooks 3rd Dartmouth Genetics Grad Student -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] X and Y label position in axes_grid1.AxesGrid/ImageGrid
This is indeed correct. Somehow I missed this. Setting label_mode = 'all' gets the behavior I wanted. Though, the top and right side are technically on the outside too. Perhaps that should be an available or the default setting? Perhaps the top row should default to labeling on the top, the right column default to labeling on the right, etc? -r On Mon, Jan 24, 2011 at 5:56 PM, Benjamin Root ben.r...@ou.edu wrote: Isn't it a feature? Axes_grid lets you choose the label mode which is 'L' by default. This means that only the outer labels are shown. Or am I missing something in the description of the problem? Ben Root -- Russell J. Hewett Ph.D. Candidate Department of Computer Science University of Illinois at Urbana-Champaign www.russellhewett.com -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Defining a precise x-axis max in plot()
On 01/24/2011 02:49 PM, Lionel (Lee) Brooks 3rd wrote: Hello Gentlepeople, I am plotting an integer array using: matplotlib.pyplot.plot(). For my purposes it is imperative that the x-axis be explicitly defined. I have tried to achieve this by using: matplotlib.pyplot.axis(v). Where v is a list of integer values corresponding to the desired axes limits [xmin, xmax, ymin, ymax]. However, the x-axis that is displayed does not obey my explicit xmax declaration; the value is rounded up. Here is the relevant portion of my code: It is always better to provide a minimal but complete self-contained example illustrating the problem. fig = pyplot.figure(figsize=(16,8)) ax1 = fig.add_axes([0.05, 0.15, 0.9, 0.8]) v = [0, len(myintvector), 0, max(myintvector, key=int)] ax1.axis(v) ax1.plot(myintvector, 'r--') I am not seeing the problem when I try what I think is a minimal example; what version of mpl are you using? And have you tried calling axis after the call to plot? This might have been necessary in some earlier versions; I don't recall. (In ipython -pylab, my example was this: ax1 = gca() ax1.axis([0,9.9,0,9.9]) ax1.plot([1,2]) draw() in which no rounding occurs.) Eric The reason that I need the x-axis to match the length of my integer vector is because I am also drawing a colorbar immediately below the plot, the values of which describe the same integer vector. Therefore I need the colorbar coordinates to match the x-axis coordinates of my plot. I hope that I have described my issue coherently. Please be kind (N00b alert). Any help is greatly appreciated! Sincerely, Lionel 'Lee' Brooks 3rd Dartmouth Genetics Grad Student -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users