SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

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
(19)
2
(30)
3
(14)
4
(1)
5
(16)
6
(7)
7
(12)
8
(14)
9
(35)
10
(16)
11
(31)
12
(6)
13
(14)
14
(13)
15
(20)
16
(15)
17
(27)
18
(5)
19
(10)
20
(22)
21
(20)
22
(30)
23
(25)
24
(11)
25
(2)
26
(2)
27
(23)
28
(20)
29
(26)
30
(25)
31
(7)

Showing 22 results of 22

From: Jae-Joon L. <lee...@gm...> - 2009年07月20日 22:44:34
index for subplot starts from 1, not 0 (the convention is from Matlab).
Regards,
-JJ
On Mon, Jul 20, 2009 at 6:31 PM, W. Augustine Dunn
III<wad...@gm...> wrote:
> Hello y'all:
>
> I am trying to plot a fig with three subplots. However when I run my
> script the subplots are all shifted way too high
> (http://img.skitch.com/20090720-fp462u8ww4bq38j29u9bjtr2cx.png) and
> the top subplot is cut off.
>
> I tried doing something like this from reading another poster's thread
> but this did absolutely nothing:
> mpl.figure.SubplotParams(left=   (48 / 72.0) / figW,  # 48-point left margin
>                   bottom=  (36 / 72.0) / figH,  # etc.
>                   right= 1 - (18 / 72.0) / figW,
>                   top=  1 - (12 / 72.0) / figH)
>
> Anyone have an idea how to fix this.
>
> Thank you for your time.
>
> Gus
>
> The code is below for those interested:
> <code>
> supTitle = 'Ortholog Pairs Matching "Real" or "Control" Ag miRNA seeds.'
>
> data = []
> for dFile in iFiles:
>  data.append(pickle.load(open(dFile,'rU')))
>
> ks = []
> for i in range(len(data)):
>  ks.append(sorted(data[i].keys()))
>
> for i in range(len(ks)):
>  if "!doc" in ks[i]: ks[i].pop(0) # if the pkl has a !doc entry. pop it
>  assert odd_or_even(len(ks[i])) == 'even', 'Error: len(ks[i]) must be even.'
> pos1Data = eval('[%s]' % ('[],'*len(data)))
> pos1Keys = eval('[%s]' % ('[],'*len(data)))
> pos2Data = eval('[%s]' % ('[],'*len(data)))
> pos2Keys = eval('[%s]' % ('[],'*len(data)))
>
> for i in range(len(ks)):
>  for j in range(len(ks[i])):
>    if odd_or_even(j) == 'even': # remember that we start with 0
> which is even.
>      pos1Data[i].append(data[i][ks[i][j]])
>      pos1Keys[i].append(ks[i][j])
>    else:
>      pos2Data[i].append(data[i][ks[i][j]])
>      pos2Keys[i].append(ks[i][j])
>
> figW = 16
> figH = 8
> plt.figure(num=None, figsize=None, dpi=None, facecolor='w', edgecolor='k')
> subplotpars=mpl.figure.SubplotParams(left=   (48 / 72.0) / figW,
> # 48-point left margin
>                   bottom=  (36 / 72.0) / figH,  # etc.
>                   right= 1 - (18 / 72.0) / figW,
>                   top=  1 - (12 / 72.0) / figH)
>
> plt.suptitle(supTitle)
> for i in range(len(data)):
>  matches1 = [x[0] for x in pos1Data[i]]
>  ctrls1  = [-x[1] for x in pos1Data[i]]
>  matches2 = [x[0] for x in pos2Data[i]]
>  ctrls2  = [-x[1] for x in pos2Data[i]]
>
>  assert len(matches1) == len(matches2), 'Error: matches1 and
> matches 2 do not have the same number of elements!'
>  N = len(matches1)
>
>
>
>  ind = np.arange(N)  # the x locations for the groups
>  width = 0.35    # the width of the bars: can also be len(x) sequence
>
>
>  plt.subplot(len(data),1,i,)
>  p1 = plt.bar(ind, ctrls1,  width, color='w',)
>  p2 = plt.bar(ind, matches1, width, color='b',)
>  p3 = plt.bar(ind+width, ctrls2,  width, color='w',)
>  p4 = plt.bar(ind+width, matches2, width, color='b', )
>  plt.ylabel(subTitles[i])
>  if i == len(data)-1:
>    plt.xlabel('miRNA seed')
>
>  axMax = max(matches1+matches2)*1.1
>  axMin = min(ctrls1+ctrls2)*1.1
>  #plt.axis([0,len(matches1),axMin,axMax])
>  if i == 0:
>    plt.legend( (p2[0], p1[0]), ('Real', 'Ctrls'), loc=(1.01,0.65) )
> </code>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to 100,000ドル in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: W. A. D. I. <wad...@gm...> - 2009年07月20日 22:31:32
Hello y'all:
I am trying to plot a fig with three subplots. However when I run my
script the subplots are all shifted way too high
(http://img.skitch.com/20090720-fp462u8ww4bq38j29u9bjtr2cx.png) and
the top subplot is cut off.
I tried doing something like this from reading another poster's thread
but this did absolutely nothing:
mpl.figure.SubplotParams(left=   (48 / 72.0) / figW,  # 48-point left margin
                   bottom=  (36 / 72.0) / figH,  # etc.
                   right= 1 - (18 / 72.0) / figW,
                   top=  1 - (12 / 72.0) / figH)
Anyone have an idea how to fix this.
Thank you for your time.
Gus
The code is below for those interested:
<code>
supTitle = 'Ortholog Pairs Matching "Real" or "Control" Ag miRNA seeds.'
data = []
for dFile in iFiles:
 data.append(pickle.load(open(dFile,'rU')))
ks = []
for i in range(len(data)):
 ks.append(sorted(data[i].keys()))
for i in range(len(ks)):
 if "!doc" in ks[i]: ks[i].pop(0) # if the pkl has a !doc entry. pop it
 assert odd_or_even(len(ks[i])) == 'even', 'Error: len(ks[i]) must be even.'
pos1Data = eval('[%s]' % ('[],'*len(data)))
pos1Keys = eval('[%s]' % ('[],'*len(data)))
pos2Data = eval('[%s]' % ('[],'*len(data)))
pos2Keys = eval('[%s]' % ('[],'*len(data)))
for i in range(len(ks)):
 for j in range(len(ks[i])):
 if odd_or_even(j) == 'even': # remember that we start with 0
which is even.
 pos1Data[i].append(data[i][ks[i][j]])
 pos1Keys[i].append(ks[i][j])
 else:
 pos2Data[i].append(data[i][ks[i][j]])
 pos2Keys[i].append(ks[i][j])
figW = 16
figH = 8
plt.figure(num=None, figsize=None, dpi=None, facecolor='w', edgecolor='k')
subplotpars=mpl.figure.SubplotParams(left= (48 / 72.0) / figW,
# 48-point left margin
 bottom= (36 / 72.0) / figH, # etc.
 right= 1 - (18 / 72.0) / figW,
 top= 1 - (12 / 72.0) / figH)
plt.suptitle(supTitle)
for i in range(len(data)):
 matches1 = [x[0] for x in pos1Data[i]]
 ctrls1 = [-x[1] for x in pos1Data[i]]
 matches2 = [x[0] for x in pos2Data[i]]
 ctrls2 = [-x[1] for x in pos2Data[i]]
 assert len(matches1) == len(matches2), 'Error: matches1 and
matches 2 do not have the same number of elements!'
 N = len(matches1)
 ind = np.arange(N) # the x locations for the groups
 width = 0.35 # the width of the bars: can also be len(x) sequence
 plt.subplot(len(data),1,i,)
 p1 = plt.bar(ind, ctrls1, width, color='w',)
 p2 = plt.bar(ind, matches1, width, color='b',)
 p3 = plt.bar(ind+width, ctrls2, width, color='w',)
 p4 = plt.bar(ind+width, matches2, width, color='b', )
 plt.ylabel(subTitles[i])
 if i == len(data)-1:
 plt.xlabel('miRNA seed')
 axMax = max(matches1+matches2)*1.1
 axMin = min(ctrls1+ctrls2)*1.1
 #plt.axis([0,len(matches1),axMin,axMax])
 if i == 0:
 plt.legend( (p2[0], p1[0]), ('Real', 'Ctrls'), loc=(1.01,0.65) )
</code>
From: Jae-Joon L. <lee...@gm...> - 2009年07月20日 21:26:51
On Mon, Jul 20, 2009 at 4:48 PM, John [H2O]<was...@gm...> wrote:
>
>
>
> Jae-Joon Lee wrote:
>>
>> get_xmajorticklabels() returns a list of matplotlib's "Text" objects,
>> not python strings.
>>
>
> This is what I've now come to understand, but it seems very odd. Why
> wouldn't it return the list of strings, or alternatively, how can you get
> the list of strings? I guess you have to use the pyplot tools, but I was
> trying to use so called 'fine grain' control and do everything at the axes
> level.
>
Why it does not return a list of strings? Because the documentation
says it does not. Well, I acknowledge the asymetry in the API, but
this is how things are.
How to get the list of strings? Use the "get_text" method of the "Text" object.
http://matplotlib.sourceforge.net/api/artist_api.html?#matplotlib.text.Text.get_text
I used pyplot function because you were calling plt.gca(). If you
don't like it, you can explicitly go over the for loop with
appropriate methods.
for t in ax1.get_xmajorticklabels():
 t.set(size=6,rotation=30)
or use set_size and set_rotation if you prefer.
See the documentation for more details.
Regards,
-JJ
>
>
>>
>> plt.setp(plt.gca().get_xmajorticklabels(),
>>     size=6,rotation=30)
>>
>
> In fact, what you show is how I was testing in ipython and it does worked,
> it just seemed in a script it would be better to use the axis method, but
> apparently it is different from the gca() method. This is what I don't
> understand.
>
> Thanks!
>
>
> On Mon, Jul 20, 2009 at 11:48 AM, John [H2O]<was...@gm...> wrote:
>>
>> I am trying simply to shrink the font size and rotate xaxis labels:
>>
>> fig1 = plt.figure()
>> ax1 = fig1.add_subplot(211)
>> ax2 = fig1.add_subplot(212)
>> ax1.plot_date(x,y,'r')
>> ax1.set_xticklabels(plt.gca().get_xmajorticklabels(),
>>          size=6,rotation=30)
>> ax2.plot_date(o_X['time'],o_X['CO'],'y')
>> ax2.set_xticklabels(plt.gca().get_xmajorticklabels(),
>>           size=6,rotation=30)
>>
>> I end up with labels as: ("Text(0,0"Text(0,0,"")")
>>
>> ????
>> --
>> View this message in context:
>> http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24572302.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> Enter the BlackBerry Developer Challenge
>> This is your chance to win up to 100,000ドル in prizes! For a limited time,
>> vendors submitting new applications to BlackBerry App World(TM) will have
>> the opportunity to enter the BlackBerry Developer Challenge. See full
>> prize
>> details at: http://p.sf.net/sfu/Challenge
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to 100,000ドル in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> View this message in context: http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24577287.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to 100,000ドル in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: John [H2O] <was...@gm...> - 2009年07月20日 20:48:51
Jae-Joon Lee wrote:
> 
> get_xmajorticklabels() returns a list of matplotlib's "Text" objects,
> not python strings.
> 
This is what I've now come to understand, but it seems very odd. Why
wouldn't it return the list of strings, or alternatively, how can you get
the list of strings? I guess you have to use the pyplot tools, but I was
trying to use so called 'fine grain' control and do everything at the axes
level.
> 
> plt.setp(plt.gca().get_xmajorticklabels(),
> size=6,rotation=30)
> 
In fact, what you show is how I was testing in ipython and it does worked,
it just seemed in a script it would be better to use the axis method, but
apparently it is different from the gca() method. This is what I don't
understand.
Thanks!
On Mon, Jul 20, 2009 at 11:48 AM, John [H2O]<was...@gm...> wrote:
>
> I am trying simply to shrink the font size and rotate xaxis labels:
>
> fig1 = plt.figure()
> ax1 = fig1.add_subplot(211)
> ax2 = fig1.add_subplot(212)
> ax1.plot_date(x,y,'r')
> ax1.set_xticklabels(plt.gca().get_xmajorticklabels(),
>          size=6,rotation=30)
> ax2.plot_date(o_X['time'],o_X['CO'],'y')
> ax2.set_xticklabels(plt.gca().get_xmajorticklabels(),
>           size=6,rotation=30)
>
> I end up with labels as: ("Text(0,0"Text(0,0,"")")
>
> ????
> --
> View this message in context:
> http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24572302.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to 100,000ドル in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full
> prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge 
This is your chance to win up to 100,000ドル in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize 
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
View this message in context: http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24577287.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Lukas H. <Lu...@gm...> - 2009年07月20日 19:58:59
Hm.. I added a resize() after the show():
class Plot_tab(QTabWidget, tab):
 def __init__(self):
 super(Plot_tab, self).__init__()
 self.setupUi(self)
 self.show()
 self.resize(self.size().width()+1, self.size().height()+1)
 self.resize(self.size().width()-1, self.size().height()-1)
if __name__ == "__main__":
 import sys
 app = QApplication(sys.argv)
 plot_t = Plot_tab()
 sys.exit(app.exec_())
Now it works, but I really want to know why..?
Is there a way to avoid this ugly workaround?
Thanks,
Lukas
Am Sonntag 19 Juli 2009 12:58:53 schrieb Lukas Hetzenecker:
> Hello,
>
> I've tried to resize the QTabWidget, I've searched for examples on the
> internet, added a QTabWidget and used this as the Mainwindows central
> widget - but exactly the same happened.
>
> It works if I replace the FigureCanvas with a Qt Widget - for example a
> text edit or a QWebView.
>
> Am Sonntag 19 Juli 2009 11:54:12 schrieb projetmbc:
> > Lukas Hetzenecker a écrit :
> > > I tried to embed a Matplotlib FigureCanvas into a QTabWidget.
> > > But at the first start of my script - the main.py in the attatched
> > > example - the widget in the Tab is incorrectly sized.
> > > If I embed the FigureCanvas in a QTabWidget the widget is to big, but
> > > if I put it in a QWidget it is shown correctly.
> >
> > I'm not sure that is a pure MatPlotLib issue. Have you try with a big
> > standard widget instead of the FigureCanvas ?
> >
> > Christophe
>
> ---------------------------------------------------------------------------
>--- Enter the BlackBerry Developer Challenge
> This is your chance to win up to 100,000ドル in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jae-Joon L. <lee...@gm...> - 2009年07月20日 19:37:32
get_xmajorticklabels() returns a list of matplotlib's "Text" objects,
not python strings.
http://matplotlib.sourceforge.net/api/axes_api.html?highlight=get_xmajorticklabels#matplotlib.axes.Axes.get_xmajorticklabels
On the other hand, set_xticklabels() takes a list of python strings.
http://matplotlib.sourceforge.net/api/axes_api.html?highlight=set_xticklabels#matplotlib.axes.Axes.set_xticklabels
Something like below will work.
plt.setp(plt.gca().get_xmajorticklabels(),
 size=6,rotation=30)
-JJ
On Mon, Jul 20, 2009 at 11:48 AM, John [H2O]<was...@gm...> wrote:
>
> I am trying simply to shrink the font size and rotate xaxis labels:
>
> fig1 = plt.figure()
> ax1 = fig1.add_subplot(211)
> ax2 = fig1.add_subplot(212)
> ax1.plot_date(x,y,'r')
> ax1.set_xticklabels(plt.gca().get_xmajorticklabels(),
>          size=6,rotation=30)
> ax2.plot_date(o_X['time'],o_X['CO'],'y')
> ax2.set_xticklabels(plt.gca().get_xmajorticklabels(),
>           size=6,rotation=30)
>
> I end up with labels as: ("Text(0,0"Text(0,0,"")")
>
> ????
> --
> View this message in context: http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24572302.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to 100,000ドル in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Abhinav V. <abh...@gm...> - 2009年07月20日 18:29:49
and if you look at the cookbook .. you can see all the available colormaps..
http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps
have fun
On Mon, Jul 20, 2009 at 8:25 PM, Eric Firing <ef...@ha...> wrote:
> Ritayan Mitra wrote:
> > Hello
> > I am trying to use imshow as below
> >
> > im = imshow(Z, interpolation='spline16', origin='lower', cmap=cm.hot,
> > extent=(-1.,1.,-1.,1.))
> >
> > Trouble is I want to reverse the color gradient or use some colorscheme
> > which has lighter color at the bottom and darker higher up. What is the
> > easiest solution to this problem? Thanks a bunch.
>
> All the standard colormaps like cm.hot have reversed counterparts with
> "_r" appended to the name, so use cmap=cm.hot_r.
>
> Eric
> >
> > Rit
> >
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to 100,000ドル in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Eric F. <ef...@ha...> - 2009年07月20日 18:25:13
Ritayan Mitra wrote:
> Hello
> I am trying to use imshow as below
> 
> im = imshow(Z, interpolation='spline16', origin='lower', cmap=cm.hot,
> extent=(-1.,1.,-1.,1.))
> 
> Trouble is I want to reverse the color gradient or use some colorscheme
> which has lighter color at the bottom and darker higher up. What is the
> easiest solution to this problem? Thanks a bunch.
All the standard colormaps like cm.hot have reversed counterparts with 
"_r" appended to the name, so use cmap=cm.hot_r.
Eric
> 
> Rit
> 
From: Chloe L. <ch...@na...> - 2009年07月20日 18:23:46
(almost?) all the colormaps exist in reversed forms, eg, cm.hot_r
On Jul 20, 2009, at 10:47 AM, Ritayan Mitra wrote:
> Hello
> I am trying to use imshow as below
>
> im = imshow(Z, interpolation='spline16', origin='lower', cmap=cm.hot,
> extent=(-1.,1.,-1.,1.))
>
> Trouble is I want to reverse the color gradient or use some 
> colorscheme
> which has lighter color at the bottom and darker higher up. What is 
> the
> easiest solution to this problem? Thanks a bunch.
>
> Rit
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to 100,000ドル in prizes! For a limited 
> time,
> vendors submitting new applications to BlackBerry App World(TM) will 
> have
> the opportunity to enter the BlackBerry Developer Challenge. See 
> full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Chloe Lewis
Graduate student, Amundson Lab
Division of Ecosystem Sciences, ESPM
University of California, Berkeley
137 Mulford Hall - #3114
Berkeley, CA 94720-3114
ch...@na...
From: Ritayan M. <rm...@uc...> - 2009年07月20日 18:19:42
Hello
 I am trying to use imshow as below
im = imshow(Z, interpolation='spline16', origin='lower', cmap=cm.hot,
extent=(-1.,1.,-1.,1.))
Trouble is I want to reverse the color gradient or use some colorscheme
which has lighter color at the bottom and darker higher up. What is the
easiest solution to this problem? Thanks a bunch.
Rit
From: Darren D. <dsd...@gm...> - 2009年07月20日 17:51:48
Hi Ala,
On Mon, Jul 20, 2009 at 11:44 AM, Ala Al-Shaibani<sha...@ym...> wrote:
> Hello everyone.
> A users on the networkx mailing list posted this example which is a
> modification of the matplotlib-pyqt4 implementation which plots a networkx
> graph.
> The problem I am facing with it is that two plot windows open instead of
> one, one is empty and the other contains the graph.
> I can't really put my finger as to why two windows open rather than just one
> pyqt window with the plot. Any suggestions would be appreciated.
> Screenshot of the two plot windows:
> http://img259.imageshack.us/img259/8722/picture1ahr.jpg
> Code:
>
> #!/usr/bin/env python
>
> # embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib
> canvases
>
> #
>
> # Copyright (C) 2005 Florent Rougon
>
> #       2006 Darren Dale
>
> #
>
> # This file is an example program for matplotlib. It may be used and
>
> # modified with no restriction; raw copies as well as modified versions
>
> # may be distributed without limitation.
>
> import sys, os, random
>
> from PyQt4 import QtGui, QtCore
>
> from numpy import arange, sin, pi
>
> from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
> FigureCanvas
>
> from matplotlib.figure import Figure
>
> import networkx as nx
>
> progname = os.path.basename(sys.argv[0])
>
> progversion = "0.1"
>
> class MyMplCanvas(FigureCanvas):
>
>   """Ultimately, this is a QWidget (as well as a FigureCanvasAgg,
> etc.)."""
>
>   def __init__(self, parent=None, width=5, height=4, dpi=100):
>
>     fig = Figure(figsize=(width, height), dpi=dpi)
>
>     self.axes = fig.add_subplot(111)
>
>     # We want the axes cleared every time plot() is called
>
>     self.axes.hold(False)
>
>     self.compute_initial_figure()
>
>     #
>
>     FigureCanvas.__init__(self, fig)
>
>     self.setParent(parent)
>
>     FigureCanvas.setSizePolicy(self,
>
>                  QtGui.QSizePolicy.Expanding,
>
>                  QtGui.QSizePolicy.Expanding)
>
>     FigureCanvas.updateGeometry(self)
>
>   def compute_initial_figure(self):
>
>     pass
>
> class MyStaticMplCanvas(MyMplCanvas):
>
>   """Simple canvas with a sine plot."""
>
>   def compute_initial_figure(self):
>
>     G=nx.path_graph(10)
>
>     pos=nx.spring_layout(G)
>
>     nx.draw(G,pos,ax=self.axes)
I think this must be the problem. It looks like networkx is providing
or building upon the pylab interface, which takes care of creating
windows for you. So you are mixing with the object oriented interface
from MyMplCanvas, which should not be done. If you want to embed
matplotlib in a GUI application, you need to stick with the object
oriented interface. Something like:
 self.axes.some_plot_command(...)
Darren
From: Blaine B. <fr...@gm...> - 2009年07月20日 17:36:58
hey everyone,
 I have an interactive python application that I am using pylab with. I am
having a problem where I can only create a graph ONE time. all other calls
to plot() and show() cause nothing to happen.
 I have used ipython -pylab as well, but the problem I am having with
ipython is that all the graphs will show up AFTER i close my interactive
shell. Of course, ipython works interatively every time I 'plot' or 'show'
at the ipython command line.
 Is this a backend issue? Does anyone else have this problem?
issue can be summarized as such:
>>>from pylab import *
>>>def p():
 plot([1,2], [1,2])
 show()
>>>p() // works fine. graph pops up.
>>>p() //returns nothing, no graph shows up
>>>p() //same as above
I am on Debian Lenny, pylab .98.3-5
Blaine
From: Christophe D. <chr...@vh...> - 2009年07月20日 16:39:23
Hello all,
 
I've been trying to use the volume_overlay functions from matplotlib.finance without luck.
Is anyone using it? 
 
Below is a simple test program. When I run it, all the volume bars have the same height.
 
Thanks,
 
Christophe
 
#!/usr/bin/env python
from pylab import *
from matplotlib.dates import DateFormatter, WeekdayLocator, HourLocator, \
 DayLocator, MONDAY, timezone
from matplotlib.finance import volume_overlay3
 
 
mondays = WeekdayLocator(MONDAY) # major ticks on the mondays
alldays = DayLocator() # minor ticks on the days
weekFormatter = DateFormatter('%b %d') # Eg, Jan 12
dayFormatter = DateFormatter('%d') # Eg, 12
 
quotes = [(733456.33402777778, 129.5994, 130.0, 130.55000000000001, 129.5, 6178), (733456.33472222218, 129.75, 129.30000000000001, 129.75, 129.30000000000001, 9109), (733456.3354166667, 129.5, 130.0, 130.0, 129.5, 7548), (733456.3361111111, 130.0, 130.0, 130.0, 130.0, 8039), (733456.3368055555, 130.05000000000001, 130.15000000000001, 130.30000000000001, 130.05000000000001, 9633), (733456.33750000002, 130.40000000000001, 130.15000000000001, 130.59999999999999, 130.15000000000001, 2103), (733456.33819444443, 130.15000000000001, 130.44999999999999, 130.44999999999999, 130.15000000000001, 5428), (733456.33888888895, 130.44999999999999, 130.30000000000001, 130.44999999999999, 130.30000000000001, 2025), (733456.33958333335, 130.30000000000001, 130.15000000000001, 130.55000000000001, 130.15000000000001, 3429), (733456.34027777775, 128.90000000000001, 130.05000000000001, 130.09999999999999, 128.90000000000001, 1268), (733456.34097222227, 130.09999999999999, 130.19800000000001, 130.19800000000001, 130.05000000000001, 2891), (733456.34166666667, 130.19999999999999, 130.34999999999999, 130.34999999999999, 130.19999999999999, 1093), (733456.34236111108, 130.40000000000001, 130.44999999999999, 130.5, 130.40000000000001, 1102)]
 
fig = figure()
fig.subplots_adjust(bottom=0.2)
ax = fig.add_subplot(111)
ax.xaxis.set_major_locator(mondays)
ax.xaxis.set_minor_locator(alldays)
ax.xaxis.set_major_formatter(weekFormatter)
ax.xaxis.set_minor_formatter(dayFormatter)
 
volume_overlay3(ax, quotes)
 
ax.xaxis_date()
ax.autoscale_view()
setp( gca().get_xticklabels(), rotation=45, horizontalalignment='right')
 
show()
From: Ala Al-S. <sha...@ym...> - 2009年07月20日 16:11:14
Hello everyone.
A users on the networkx mailing list posted this example which is a modification of the matplotlib-pyqt4 implementation which plots a networkx graph.
The problem I am facing with it is that two plot windows open instead of one, one is empty and the other contains the graph.
I can't really put my finger as to why two windows open rather than just one pyqt window with the plot. Any suggestions would be appreciated.
Screenshot of the two plot windows:
http://img259.imageshack.us/img259/8722/picture1ahr.jpg
Code:
#!/usr/bin/env python
# embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib canvases
#
# Copyright (C) 2005 Florent Rougon
# 2006 Darren Dale
#
# This file is an example program for matplotlib. It may be used and
# modified with no restriction; raw copies as well as modified versions
# may be distributed without limitation.
import sys, os, random
from PyQt4 import QtGui, QtCore
from numpy import arange, sin, pi
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
import networkx as nx
progname = os.path.basename(sys.argv[0])
progversion = "0.1"
class MyMplCanvas(FigureCanvas):
 """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""
 def __init__(self, parent=None, width=5, height=4, dpi=100):
 fig = Figure(figsize=(width, height), dpi=dpi)
 self.axes = fig.add_subplot(111)
 # We want the axes cleared every time plot() is called
 self.axes.hold(False)
 self.compute_initial_figure()
 #
 FigureCanvas.__init__(self, fig)
 self.setParent(parent)
 FigureCanvas.setSizePolicy(self,
 QtGui.QSizePolicy.Expanding,
 QtGui.QSizePolicy.Expanding)
 FigureCanvas.updateGeometry(self)
 def compute_initial_figure(self):
 pass
class MyStaticMplCanvas(MyMplCanvas):
 """Simple canvas with a sine plot."""
 def compute_initial_figure(self):
 G=nx.path_graph(10)
 pos=nx.spring_layout(G)
 nx.draw(G,pos,ax=self.axes)
class ApplicationWindow(QtGui.QMainWindow):
 def __init__(self):
 QtGui.QMainWindow.__init__(self)
 self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
 self.setWindowTitle("application main window")
 self.file_menu = QtGui.QMenu('&File', self)
 self.file_menu.addAction('&Quit', self.fileQuit,
 QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
 self.menuBar().addMenu(self.file_menu)
 self.help_menu = QtGui.QMenu('&Help', self)
 self.menuBar().addSeparator()
 self.help_menu.addAction('&About', self.about)
 self.menuBar().addMenu(self.help_menu)
 self.main_widget = QtGui.QWidget(self)
 l = QtGui.QVBoxLayout(self.main_widget)
 sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100)
 l.addWidget(sc)
 self.main_widget.setFocus()
 self.setCentralWidget(self.main_widget)
 self.statusBar().showMessage("All hail matplotlib!", 2000)
 def fileQuit(self):
 self.close()
 def closeEvent(self, ce):
 self.fileQuit()
 def about(self):
 QtGui.QMessageBox.about(self, "About %s" % progname,
u"""%(prog)s version %(version)s
Copyright \N{COPYRIGHT SIGN} 2005 Florent Rougon, 2006 Darren Dale
This program is a simple example of a Qt4 application embedding matplotlib
canvases.
It may be used and modified with no restriction; raw copies as well as
modified versions may be distributed without limitation."""
% {"prog": progname, "version": progversion})
qApp = QtGui.QApplication(sys.argv)
aw = ApplicationWindow()
aw.setWindowTitle("%s" % progname)
aw.show()
sys.exit(qApp.exec_())
#qApp.exec_()
 
From: davide l. <las...@gm...> - 2009年07月20日 16:09:07
Hello everybody,
this is my first post in this list. 
I'm plotting a spectrogram with
Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000)
and i want to add a colorbar with
colorbar()
The problem is that the color scale seems to be wrong with respect to
the data in Pxx, i.e. Pxx is of the order of 1e-2 while in the colorbar
i have tick values spanning from -20 to -180. What is the problem??
Thanks in advance!
Davide
From: Darren D. <dsd...@gm...> - 2009年07月20日 16:08:42
Attachments: mpl_test.py
Hi Alexander,
2009年7月20日 Alexander Bruy <vo...@ua...>:
> Sorry, some troubles with my email service. With attachment now
>
>
> 20091707 Darren Dale <dsd...@gm...> wrote:
>>
>> Please post a short, complete, self-contained script demonstrating the
>> problem.
>>
>
> I create a small example, see attachment. There is a simple dialog with QWidget, at which
> matplotlib plot is drawn. When dialog resized the plot don't change it's size.
> I'm would be grateful for an indication of my errors and working example.
You need to add a layout to your widgetPlot, and then add your canvas
to that layout. See attached.
Darren
From: Matthias M. <Mat...@gm...> - 2009年07月20日 16:01:04
Hi Marco,
you can set the yrange for the axes after the historgram was plotted, e.g. :
hist(arange(30)%3)
ylim(0, 15)
best regards Matthias
On Monday 20 July 2009 11:26:27 marcog wrote:
> Hi
>
> Is it possible to set the yrange of a histogram plot? I have a number of
> histograms on separate plots that I would like to have the same yrange to
> make them easier to compare.
>
> Thanks
> Marco
From: John [H2O] <was...@gm...> - 2009年07月20日 15:48:16
I am trying simply to shrink the font size and rotate xaxis labels:
fig1 = plt.figure()
ax1 = fig1.add_subplot(211)
ax2 = fig1.add_subplot(212)
ax1.plot_date(x,y,'r')
ax1.set_xticklabels(plt.gca().get_xmajorticklabels(), 
 size=6,rotation=30) 
ax2.plot_date(o_X['time'],o_X['CO'],'y') 
ax2.set_xticklabels(plt.gca().get_xmajorticklabels(),
 size=6,rotation=30) 
I end up with labels as: ("Text(0,0"Text(0,0,"")")
????
-- 
View this message in context: http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24572302.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: davide l. <las...@gm...> - 2009年07月20日 14:05:17
Hello everybody,
this is my first post in this list. 
I'm plotting a spectrogram with
Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000)
and i want to add a colorbar with
colorbar()
The problem is that the color scale seems to be wrong with respect to
the data in Pxx, i.e. Pxx is of the order of 1e-2 while in the colorbar
i have tick values spanning from -20 to -180. What is the problem??
Thanks in advance!
Davide
From: Astronomical P. <ast...@gm...> - 2009年07月20日 13:38:42
We are pleased to announce the release of APLpy 0.9.3, which includes
bug fixes, improvements, and new features.
APLpy is a python module that makes it easy to interactively produce
publication-quality plots of astronomical images in FITS format. More
details are available at http://aplpy.sourceforge.net/
One of the main additions in this release is the ability to produce RGB
images starting from FITS files with different projections. More
information on the changes in this release is available in the release
notes available from the APLpy homepage.
>From the front page you can sign up to the mailing list and/or the
Twitter feed to be kept up-to-date on future releases.
Cheers,
Eli Bressert and Thomas Robitaille
From: Alexander B. <vo...@ua...> - 2009年07月20日 10:31:38
Attachments: mpl_resize.zip
Sorry, some troubles with my email service. With attachment now
20091707 Darren Dale <dsd...@gm...> wrote:
> 
> Please post a short, complete, self-contained script demonstrating the
> problem.
> 
I create a small example, see attachment. There is a simple dialog with QWidget, at which
matplotlib plot is drawn. When dialog resized the plot don't change it's size.
I'm would be grateful for an indication of my errors and working example.
Regards,
 Alexander Bruy
-- реклама -----------------------------------------------------------
http://FREEhost.com.ua - еще больше места и возможностей.
При заказе хостинга - домен бесплатно.
From: marcog <ma...@ga...> - 2009年07月20日 09:26:34
Hi
Is it possible to set the yrange of a histogram plot? I have a number of
histograms on separate plots that I would like to have the same yrange to
make them easier to compare.
Thanks
Marco
-- 
View this message in context: http://www.nabble.com/Set-Histogram-yrange-tp24566489p24566489.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Showing 22 results of 22

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /