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
(4) |
3
(16) |
4
(4) |
5
(15) |
6
(16) |
7
(6) |
8
(4) |
9
(9) |
10
(5) |
11
(8) |
12
(14) |
13
(19) |
14
(21) |
15
(8) |
16
(6) |
17
(10) |
18
(22) |
19
(15) |
20
(7) |
21
(21) |
22
(1) |
23
(6) |
24
(16) |
25
(12) |
26
(11) |
27
(27) |
28
(7) |
29
|
30
(4) |
31
(5) |
|
|
|
|
|
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
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
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
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,
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()
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
Ah, thank you very much, that helped! It works nicely! Best regards, Daniel
On 01/22/2011 05:16 PM, Paul Ivanov wrote: > Paul Ivanov, on 2011年01月22日 18:28, wrote: >> Ilya Shlyakhter, on 2011年01月22日 19:06, wrote: >>> Is it possible to create a "break" in the y-axis so that it has ticks >>> for value 0-.2, then ticks for values .8-1.0, but devotes only a token >>> amount of space to the area 0.2-0.8? >>> I have a dataset with most datapoints in 0-.2 and a couple in .8-1.0, >>> and none in .2-.8 . The default scaling wastes a lot of space and >>> compresses the data in the 0-.2 range >>> such that it is hard to distinguish. >> >> Hi Ilya, >> >> this... 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.) Eric >> >>> p.s. I know I could use two y-axes with different scales; but this >>> would require splitting the data into two different datasets as well, >>> and would not allow connecting all points >>> with one line. >> >> ... is the way I'd proceed, because it's clean, and requires the >> least amount of work. Connecting your lines across such breaks >> is misleading - since the magnitude of the slope of the >> connecting line segment arbitrary relative to all other line >> segments. You don't actually have to divide your data, you can >> just replot *all* data on the secondary plot, and then set the x >> and y lims to break up your views on the data. I'm attaching a >> quick sketch of what that would look like. (Note how different >> the outlier line segments would look if we connected them in the >> same manner that all other points are connected). >> >> 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) >> >> If this is something you really want, though, you can achieve it >> by making your own projection/scale: >> http://matplotlib.sourceforge.net/devel/add_new_projection.html >> >> Yet another way would be to re-label the tick lines (e.g. make .6 >> label be 1.0 and subtract that offset from your two outliers. > > forgot the attachment, here it is. > > > > > ------------------------------------------------------------------------------ > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Paul Ivanov, on 2011年01月22日 18:28, wrote: > Ilya Shlyakhter, on 2011年01月22日 19:06, wrote: > > Is it possible to create a "break" in the y-axis so that it has ticks > > for value 0-.2, then ticks for values .8-1.0, but devotes only a token > > amount of space to the area 0.2-0.8? > > I have a dataset with most datapoints in 0-.2 and a couple in .8-1.0, > > and none in .2-.8 . The default scaling wastes a lot of space and > > compresses the data in the 0-.2 range > > such that it is hard to distinguish. > > Hi Ilya, > > this... > > > p.s. I know I could use two y-axes with different scales; but this > > would require splitting the data into two different datasets as well, > > and would not allow connecting all points > > with one line. > > ... is the way I'd proceed, because it's clean, and requires the > least amount of work. Connecting your lines across such breaks > is misleading - since the magnitude of the slope of the > connecting line segment arbitrary relative to all other line > segments. You don't actually have to divide your data, you can > just replot *all* data on the secondary plot, and then set the x > and y lims to break up your views on the data. I'm attaching a > quick sketch of what that would look like. (Note how different > the outlier line segments would look if we connected them in the > same manner that all other points are connected). > > 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) > > If this is something you really want, though, you can achieve it > by making your own projection/scale: > http://matplotlib.sourceforge.net/devel/add_new_projection.html > > Yet another way would be to re-label the tick lines (e.g. make .6 > label be 1.0 and subtract that offset from your two outliers. forgot the attachment, here it is. -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
Glen Shennan, on 2011年01月21日 15:41, wrote: > Hi, > > I'm trying to install matplotlib from the svn source. I can compile > the code and install it to my desired location but I cannot import it > into python. > > I did: > > svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib > matplotlib > cd matplotlib > python setup.py install --prefix=/home/glen/local > > I have numpy and scipy installed and working correctly using the above > prefix and matplotlib compiles and installs the same way but when I > issue "import matplotlib as mpl" nothing results. There is no error > but also no library. > > >>> dir(mpl) > ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__'] > > >>> mpl.__path__ > ['matplotlib'] > > >>> mpl.__file__ > 'matplotlib/__init__.pyc' Hi Glen, what directory are you in when you're doing this? > >>> mpl.__path__ > ['matplotlib'] suggests that you're importing from some local directory. If everything worked right, the path should be something like >>> mpl.__path__ ['/home/glen/local/lib/python2.x/site-packages/matplotlib'] best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
Ilya Shlyakhter, on 2011年01月22日 19:06, wrote: > Is it possible to create a "break" in the y-axis so that it has ticks > for value 0-.2, then ticks for values .8-1.0, but devotes only a token > amount of space to the area 0.2-0.8? > I have a dataset with most datapoints in 0-.2 and a couple in .8-1.0, > and none in .2-.8 . The default scaling wastes a lot of space and > compresses the data in the 0-.2 range > such that it is hard to distinguish. Hi Ilya, this... > p.s. I know I could use two y-axes with different scales; but this > would require splitting the data into two different datasets as well, > and would not allow connecting all points > with one line. ... is the way I'd proceed, because it's clean, and requires the least amount of work. Connecting your lines across such breaks is misleading - since the magnitude of the slope of the connecting line segment arbitrary relative to all other line segments. You don't actually have to divide your data, you can just replot *all* data on the secondary plot, and then set the x and y lims to break up your views on the data. I'm attaching a quick sketch of what that would look like. (Note how different the outlier line segments would look if we connected them in the same manner that all other points are connected). 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) If this is something you really want, though, you can achieve it by making your own projection/scale: http://matplotlib.sourceforge.net/devel/add_new_projection.html Yet another way would be to re-label the tick lines (e.g. make .6 label be 1.0 and subtract that offset from your two outliers. best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
Is it possible to create a "break" in the y-axis so that it has ticks for value 0-.2, then ticks for values .8-1.0, but devotes only a token amount of space to the area 0.2-0.8? I have a dataset with most datapoints in 0-.2 and a couple in .8-1.0, and none in .2-.8 . The default scaling wastes a lot of space and compresses the data in the 0-.2 range such that it is hard to distinguish. Thanks for any help! Ilya p.s. I know I could use two y-axes with different scales; but this would require splitting the data into two different datasets as well, and would not allow connecting all points with one line.
Dear Paul, Thank you, it does exacly what I want to do. I searched a bit into the "contour" instance, but I was biased since I was looking for something like "get_line". cheers Francesco 2011年1月21日 Paul Ivanov <piv...@gm...>: > Francesco Montesano, on 2011年01月21日 15:44, wrote: >> Dear All, >> >> I am using contour plot and I am drawing different contours with >> different colors and linestyles and I would like to have a legend with >> a caption for each contour function used. >> Here you can see an example of what I would like to do >> >> >> #create the 2D histogram and the x and y axis >> >> x, y = np.random.normal(0, 0.5, 1000), np.random.normal(0, 1, 1000) >> >> h, xe,ye = np.histogram2d(x,y, bins=25) >> >> xe, ye = (xe[1:]+xe[:-1])/2, (ye[1:]+ye[:-1])/2 >> >> >> >> lines,text = [], [] # initialise lists >> >> >> >> #contour plots >> >> lines.append(plt.contour(xe,ye,h, levels=[10,9], linestyles="-", colors="k")) >> >> text.append("level=10, 9") >> >> >> >> lines.append(plt.contour(xe,ye,h, levels=[5,4], linestyles="--", colors="r")) >> >> text.append("level=5, 4") >> >> >> >> plt.legend(lines, text) >> >> Everything goes well untill I plot the legend. At the end of the mail >> I report the error that I get. >> Anyway, if I do >> >> plt.legend(lines) >> I don't get any errors but it's quite useless, since the text of the >> legend is just like: >> <matplotlib.contour.ContourSet instance at 0x6bedc20> >> as you can see from the attached figure. >> >> >> I've the feeling that the problem is that "contour" gives back a >> "matplotlib.contour.ContourSet instance", while the functions like >> "plot" gives back a "<matplotlib.lines.Line2D object". >> >> Does anyone knows how to do what I want? >> > Hi Francesco, > > here's one way of getting what you want, instead of calling > legend on your 'lines' variable as you had it, do this: > > actual_lines = [cs.collections[0] for cs in lines] > plt.legend(actual_lines, text) > > As you note, the call to plt.countour does not return lines, it > returns contour sets (which is why I called the variable 'cs' in > my example). Poking around in ipython, I saw that each contour > set has a collections attribute which holds the actual lines. > > hope that helps, > -- > 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) > > iEYEARECAAYFAk05+ssACgkQe+cmRQ8+KPfQnACaAr1YGFoiUmRrmz1/W+eTB8ly > 3b0AoInVelg2TYu1J3QpDj3WfO0Ko5zW > =vh8b > -----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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >
etc for producing images at various scales) Reply-To: In-Reply-To: <20110121232036.GA26739@ykcyc> X-PGP-Key: http://pirsquared.org/PaulIvanov0F3E28F7.asc Paul Ivanov, on 2011年01月21日 15:20, wrote: > I'm almost certain that one *can* write a function to do this > pro grammatically (without having to hand tweak anything), by > looking at say, the .get_window_extent() but I haven't found the > time to scratch that itch, yet. > > If someone wants to beat me to it, here's the sort of thing that > you can do: > > def show_labels_by_shrinking(ax): > " adjust subplot parameters to fit the yaxis label" > f = ax.figure > textwidth = ax.yaxis.get_label().get_window_extent().width > labelwidth = max([lab.get_window_extent().width for lab in ax.get_yticklabels()]) > plt.subplots_adjust(left=(textwidth+labelwidth+3*ax.yaxis.labelpad)/f.get_window_extent().width) > # the 3 *ax.yaxis.labelpad is just a fudge factor for now, need > # to look into the sourcecode to figure out what the > # appropriate placement is normally, to know how to adjust > # properly > > > ax.set_ylabel('foo') > show_labels_by_shrinking(ax) > ax.set_ylabel("a\nmulti\nline\nexample") > show_labels_by_shrinking(ax) I should add that along with doing a similar thing for the xaxis, this would need to be extended for the multiple subplot case, to also adjust the wspace and hspace parameters accordingly. this is important functionality currently missing from matplotlib out-of-the-box at the moment, so I'll try my crack at it this out this weekend. CCing the devel list in case someone has more opinions. best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
Daryl Herzmann, on 2011年01月21日 16:41, wrote: > On Fri, Jan 21, 2011 at 4:15 PM, Paul Ivanov <piv...@gm...> wrote: > > > I guess I'm not sure what you meant by the fonts looking 'nasty', > > so if font.size doesn't address your issue, could you post a > > small example that does the wrong thing, along with the type of > > output you were hoping to get. > > Thanks for the responses and sorry to not be clear. Here is an example script: > > import matplotlib.pyplot as plt > > fig = plt.figure(figsize=(8,8)) > > ax = fig.add_subplot(111) > > ax.plot( [0,100], [0,100] ) > ax.set_xlabel("Temperature after the sun goes down $^{\circ}F$") > ax.set_ylabel("Temperature when the sun goes up $^{\circ}F$") > ax.set_title("My Fancy Plot!!!") > > fig.savefig('test.png', dpi=(40)) > > > with 3 different outputs. First two numbers are figsize settings and > last is DPI. > > In my perfect world, I would like to simple to this at the end of my script: > > fig.savefig('thumbnail.png', .....) > fig.savefig('fullsize.png', ......) > > and get two clean looking images. If I have to rerun the script with > different options to get a thumbnail and then a fullsize, that is okay > too. I just can't figure out what all needs to be tweeked / how to do > it.. Daryl, ok, much clearer now - what you want is for your text to not be cut-off the way it is in the 8x8 80dpi plot? In other words, there's not enough space left in the figure for the axis labels to be completely displayed. At the moment, I don't think there's a simple way of doing it, and the quick way I find myself doing is by adjusting the subplot parameters using: plt.subplots_adjust(left=..., bottom=...) I'm almost certain that one *can* write a function to do this pro grammatically (without having to hand tweak anything), by looking at say, the .get_window_extent() but I haven't found the time to scratch that itch, yet. If someone wants to beat me to it, here's the sort of thing that you can do: def show_labels_by_shrinking(ax): " adjust subplot parameters to fit the yaxis label" f = ax.figure textwidth = ax.yaxis.get_label().get_window_extent().width labelwidth = max([lab.get_window_extent().width for lab in ax.get_yticklabels()]) plt.subplots_adjust(left=(textwidth+labelwidth+3*ax.yaxis.labelpad)/f.get_window_extent().width) # the 3 *ax.yaxis.labelpad is just a fudge factor for now, need # to look into the sourcecode to figure out what the # appropriate placement is normally, to know how to adjust # properly ax.set_ylabel('foo') show_labels_by_shrinking(ax) ax.set_ylabel("a\nmulti\nline\nexample") show_labels_by_shrinking(ax) best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
On Fri, Jan 21, 2011 at 4:15 PM, Paul Ivanov <piv...@gm...> wrote: > I guess I'm not sure what you meant by the fonts looking 'nasty', > so if font.size doesn't address your issue, could you post a > small example that does the wrong thing, along with the type of > output you were hoping to get. Thanks for the responses and sorry to not be clear. Here is an example script: import matplotlib.pyplot as plt fig = plt.figure(figsize=(8,8)) ax = fig.add_subplot(111) ax.plot( [0,100], [0,100] ) ax.set_xlabel("Temperature after the sun goes down $^{\circ}F$") ax.set_ylabel("Temperature when the sun goes up $^{\circ}F$") ax.set_title("My Fancy Plot!!!") fig.savefig('test.png', dpi=(40)) with 3 different outputs. First two numbers are figsize settings and last is DPI. In my perfect world, I would like to simple to this at the end of my script: fig.savefig('thumbnail.png', .....) fig.savefig('fullsize.png', ......) and get two clean looking images. If I have to rerun the script with different options to get a thumbnail and then a fullsize, that is okay too. I just can't figure out what all needs to be tweeked / how to do it.. thanks, daryl
On 01/21/2011 11:42 AM, Daryl Herzmann wrote: > Greetings matplotlib users, > > Firstly, thank you so much for a great python plotting library. I use > it daily and find the library very intuitive :) My question deals > with generating raster images at multiple scales without heavy code > modification. My work flow is to generate two versions of the same > plot, one thumbnail (~ 320x320) and then one 'full size' around (~ > 800x800) in PNG format for the web. > > My current methodology is to generate a postscript file and then send > it through ImageMagick's convert to generate the two different sized > images. I find that this works 'good enough for me', but I often run > into problems when I have transparency in the plot and that > information is lost in the translation of formats... I also get > fairly bulky file sizes, but that is probably my fault for not using > the proper convert flags, anyway... > > I have tried messing around with the dpi and figsize settings to the > initial: fig = plt.figure() and fig.savefig() , but I can't seem to > get similiar quality to my hacky method outlined above. Many times, > the fonts look nasty :) I don't know what would be causing that; we routinely generate png files directly from mpl for a thumbnail and a full-size figure, simply changing the dpi kwarg in savefig, and the results have been satisfactory. Can you post a simple script and pair of png files illustrating the problem? (Here is a page of such thumbnails; clicking on one brings up the full-size version. http://currents.soest.hawaii.edu/uhdas_fromships/kilomoana/figs/) Eric > > Any tips or tricks to make this happen? Thanks again and I sincerely > apologize if I missed a FAQ item , etc on this... > > daryl > > ------------------------------------------------------------------------------ > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Daryl Herzmann, on 2011年01月21日 15:42, wrote: > Greetings matplotlib users, > > Firstly, thank you so much for a great python plotting library. I use > it daily and find the library very intuitive :) My question deals > with generating raster images at multiple scales without heavy code > modification. My work flow is to generate two versions of the same > plot, one thumbnail (~ 320x320) and then one 'full size' around (~ > 800x800) in PNG format for the web. > > My current methodology is to generate a postscript file and then send > it through ImageMagick's convert to generate the two different sized > images. I find that this works 'good enough for me', but I often run > into problems when I have transparency in the plot and that > information is lost in the translation of formats... I also get > fairly bulky file sizes, but that is probably my fault for not using > the proper convert flags, anyway... > > I have tried messing around with the dpi and figsize settings to the > initial: fig = plt.figure() and fig.savefig() , but I can't seem to > get similiar quality to my hacky method outlined above. Many times, > the fonts look nasty :) > > Any tips or tricks to make this happen? Thanks again and I sincerely > apologize if I missed a FAQ item , etc on this... Hi Daryl, I'm not sure I understand what it is that you want, but if the issue is related to scaling fonts depending on output figure size and/or dpi - have you tried playing around with the 'font.size' rcParam, and defining your font sized using 'xx-small', 'x-large', etc, instead of specifying a point size directly? From .matplotlibrc: # note that font.size controls default text sizes. To configure # special text sizes tick labels, axes, labels, title, etc, see the rc # settings for axes and ticks. Special text sizes can be defined # relative to font.size, using the following values: xx-small, x-small, # small, medium, large, x-large, xx-large, larger, or smaller #font.size : 12.0 I guess I'm not sure what you meant by the fonts looking 'nasty', so if font.size doesn't address your issue, could you post a small example that does the wrong thing, along with the type of output you were hoping to get. My feeling is that there shouldn't be a need to use ImageMagick - but depending on the size and dpi of your desired figures, is the problem that the text is not being antialiased? best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
Greetings matplotlib users, Firstly, thank you so much for a great python plotting library. I use it daily and find the library very intuitive :) My question deals with generating raster images at multiple scales without heavy code modification. My work flow is to generate two versions of the same plot, one thumbnail (~ 320x320) and then one 'full size' around (~ 800x800) in PNG format for the web. My current methodology is to generate a postscript file and then send it through ImageMagick's convert to generate the two different sized images. I find that this works 'good enough for me', but I often run into problems when I have transparency in the plot and that information is lost in the translation of formats... I also get fairly bulky file sizes, but that is probably my fault for not using the proper convert flags, anyway... I have tried messing around with the dpi and figsize settings to the initial: fig = plt.figure() and fig.savefig() , but I can't seem to get similiar quality to my hacky method outlined above. Many times, the fonts look nasty :) Any tips or tricks to make this happen? Thanks again and I sincerely apologize if I missed a FAQ item , etc on this... daryl
Francesco Montesano, on 2011年01月21日 15:44, wrote: > Dear All, > > I am using contour plot and I am drawing different contours with > different colors and linestyles and I would like to have a legend with > a caption for each contour function used. > Here you can see an example of what I would like to do > > >> #create the 2D histogram and the x and y axis > >> x, y = np.random.normal(0, 0.5, 1000), np.random.normal(0, 1, 1000) > >> h, xe,ye = np.histogram2d(x,y, bins=25) > >> xe, ye = (xe[1:]+xe[:-1])/2, (ye[1:]+ye[:-1])/2 > >> > >> lines,text = [], [] # initialise lists > >> > >> #contour plots > >> lines.append(plt.contour(xe,ye,h, levels=[10,9], linestyles="-", colors="k")) > >> text.append("level=10, 9") > >> > >> lines.append(plt.contour(xe,ye,h, levels=[5,4], linestyles="--", colors="r")) > >> text.append("level=5, 4") > >> > >> plt.legend(lines, text) > > Everything goes well untill I plot the legend. At the end of the mail > I report the error that I get. > Anyway, if I do > >> plt.legend(lines) > I don't get any errors but it's quite useless, since the text of the > legend is just like: > <matplotlib.contour.ContourSet instance at 0x6bedc20> > as you can see from the attached figure. > > > I've the feeling that the problem is that "contour" gives back a > "matplotlib.contour.ContourSet instance", while the functions like > "plot" gives back a "<matplotlib.lines.Line2D object". > > Does anyone knows how to do what I want? > Hi Francesco, here's one way of getting what you want, instead of calling legend on your 'lines' variable as you had it, do this: actual_lines = [cs.collections[0] for cs in lines] plt.legend(actual_lines, text) As you note, the call to plt.countour does not return lines, it returns contour sets (which is why I called the variable 'cs' in my example). Poking around in ipython, I saw that each contour set has a collections attribute which holds the actual lines. hope that helps, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
Homebrew is a newish package management system that is Git-based: http://mxcl.github.com/homebrew/ ................................................................................... Uri Laserson Graduate Student, Biomedical Engineering Harvard-MIT Division of Health Sciences and Technology M +1 917 742 8019 las...@mi... On Fri, Jan 21, 2011 at 12:27, Friedrich Romstedt < fri...@gm...> wrote: > 2011年1月20日 Uri Laserson <las...@mi...>: > > Hi all, > > I recently reinstalled MPL from scratch on top of python2.7 that I built > > from scratch using homebrew on OS X Snow Leopard. Since then, I have > been > > getting the following types of warnings whenever I plot something: > > > /Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/font_manager.py:1242: > > UserWarning: findfont: Font family ['sans-serif'] not found. Falling back > to > > Bitstream Vera Sans > > (prop.get_family(), self.defaultFamily[fontext])) > > I'm not sure what you mean by "using homebrew" (is this a software > package or do you mean you compiled it yourself), but have you > specified anything special in your matplotlibrc? > > Friedrich >
Problem solved. Thanks! Uri ................................................................................... Uri Laserson Graduate Student, Biomedical Engineering Harvard-MIT Division of Health Sciences and Technology M +1 917 742 8019 las...@mi... On Fri, Jan 21, 2011 at 12:44, todd rme <tod...@gm...> wrote: > On Thu, Jan 20, 2011 at 2:09 PM, Uri Laserson <las...@mi...> wrote: > > Hi all, > > I recently reinstalled MPL from scratch on top of python2.7 that I built > > from scratch using homebrew on OS X Snow Leopard. Since then, I have > been > > getting the following types of warnings whenever I plot something: > > > /Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/font_manager.py:1242: > > UserWarning: findfont: Font family ['sans-serif'] not found. Falling back > to > > Bitstream Vera Sans > > (prop.get_family(), self.defaultFamily[fontext])) > > Do I need to specify some configuration parameter to point somewhere that > > the installer couldn't find? > > Thanks! > > Uri > > I had the same problem when I upgraded from python 2.6 to 2.7. For > me, the issue turned out to be with my matplotlib font cache, which > was stored in my matplotlib config directory. On linux it is in > .matplotlib directory in the home directory, I am not sure if this is > where it is on a mac. I deleted the fontList.cache file and the > tex.cache directory stored there, and that fixed the problem. I am > not sure you need to delete both of these, but since they were just > caches I went ahead and did so. > > -Todd > > > ------------------------------------------------------------------------------ > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
2011年1月21日 todd rme <tod...@gm...>: > I had the same problem when I upgraded from python 2.6 to 2.7. For > me, the issue turned out to be with my matplotlib font cache, which > was stored in my matplotlib config directory. On linux it is in > .matplotlib directory in the home directory, I am not sure if this is > where it is on a mac. It's ~/.matplotlib/fontList.cache on Mac too. > I deleted the fontList.cache file and the > tex.cache directory stored there, and that fixed the problem. I am > not sure you need to delete both of these, but since they were just > caches I went ahead and did so. Friedrich
Bala subramanian, on 2011年01月21日 12:17, wrote: > Daniel, > Did you try saving the figure with same dpi ?. Try the following. > > plt.savefig('name',dpi=300) > > On Fri, Jan 21, 2011 at 9:08 AM, Daniel Mader < > dan...@go...> wrote: > > > Hi, > > > > I need to create a huge range of plots with need to fit into a report > > (OpenOffice or Word). In order to save the work of manual resizing them when > > dragged and dropped, I wanted to preset a correct figure size with a nice > > resolution: > > > > pylab.rcParams['figure.figsize'] = 5,4 > > pylab.rcParams['figure.dpi'] = 300 > > > > Now, the created figure has a size of 500x400 pixels, and when I import it > > into a word processor, its dimensions are reported as 12.7x10.16cm2, which > > matches the figsize definition. Yet, the resulting images are pretty much > > blurred... > > > > How can I increase the resolution, or what am I doing wrong? Hi Daniel, As Bala alluded - there's a difference between display dpi and the file saving dpi. Your change to rcParams only affected the displayed resolution, not the resolution of saved files. Quoting from .matplotlibrc # the default savefig params can be different from the display params # Eg, you may want a higher resolution, or to make the figure # background white #savefig.dpi : 100 # figure dots per inch So try playing around with that parameter (which is what you're doing if you call plt.savefig('name', dpi=300) best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
On Thu, Jan 20, 2011 at 2:09 PM, Uri Laserson <las...@mi...> wrote: > Hi all, > I recently reinstalled MPL from scratch on top of python2.7 that I built > from scratch using homebrew on OS X Snow Leopard. Since then, I have been > getting the following types of warnings whenever I plot something: > /Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/font_manager.py:1242: > UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to > Bitstream Vera Sans > (prop.get_family(), self.defaultFamily[fontext])) > Do I need to specify some configuration parameter to point somewhere that > the installer couldn't find? > Thanks! > Uri I had the same problem when I upgraded from python 2.6 to 2.7. For me, the issue turned out to be with my matplotlib font cache, which was stored in my matplotlib config directory. On linux it is in .matplotlib directory in the home directory, I am not sure if this is where it is on a mac. I deleted the fontList.cache file and the tex.cache directory stored there, and that fixed the problem. I am not sure you need to delete both of these, but since they were just caches I went ahead and did so. -Todd