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
(12) |
2
(13) |
3
(4) |
4
(34) |
5
(14) |
6
(23) |
7
(26) |
8
(12) |
9
(7) |
10
(7) |
11
(9) |
12
(12) |
13
(20) |
14
(14) |
15
(13) |
16
(5) |
17
(4) |
18
(22) |
19
(29) |
20
(13) |
21
(9) |
22
(22) |
23
(3) |
24
(3) |
25
(29) |
26
(9) |
27
(10) |
28
(16) |
29
(16) |
30
(16) |
31
(9) |
|
|
|
|
|
|
Let' put things this way: if you have to work with many records, it is better if you have a database. With a database you can query what you need and only this is worthed the effort of using a DB. butterw wrote: > > Hi Alessio, > > Thank you for the sqlite code example. > > What have been the key advantages of using a Database over a > structured array for your applications ? > > http://docs.python.org/library/sqlite3.html : > SQLite is a C library that provides a lightweight disk-based database > that doesn’t require a separate server process and allows accessing > the database using a nonstandard variant of the SQL query language. > > On Sun, Oct 10, 2010 at 12:56 PM, Peter Butterworth <bu...@gm...> > wrote: >> Hi, >> >> >> To load csv data, I use a modified version of csv2rec for which the >> data type of each column is specified explicitly in the data file. >> By removing the dtype guessing you get a speedup and you also avoid >> potential mess-ups. >> >> >> Alessio: sadly you right about it not being possible to trust Excel with >> data. >> Could you please give more details on the sqlite method you suggest ? >> >> >> -- >>>> by Alessio Civ Oct 10, 2010; 09:04am: >> Hi, >> >> a strong advice from someone who is using excel format with tons of >> data is to save them in csv and then import in Sqlite. >> >> Excel messes up the data types and gives a lot of troubles with >> numbers. Sqlite is fast and data are secure. >> The power of this system is that you can query your data and plot what >> you need for example. >> >> I can share with you my script to import from csv to sqlite if you want. >> >> >> -- >> thanks, >> peter butterworth >> > > > > -- > thanks, > peter butterworth > > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today. > http://p.sf.net/sfu/beautyoftheweb > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Best-way-to-use-Excel-Data-tp29908079p29968676.html Sent from the matplotlib - users mailing list archive at Nabble.com.
You are welcome, glad to help. On Thu, Oct 14, 2010 at 4:04 PM, Benoit Gaillard <ben...@un...> wrote: > Thank you very much it all works fine now, > > I downloaded and installed the font in > http://archive.ubuntu.com/ubuntu/pool/main/t/ttf-wqy-zenhei/ttf-wqy-zenhei_0.5.23.orig.tar.gz, > as you advised. Then i deleted the fontList.cache de matplotlib to force its > updating, and ran the script with """ fontname="WenQuanYi Zen Hei" """ > > I can now display the characters and save the plots as pdf. > > Thanks a lot for you wise help, i learned a lot. > > Benoit > > > Quoting sunqiang <sun...@gm...>: > >> On Wed, Oct 13, 2010 at 5:30 PM, Benoit Gaillard >> <ben...@un...> wrote: >>> >>> Actually, i must apologize >>> >>> By calling fonts by their real name eg: "WenQuanYi Zen Hei" (instead of >>> wqy-microhei, their file name), i can display them. So no worries for >>> issue >>> 2. However, I do not manage to export the png to pdf or eps due to the >>> following error: >>> >>> "TrueType font is missing table" >>> >>> Is that due to my changing the font name from *.ttc to *.ttf? >> >> the "c" in ".ttc" means "Container", wqy-*.ttc includes more than one ttf. >> so, maybe just rename *.ttc to *.ttf is not enough. >> I guess, You can find some font tools to extract ttf from ttc, or >> install another Chinese font provided by your operation system. or >> just download the ttf version from >> http://packages.ubuntu.com/hardy/ttf-wqy-zenhei (directly: >> >> http://archive.ubuntu.com/ubuntu/pool/main/t/ttf-wqy-zenhei/ttf-wqy-zenhei_0.5.23.orig.tar.gz) >> I don't know font enough, so I didn't test the first method. I only >> test the last method. >> after download the font into my Window machine. it can display Chinese >> with "'WenQuanYi Zen Hei'" and save figure to png and pdf.(ps, eps >> doesn't work, even without a error log"). >> (my Linux machine(Ubuntu Hardy 8.04) can display Chinese and save >> figure to png, pdf, ps, eps correctly already.) >>> >>> regards, >>> >>> benoit >>> >>> >>> Quoting Benoit Gaillard <ben...@un...>: >>> >>>> Hi, >>>> >>>> When looking in my fontFile.cache, i did not find any of >>>> '/usr/share/fonts/truetype/wqy/wqy-zenhei.ttf', >>>> '/usr/share/fonts/truetype/wqy/wqy-microhei.ttf' or simhei. this is why >>>> i could not display the characters. >>>> >>>> I deleted the cache and re-lounched my script, so that mpl had to look >>>> for the fonts and update the cache. It added the simhei fonts to the >>>> list. I can now display chinese characters with the simhei font. >>>> >>>> I ran into 2 more issues: >>>> - Simhei "has no glyph names", which prevents me from exporting into pdf >>>> - I do not manage to make mpl take into account microhei and zenhei, >>>> whereas i have them in >>>> '/usr/share/fonts/truetype/wqy/wqy-microhei.ttc'. I changed their name >>>> to '/usr/share/fonts/truetype/wqy/wqy-microhei.ttf', and now mpl finds >>>> them. However they fail to display chinese characters >>>> >>>> So, thank you for your help, i managed to display chinese characters >>>> but there are still some issues. Do you have any idea? >>>> >>>> Benoit >>>> >>>> >>>> Quoting sunqiang <sun...@gm...>: >>>> >>>>> oh, only test it on Windows yet. both "sim hei"and "microsoft yahei" >>>>> are fontname on Windows Platform. >>>>> maybe just copy "Sim Hei" to font directory is not enough? no clue >>>>> here. >>>>> >>>>> I just test the script on Linux (Ubuntu 8.04, Python 2.5, matplotlib >>>>> 0.98.4) with the follow steps: >>>>> 1, find the configure directory of matplotlib >>>>> import matplotlib as mpl >>>>> mpl.get_configdir() >>>>> >>>>> return "~/.matplotlib" >>>>> 2, in the configure directory, there is a file "fontList.cache" >>>>> I find this >>>>> (dp294 >>>>> ... >>>>> S'WenQuanYi Zen Hei' >>>>> ... >>>>> S'/usr/share/fonts/truetype/wqy/wqy-zenhei.ttf' >>>>> ... >>>>> >>>>> I just know WenQuanYi is a "Chinese font" >>>>> http://packages.ubuntu.com/hardy/ttf-wqy-zenhei >>>>> 3, replace "Sim Hei" in your original script with "WenQuanYi Zen Hei", >>>>> now it can display Chinese. >>>>> both methods still work(embed fontname argument, or set >>>>> mpl.rcParams['font.sans-serif']) >>>>> >>>>> maybe you can find a font that support Chinese character on your >>>>> platform with these steps and try again? >>>>> >>>>> On Tue, Oct 12, 2010 at 10:41 PM, Benoit Gaillard >>>>> <ben...@un...> wrote: >>>>>> >>>>>> Thank you for your help, >>>>>> >>>>>> but it does not seem to work. >>>>>> >>>>>> I have downloaded simhei fonts and added it in my directory >>>>>> /usr/shared/fonts/truetype but even by using >>>>>> """fontname="simhei" """, >>>>>> or: >>>>>> """mpl.rcParams['font.sans-serif'] = ['SimHei'] >>>>>> mpl.rcParams['axes.unicode_minus'] = False """ >>>>>> >>>>>> i still display empty boxes instead of chinese characters. >>>>>> >>>>>> It is worth noting that these chinese characters print well on the >>>>>> console >>>>>> if i add the line: >>>>>> """for ytic in ytics: >>>>>> print ytic""" >>>>>> >>>>>> Unfortunately, apart from copying lines of code, i cannot do much with >>>>>> the >>>>>> blog you mention, as i don't understand what is written in it. >>>>>> >>>>>> @Mike: "monospace" family is one that enables me to display accents of >>>>>> french words, for the xticks. "fantasy" family was the last family i >>>>>> tried >>>>>> for the chinese labels, but to no success. >>>>>> >>>>>> So, has anyone managed to do it? Is there something i am missing?, >>>>>> >>>>>> regards, >>>>>> >>>>>> Benoit. >>>>>> >>>>>> Quoting sunqiang <sun...@gm...>: >>>>>> >>>>>>> maybe change the line >>>>>>> """axim.set_yticklabels(ytics,fontsize=15,family='fantasy')""" to >>>>>>> """axim.set_yticklabels(ytics,fontsize=15, fontname= "simsun (founder >>>>>>> extended)")""" >>>>>>> (or replace fontname with "simhei" or "microsoft yahei") is enough. >>>>>>> >>>>>>> >>>>>>> or, put these two lines: >>>>>>> mpl.rcParams['font.sans-serif'] = ['SimHei'] >>>>>>> mpl.rcParams['axes.unicode_minus'] = False >>>>>>> >>>>>>> there is a Chinese blog (not mine) maybe worth reading: >>>>>>> >>>>>>> http://hi.baidu.com/lijiangshui/blog/item/a0aad703cd65ee7e3812bb49.html >>>>>>> >>>>>>> hope this help >>>>>>> >>>>>>> On Mon, Oct 11, 2010 at 3:13 AM, Benoit Gaillard >>>>>>> <ben...@un...> wrote: >>>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> How can one display Mandarin labels in a plot, as yticks_labels for >>>>>>>> example? >>>>>>>> It looks to me that there is no font in matplotlib that can display >>>>>>>> Chinese >>>>>>>> characters? I can display accentuation from 'utf8' but i could not >>>>>>>> find a >>>>>>>> font family that would display Chinese characters. >>>>>>>> >>>>>>>> Here is an example of plot that displays empty boxes instead of >>>>>>>> Chinese >>>>>>>> characters. In comments you can see various failed attempts: >>>>>>>> >>>>>>>> import matplotlib as mpl >>>>>>>> from matplotlib import cm >>>>>>>> from matplotlib import rc >>>>>>>> >>>>>>>> #rc('font',**{'family':'sans-serif','sans-serif':['SimHei','Arial']}) >>>>>>>> #mpl.rcParams['font.sans-serif'] = ['SimHei','Arial'] >>>>>>>> import matplotlib.pyplot as plt >>>>>>>> >>>>>>>> matrix=[[skey+tkey for skey in [1,2]] for tkey in [1,2]] >>>>>>>> fig = plt.figure() >>>>>>>> axim = fig.add_subplot(111) >>>>>>>> #ytics: caractères chinois en utf8 >>>>>>>> ytics=['\xe6\x8a\xb1'.decode('utf8'),'\xe6\x93\x81'.decode('utf8')] >>>>>>>> >>>>>>>> >>>>>>>> xtics=['d\xc3\xa9bo\xc3\xaeter'.decode('utf8'),'diviser'.decode('utf8')] >>>>>>>> axim.imshow(matrix, cmap=cm.jet, >>>>>>>> interpolation='nearest',origin='lower') >>>>>>>> axim.set_xticks(range(2)) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> axim.set_xticklabels(xtics,fontsize=15,rotation=25,ha='right',family='monospace') >>>>>>>> axim.set_yticks(range(2)) >>>>>>>> >>>>>>>> axim.set_yticklabels(ytics,fontsize=15,family='fantasy')#,fontname='AR >>>>>>>> PL >>>>>>>> ungtiL GB') >>>>>>>> plt.show() >>>>>>>> >>>>>>>> Thank you for your help, >>>>>>>> >>>>>>>> Benoit >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ---------------------------------------------------------------- >>>>>>>> This message was sent using IMP, the Internet Messaging Program. >>>>>>>> >>>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> How can one display mandarin labels in a plot, as yticks_labels for >>>>>>>> example? >>>>>>>> It looks to me that there is no font in matplotlib that can display >>>>>>>> chinese >>>>>>>> characters? I can display accentuation from 'utf8' but i could not >>>>>>>> find a >>>>>>>> font family that would display chinese characters. >>>>>>>> >>>>>>>> Here is an example of plot that displays empty boxes instead of >>>>>>>> chinese >>>>>>>> characters. In comment you can see various failed attempts: >>>>>>>> >>>>>>>> import matplotlib as mpl >>>>>>>> from matplotlib import cm >>>>>>>> from matplotlib import rc >>>>>>>> >>>>>>>> #rc('font',**{'family':'sans-serif','sans-serif':['SimHei','Arial']}) >>>>>>>> #mpl.rcParams['font.sans-serif'] = ['SimHei','Arial'] >>>>>>>> import matplotlib.pyplot as plt >>>>>>>> >>>>>>>> matrix=[[skey+tkey for skey in [1,2]] for tkey in [1,2]] >>>>>>>> fig = plt.figure() >>>>>>>> axim = fig.add_subplot(111) >>>>>>>> #ytics: caractères chinois en utf8 >>>>>>>> >>>>>>>> ytics=['\xe6\x8a\xb1'.decode('utf8'),'\xe6\x93\x81'.decode('utf8')] >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> xtics=['d\xc3\xa9bo\xc3\xaeter'.decode('utf8'),'diviser'.decode('utf8')] >>>>>>>> axim.imshow(matrix, cmap=cm.jet, interpolation='nearest', >>>>>>>> origin='lower') >>>>>>>> axim.set_xticks(range(2)) >>>>>>>> axim.set_xticklabels(xtics, >>>>>>>> fontsize=15,rotation=25,ha='right',family='monospace') >>>>>>>> axim.set_yticks(range(2)) >>>>>>>> >>>>>>>> >>>>>>>> axim.set_yticklabels(ytics,fontsize=15,family='fantasy')#,fontname='AR >>>>>>>> PL SungtiL GB') >>>>>>>> plt.show() >>>>>>>> >>>>>>>> Thank you for your help, >>>>>>>> >>>>>>>> Benoit >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ------------------------------------------------------------------------------ >>>>>>>> Beautiful is writing same markup. Internet Explorer 9 supports >>>>>>>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. >>>>>>>> Spend less time writing and rewriting code and more time creating >>>>>>>> great >>>>>>>> experiences on the web. Be a part of the beta today. >>>>>>>> http://p.sf.net/sfu/beautyoftheweb >>>>>>>> _______________________________________________ >>>>>>>> Matplotlib-users mailing list >>>>>>>> Mat...@li... >>>>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ---------------------------------------------------------------- >>>>>> This message was sent using IMP, the Internet Messaging Program. >>>>>> >>>>>> >>>>> >>>> >>>> >>>> >>>> ---------------------------------------------------------------- >>>> This message was sent using IMP, the Internet Messaging Program. >>> >>> >>> >>> ---------------------------------------------------------------- >>> This message was sent using IMP, the Internet Messaging Program. >>> >>> >> > > > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. > >
ax.stem(x, y, '-.') draws the stem second, so that it is visible on top of the dot. Is this intentional? (I think it looks better with the dot on top.) How to reverse? Alan Isaac
If you are curious, here is what Mathematica can tell about the integral (assuming everything constant but z): http://pastebin.com/Gir3XZBe On Wed, Oct 13, 2010 at 4:28 PM, Waléria Antunes David <wal...@gm...> wrote: > Hi all, > > I know here is a group for matplotlib, but can anyone help me? I need to > pass this integral equation for for scipy.integrate pack for python. > > My integral equation is attached. > > Can anyone help me? > > Thanks > Waleria. > > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today. > http://p.sf.net/sfu/beautyoftheweb > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >
On Wed, Oct 13, 2010 at 1:34 PM, Jouni K. Seppänen <jk...@ik...> wrote: > Carl Karsten <ca...@pe...> writes: > >> Anyone know if this message is archived somewhere: >> "Jeez, you guys have some crazy examples. I am surprised there isn't >> dolphins swimming around inside a sphere." > > You probably mean this one: > > http://article.gmane.org/gmane.comp.python.matplotlib.general/13648 yep - thanks. Not exactly how I remember it from the talk. wonder where the story got changed. -- Carl K
Hi Everyone, This is my first post, so I'll apologize in advance for any inadvertent lapse in manners. I'm using matplotlib 0.98.5.2, wxPython version 2.8-msw-unicode, on Windows XP Professional x64 at work (and 32bit at home). At work I have a plain old Dell 2 button mouse with a scroll wheel which you can scroll or click as a middle mouse button. At home I have an equivalent mouse from Logitec. Both mice exhibit useful functionality for the "middle button" in browsers. And I did install the latest Logitec drivers at home and specifically set the scroll click to have the functionality of a middle mouse button. In all cases, home or work, I failed to detect a middle mouse button press or release event. I've attached an example program and copied the text below. If anyone could please check to see if this is happening for them, or has any idea how to fix this, I'd very much appreciate it. Thanks, Brian J. Soher Duke University ------------------------------------- import wxversion wxversion.ensureMinimal('2.8') from numpy import arange, sin, pi import matplotlib matplotlib.use('WXAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.figure import Figure import wx class CanvasFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1,'CanvasFrame',size=(550,350)) self.SetBackgroundColour(wx.NamedColor("WHITE")) self.figure = Figure() self.axes = self.figure.add_subplot(111) t = arange(0.0,3.0,0.01) s = sin(2*pi*t) self.axes.plot(t,s) self.canvas = FigureCanvas(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.SetSizer(self.sizer) self.Fit() self.connect() def connect(self): 'connect to all the events we need' self.cidpress = self.figure.canvas.mpl_connect('button_press_event', self.on_press) self.cidrelease = self.figure.canvas.mpl_connect('button_release_event', self.on_release) self.cidscroll = self.figure.canvas.mpl_connect('scroll_event', self.on_scroll) self.cidmotion = self.figure.canvas.mpl_connect('motion_notify_event', self.mouseMotion) self.cidkeydown = self.figure.canvas.mpl_connect('key_press_event', self.keyDown) self.cidkeyup = self.figure.canvas.mpl_connect('key_release_event', self.keyUp) def on_press(self, evt): print ' press evt.button = '+str(evt.button) if evt.button == 1: self.leftButtonDown(evt) elif evt.button == 2: self.middleButtonDown(evt) elif evt.button == 3: self.rightButtonDown(evt) def on_release(self, evt): if evt.button == 1: self.leftButtonUp(evt) elif evt.button == 2: print 'evt.button == 2' self.middleButtonUp(evt) elif evt.button == 3: self.rightButtonUp(evt) def on_scroll(self, evt): if evt.button == 'up': self.scrollUp(evt) elif evt.button == 'down': self.scrollDown(evt) def keyDown(self, evt): print ' keyDown()' def keyUp(self, evt): print ' keyUp()' def scrollDown(self, evt): print ' scrollDown()' def scrollUp(self, evt): print ' scrollUp()' def leftButtonDown(self, evt): print ' leftButtonDown()' def leftButtonUp(self, evt): print ' leftButtonUp()' def middleButtonDown(self, evt): print ' middleButtonDown()' def middleButtonUp(self, evt): print ' middleButtonUp()' def rightButtonDown(self, evt): print ' rightButtonDown()' def rightButtonUp(self, evt): print ' rightButtonUp()' def mouseMotion(self, evt): print ' mouseMotion()' def OnPaint(self, event): self.canvas.draw() class App(wx.App): def OnInit(self): 'Create the main window and insert the custom frame' frame = CanvasFrame() frame.Show(True) return True app = App(0) app.MainLoop()
Thank you so much Ben, Now the plot comes correctly after trying your suggestion. I set *cmap.set_under() and cmap.set_over()* before calling contourf() and now the plot comes correctly irrespective of cal to the colorbar() function. Thanks, Bala On Thu, Oct 14, 2010 at 5:09 PM, Benjamin Root <ben...@ou...> wrote: > On Thu, Oct 14, 2010 at 9:50 AM, Bala subramanian < > bal...@gm...> wrote: > >> Dear Ben, >> you are right, contouf() omits the red and blue values without colorbar. >> >> 1) If i call set_under() and set_over() before calling contourf(), i get >> an error. This is obvious because i am setting a property of the countourf() >> object before creating it. I get *NameError: name 'CNF' is not defined* >> >> 2) If i set set_under() and set_over(), after the colorbar(), the >> colorbar() is shown correctly but contourf() again dose not create the red >> and blue values. I have also attached my test matrix file with this mail. >> >> Bala >> >> > Bala, in the code example you gave, you have a cmap object that you pass > into contourf. The cmap object that you are accessing after contourf is > exactly the same object, so why not just call "cmap.set_over()" before the > contourf()? > > Ben Root > >
On Thu, Oct 14, 2010 at 4:54 AM, Pedro M. Ferreira <pmf...@gm...>wrote: > Well, it did help at least to understand a bit more, although I still > fail to do it. > > The code in the file axes3d.py says that keyword arguments passed to > scatter3D are passed on to matplotlib.scatter, so I would expect the > following two figures to work similarly in terms of color: > > import matplotlib as mpl > import numpy as np > from mpl_toolkits.mplot3d import Axes3D > > f1=mpl.figure() > mpl.scatter(X,Z,c=np.abs(Z/3.0)) # My Z is in [-3.0, 3.0] > > f2=mpl.figure() > ax=Axes3D(f2) > ax.scatter3D(X,Y,Z,c=abs(Z/3.0)) > > mpl.show() > > It happens that f1 shows what I expect, a scatter in 2D with the > colors of markers mapped to a colormap (I believe its jet). > For f2, the markers appear as white filled circles. > > I am using python 2.6.6 in Debian squeeze (amd64) with > python-matplotlib version 0.99.3-1 > > Ah, that might explain the problem! I don't have the time to verify this now, but I seem to remember doing a bug fix where some of the parameters being passed into scatter3d() was being 'swallowed' and not passed down to scatter(). You might need to upgrade to the maintenance branch of mpl v1.0.0 in svn. Note that the problem was probably fixed *after* the release of v1.0.0 if I remember it correctly, so you will need the latest revised release from source control. If you need help with that, just let us know. Ben Root
On Thu, Oct 14, 2010 at 7:58 AM, Jeff Whitaker <js...@fa...> wrote: > On 10/14/10 5:21 AM, Bala subramanian wrote: > > Friends, > > I wrote a small program to plot a matrix using contourf function. The > > code is pasted below. The image that is created is attached (1.png). > > Now if i make the same figure, just by omitting the colorbar by > > commenting the line, then i see that the contourf output is different > > (2.png). Why this difference ? Whether i include colorbar or not, the > > contourf should create similar plot right ?. Am i wrong something > > wrong in the code. Kindly help me to understand the problem. > > Bala: The shape of the plot changes, because colorbar adjusts the axes > to make room for itself. Otherwise the plots look identical. Am I > missing something? > > -Jeff > > Jeff, Bala: I see what is wrong... the blues and reds are missing if Bala takes out the colorbar call. This is because the calls to cmap.set_under() and cmap.set_over() are being done *after* the call to contourf(). Somehow, if colorbar() is called, then the data in the colormap gets updated for the process of rendering the colorbar, but it does not happen otherwise. A lot of stuff in the colormaps are designed around the idea of deferred processing to save memory and processing time. I am not sure if this is a bug or not, but I would have expected that the call to show() would properly updated the contourf data, irrespective of the call to colorbar or not. I would be curious to see what would happen if set_under and set_over were called after the call to colorbar. Bala, in case you haven't noticed yet, a proper workaround would be calling set_under and set_over *before* calling contourf(). Ben Root
On 10/14/10 5:21 AM, Bala subramanian wrote: > Friends, > I wrote a small program to plot a matrix using contourf function. The > code is pasted below. The image that is created is attached (1.png). > Now if i make the same figure, just by omitting the colorbar by > commenting the line, then i see that the contourf output is different > (2.png). Why this difference ? Whether i include colorbar or not, the > contourf should create similar plot right ?. Am i wrong something > wrong in the code. Kindly help me to understand the problem. Bala: The shape of the plot changes, because colorbar adjusts the axes to make room for itself. Otherwise the plots look identical. Am I missing something? -Jeff
Well, it did help at least to understand a bit more, although I still fail to do it. The code in the file axes3d.py says that keyword arguments passed to scatter3D are passed on to matplotlib.scatter, so I would expect the following two figures to work similarly in terms of color: import matplotlib as mpl import numpy as np from mpl_toolkits.mplot3d import Axes3D f1=mpl.figure() mpl.scatter(X,Z,c=np.abs(Z/3.0)) # My Z is in [-3.0, 3.0] f2=mpl.figure() ax=Axes3D(f2) ax.scatter3D(X,Y,Z,c=abs(Z/3.0)) mpl.show() It happens that f1 shows what I expect, a scatter in 2D with the colors of markers mapped to a colormap (I believe its jet). For f2, the markers appear as white filled circles. I am using python 2.6.6 in Debian squeeze (amd64) with python-matplotlib version 0.99.3-1 Thanks for any help or comment. On Thu, Oct 14, 2010 at 1:59 AM, Benjamin Root <ben...@ou...> wrote: > On Wed, Oct 13, 2010 at 5:46 PM, Pedro M. Ferreira <pmf...@gm...> > wrote: >> >> Hi All, >> >> I have been trying to make a 3D scatter plot using mplot3d and I would >> like the markers to have their colour according to the Z value. >> >From what I understood in the tutorial and API I have to use the cmap >> and norm kwargs, but all my attempts failed. >> >> I am trying to do it like this: >> ax.scatter(x,y,z,s=10,marker='o',c=????,cmap=????,norm=????) >> >> However I am not sure what to pass to c, cmap and norm. >> >> Any help ? >> Thanks. >> >> Cheers, >> Pedro >> > > It has been a while since I played around with this, and I am working > completely off my memory right now, but here goes... > > If I remember correctly, the 'c' values can be an array that is parallel to > the x, y, z arrays and specifies the color in one of two ways. First, the > array could have a list of color specs (e.g., 'k', 'r', 'b'). Second, the > array could contain values that would be passed to the colormap to retrieve > the colorspec according to where the value lies on the scale of 0 to 1. > > If you want to use just simple colors, go ahead and just make a list of > characters like so: > > ['k', 'r', 'g', 'g', 'b', 'k'] > > based on whatever the values are in z (I recommend using numpy's where() > function for this. > > I am not 100% sure if you need the following or if mpl will just autoscale > for you. So you might want to first just try out using the 'c' keyword. > > If you want to use the colormap, then the values passed into c either has to > be the normalized values of z > > c = (z - z.min()) / (z.max()-z.min()) > > or you can use one of the Normalize classes in matplotlib.color (assuming > you have imported matplotlib.pyplot as plt): > > norm = plt.Normalize(z.min(), z.max()) > > or whatever minimum and/or maximum values you wish. > > I believe you can use the default colormap by not specifying anything at all > for cmap, but I could be wrong here. You can also specify any colormap by > their name like 'spring', 'jet', 'bone' and so on. > > I hope that helps. > Ben Root > >
Thank you very much it all works fine now, I downloaded and installed the font in http://archive.ubuntu.com/ubuntu/pool/main/t/ttf-wqy-zenhei/ttf-wqy-zenhei_0.5.23.orig.tar.gz, as you advised. Then i deleted the fontList.cache de matplotlib to force its updating, and ran the script with """ fontname="WenQuanYi Zen Hei" """ I can now display the characters and save the plots as pdf. Thanks a lot for you wise help, i learned a lot. Benoit Quoting sunqiang <sun...@gm...>: > On Wed, Oct 13, 2010 at 5:30 PM, Benoit Gaillard > <ben...@un...> wrote: >> Actually, i must apologize >> >> By calling fonts by their real name eg: "WenQuanYi Zen Hei" (instead of >> wqy-microhei, their file name), i can display them. So no worries for issue >> 2. However, I do not manage to export the png to pdf or eps due to the >> following error: >> >> "TrueType font is missing table" >> >> Is that due to my changing the font name from *.ttc to *.ttf? > the "c" in ".ttc" means "Container", wqy-*.ttc includes more than one ttf. > so, maybe just rename *.ttc to *.ttf is not enough. > I guess, You can find some font tools to extract ttf from ttc, or > install another Chinese font provided by your operation system. or > just download the ttf version from > http://packages.ubuntu.com/hardy/ttf-wqy-zenhei (directly: > http://archive.ubuntu.com/ubuntu/pool/main/t/ttf-wqy-zenhei/ttf-wqy-zenhei_0.5.23.orig.tar.gz) > I don't know font enough, so I didn't test the first method. I only > test the last method. > after download the font into my Window machine. it can display Chinese > with "'WenQuanYi Zen Hei'" and save figure to png and pdf.(ps, eps > doesn't work, even without a error log"). > (my Linux machine(Ubuntu Hardy 8.04) can display Chinese and save > figure to png, pdf, ps, eps correctly already.) >> >> regards, >> >> benoit >> >> >> Quoting Benoit Gaillard <ben...@un...>: >> >>> Hi, >>> >>> When looking in my fontFile.cache, i did not find any of >>> '/usr/share/fonts/truetype/wqy/wqy-zenhei.ttf', >>> '/usr/share/fonts/truetype/wqy/wqy-microhei.ttf' or simhei. this is why >>> i could not display the characters. >>> >>> I deleted the cache and re-lounched my script, so that mpl had to look >>> for the fonts and update the cache. It added the simhei fonts to the >>> list. I can now display chinese characters with the simhei font. >>> >>> I ran into 2 more issues: >>> - Simhei "has no glyph names", which prevents me from exporting into pdf >>> - I do not manage to make mpl take into account microhei and zenhei, >>> whereas i have them in >>> '/usr/share/fonts/truetype/wqy/wqy-microhei.ttc'. I changed their name >>> to '/usr/share/fonts/truetype/wqy/wqy-microhei.ttf', and now mpl finds >>> them. However they fail to display chinese characters >>> >>> So, thank you for your help, i managed to display chinese characters >>> but there are still some issues. Do you have any idea? >>> >>> Benoit >>> >>> >>> Quoting sunqiang <sun...@gm...>: >>> >>>> oh, only test it on Windows yet. both "sim hei"and "microsoft yahei" >>>> are fontname on Windows Platform. >>>> maybe just copy "Sim Hei" to font directory is not enough? no clue here. >>>> >>>> I just test the script on Linux (Ubuntu 8.04, Python 2.5, matplotlib >>>> 0.98.4) with the follow steps: >>>> 1, find the configure directory of matplotlib >>>> import matplotlib as mpl >>>> mpl.get_configdir() >>>> >>>> return "~/.matplotlib" >>>> 2, in the configure directory, there is a file "fontList.cache" >>>> I find this >>>> (dp294 >>>> ... >>>> S'WenQuanYi Zen Hei' >>>> ... >>>> S'/usr/share/fonts/truetype/wqy/wqy-zenhei.ttf' >>>> ... >>>> >>>> I just know WenQuanYi is a "Chinese font" >>>> http://packages.ubuntu.com/hardy/ttf-wqy-zenhei >>>> 3, replace "Sim Hei" in your original script with "WenQuanYi Zen Hei", >>>> now it can display Chinese. >>>> both methods still work(embed fontname argument, or set >>>> mpl.rcParams['font.sans-serif']) >>>> >>>> maybe you can find a font that support Chinese character on your >>>> platform with these steps and try again? >>>> >>>> On Tue, Oct 12, 2010 at 10:41 PM, Benoit Gaillard >>>> <ben...@un...> wrote: >>>>> >>>>> Thank you for your help, >>>>> >>>>> but it does not seem to work. >>>>> >>>>> I have downloaded simhei fonts and added it in my directory >>>>> /usr/shared/fonts/truetype but even by using >>>>> """fontname="simhei" """, >>>>> or: >>>>> """mpl.rcParams['font.sans-serif'] = ['SimHei'] >>>>> mpl.rcParams['axes.unicode_minus'] = False """ >>>>> >>>>> i still display empty boxes instead of chinese characters. >>>>> >>>>> It is worth noting that these chinese characters print well on the >>>>> console >>>>> if i add the line: >>>>> """for ytic in ytics: >>>>> print ytic""" >>>>> >>>>> Unfortunately, apart from copying lines of code, i cannot do much with >>>>> the >>>>> blog you mention, as i don't understand what is written in it. >>>>> >>>>> @Mike: "monospace" family is one that enables me to display accents of >>>>> french words, for the xticks. "fantasy" family was the last family i >>>>> tried >>>>> for the chinese labels, but to no success. >>>>> >>>>> So, has anyone managed to do it? Is there something i am missing?, >>>>> >>>>> regards, >>>>> >>>>> Benoit. >>>>> >>>>> Quoting sunqiang <sun...@gm...>: >>>>> >>>>>> maybe change the line >>>>>> """axim.set_yticklabels(ytics,fontsize=15,family='fantasy')""" to >>>>>> """axim.set_yticklabels(ytics,fontsize=15, fontname= "simsun (founder >>>>>> extended)")""" >>>>>> (or replace fontname with "simhei" or "microsoft yahei") is enough. >>>>>> >>>>>> >>>>>> or, put these two lines: >>>>>> mpl.rcParams['font.sans-serif'] = ['SimHei'] >>>>>> mpl.rcParams['axes.unicode_minus'] = False >>>>>> >>>>>> there is a Chinese blog (not mine) maybe worth reading: >>>>>> http://hi.baidu.com/lijiangshui/blog/item/a0aad703cd65ee7e3812bb49.html >>>>>> >>>>>> hope this help >>>>>> >>>>>> On Mon, Oct 11, 2010 at 3:13 AM, Benoit Gaillard >>>>>> <ben...@un...> wrote: >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> How can one display Mandarin labels in a plot, as yticks_labels for >>>>>>> example? >>>>>>> It looks to me that there is no font in matplotlib that can display >>>>>>> Chinese >>>>>>> characters? I can display accentuation from 'utf8' but i could not >>>>>>> find a >>>>>>> font family that would display Chinese characters. >>>>>>> >>>>>>> Here is an example of plot that displays empty boxes instead of >>>>>>> Chinese >>>>>>> characters. In comments you can see various failed attempts: >>>>>>> >>>>>>> import matplotlib as mpl >>>>>>> from matplotlib import cm >>>>>>> from matplotlib import rc >>>>>>> #rc('font',**{'family':'sans-serif','sans-serif':['SimHei','Arial']}) >>>>>>> #mpl.rcParams['font.sans-serif'] = ['SimHei','Arial'] >>>>>>> import matplotlib.pyplot as plt >>>>>>> >>>>>>> matrix=[[skey+tkey for skey in [1,2]] for tkey in [1,2]] >>>>>>> fig = plt.figure() >>>>>>> axim = fig.add_subplot(111) >>>>>>> #ytics: caractères chinois en utf8 >>>>>>> ytics=['\xe6\x8a\xb1'.decode('utf8'),'\xe6\x93\x81'.decode('utf8')] >>>>>>> >>>>>>> xtics=['d\xc3\xa9bo\xc3\xaeter'.decode('utf8'),'diviser'.decode('utf8')] >>>>>>> axim.imshow(matrix, cmap=cm.jet, >>>>>>> interpolation='nearest',origin='lower') >>>>>>> axim.set_xticks(range(2)) >>>>>>> >>>>>>> >>>>>>> axim.set_xticklabels(xtics,fontsize=15,rotation=25,ha='right',family='monospace') >>>>>>> axim.set_yticks(range(2)) >>>>>>> axim.set_yticklabels(ytics,fontsize=15,family='fantasy')#,fontname='AR >>>>>>> PL >>>>>>> ungtiL GB') >>>>>>> plt.show() >>>>>>> >>>>>>> Thank you for your help, >>>>>>> >>>>>>> Benoit >>>>>>> >>>>>>> >>>>>>> >>>>>>> ---------------------------------------------------------------- >>>>>>> This message was sent using IMP, the Internet Messaging Program. >>>>>>> >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> How can one display mandarin labels in a plot, as yticks_labels for >>>>>>> example? >>>>>>> It looks to me that there is no font in matplotlib that can display >>>>>>> chinese >>>>>>> characters? I can display accentuation from 'utf8' but i could not >>>>>>> find a >>>>>>> font family that would display chinese characters. >>>>>>> >>>>>>> Here is an example of plot that displays empty boxes instead of >>>>>>> chinese >>>>>>> characters. In comment you can see various failed attempts: >>>>>>> >>>>>>> import matplotlib as mpl >>>>>>> from matplotlib import cm >>>>>>> from matplotlib import rc >>>>>>> #rc('font',**{'family':'sans-serif','sans-serif':['SimHei','Arial']}) >>>>>>> #mpl.rcParams['font.sans-serif'] = ['SimHei','Arial'] >>>>>>> import matplotlib.pyplot as plt >>>>>>> >>>>>>> matrix=[[skey+tkey for skey in [1,2]] for tkey in [1,2]] >>>>>>> fig = plt.figure() >>>>>>> axim = fig.add_subplot(111) >>>>>>> #ytics: caractères chinois en utf8 >>>>>>> >>>>>>> ytics=['\xe6\x8a\xb1'.decode('utf8'),'\xe6\x93\x81'.decode('utf8')] >>>>>>> >>>>>>> >>>>>>> xtics=['d\xc3\xa9bo\xc3\xaeter'.decode('utf8'),'diviser'.decode('utf8')] >>>>>>> axim.imshow(matrix, cmap=cm.jet, interpolation='nearest', >>>>>>> origin='lower') >>>>>>> axim.set_xticks(range(2)) >>>>>>> axim.set_xticklabels(xtics, >>>>>>> fontsize=15,rotation=25,ha='right',family='monospace') >>>>>>> axim.set_yticks(range(2)) >>>>>>> >>>>>>> axim.set_yticklabels(ytics,fontsize=15,family='fantasy')#,fontname='AR >>>>>>> PL SungtiL GB') >>>>>>> plt.show() >>>>>>> >>>>>>> Thank you for your help, >>>>>>> >>>>>>> Benoit >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> Beautiful is writing same markup. Internet Explorer 9 supports >>>>>>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. >>>>>>> Spend less time writing and rewriting code and more time creating >>>>>>> great >>>>>>> experiences on the web. Be a part of the beta today. >>>>>>> http://p.sf.net/sfu/beautyoftheweb >>>>>>> _______________________________________________ >>>>>>> Matplotlib-users mailing list >>>>>>> Mat...@li... >>>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>>>>> >>>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> ---------------------------------------------------------------- >>>>> This message was sent using IMP, the Internet Messaging Program. >>>>> >>>>> >>>> >>> >>> >>> >>> ---------------------------------------------------------------- >>> This message was sent using IMP, the Internet Messaging Program. >> >> >> >> ---------------------------------------------------------------- >> This message was sent using IMP, the Internet Messaging Program. >> >> > ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
mpl version 1.0.0 file: axes.py line: 7214 <<< nr, nc = C.shape === nr, nc = C.shape[:2] >>> ................... While you are at it, you could also change line 6759 numRows, numCols = C.shape to numRows, numCols = C.shape[:2] (still some other things further down then crash, but this [second fix] is a start on that) A lot more work will be needed to make everything (_pcolorargs, PcolorImage, pcolorfast,...) work with RGB(A) arrays. How do I get a password/user name to check you the svn sources so I can send in patches in a more useful way? Just sign up for the devlop mailing list? -Alexander
On Wed, Oct 13, 2010 at 5:30 PM, Benoit Gaillard <ben...@un...> wrote: > Actually, i must apologize > > By calling fonts by their real name eg: "WenQuanYi Zen Hei" (instead of > wqy-microhei, their file name), i can display them. So no worries for issue > 2. However, I do not manage to export the png to pdf or eps due to the > following error: > > "TrueType font is missing table" > > Is that due to my changing the font name from *.ttc to *.ttf? the "c" in ".ttc" means "Container", wqy-*.ttc includes more than one ttf. so, maybe just rename *.ttc to *.ttf is not enough. I guess, You can find some font tools to extract ttf from ttc, or install another Chinese font provided by your operation system. or just download the ttf version from http://packages.ubuntu.com/hardy/ttf-wqy-zenhei (directly: http://archive.ubuntu.com/ubuntu/pool/main/t/ttf-wqy-zenhei/ttf-wqy-zenhei_0.5.23.orig.tar.gz) I don't know font enough, so I didn't test the first method. I only test the last method. after download the font into my Window machine. it can display Chinese with "'WenQuanYi Zen Hei'" and save figure to png and pdf.(ps, eps doesn't work, even without a error log"). (my Linux machine(Ubuntu Hardy 8.04) can display Chinese and save figure to png, pdf, ps, eps correctly already.) > > regards, > > benoit > > > Quoting Benoit Gaillard <ben...@un...>: > >> Hi, >> >> When looking in my fontFile.cache, i did not find any of >> '/usr/share/fonts/truetype/wqy/wqy-zenhei.ttf', >> '/usr/share/fonts/truetype/wqy/wqy-microhei.ttf' or simhei. this is why >> i could not display the characters. >> >> I deleted the cache and re-lounched my script, so that mpl had to look >> for the fonts and update the cache. It added the simhei fonts to the >> list. I can now display chinese characters with the simhei font. >> >> I ran into 2 more issues: >> - Simhei "has no glyph names", which prevents me from exporting into pdf >> - I do not manage to make mpl take into account microhei and zenhei, >> whereas i have them in >> '/usr/share/fonts/truetype/wqy/wqy-microhei.ttc'. I changed their name >> to '/usr/share/fonts/truetype/wqy/wqy-microhei.ttf', and now mpl finds >> them. However they fail to display chinese characters >> >> So, thank you for your help, i managed to display chinese characters >> but there are still some issues. Do you have any idea? >> >> Benoit >> >> >> Quoting sunqiang <sun...@gm...>: >> >>> oh, only test it on Windows yet. both "sim hei"and "microsoft yahei" >>> are fontname on Windows Platform. >>> maybe just copy "Sim Hei" to font directory is not enough? no clue here. >>> >>> I just test the script on Linux (Ubuntu 8.04, Python 2.5, matplotlib >>> 0.98.4) with the follow steps: >>> 1, find the configure directory of matplotlib >>> import matplotlib as mpl >>> mpl.get_configdir() >>> >>> return "~/.matplotlib" >>> 2, in the configure directory, there is a file "fontList.cache" >>> I find this >>> (dp294 >>> ... >>> S'WenQuanYi Zen Hei' >>> ... >>> S'/usr/share/fonts/truetype/wqy/wqy-zenhei.ttf' >>> ... >>> >>> I just know WenQuanYi is a "Chinese font" >>> http://packages.ubuntu.com/hardy/ttf-wqy-zenhei >>> 3, replace "Sim Hei" in your original script with "WenQuanYi Zen Hei", >>> now it can display Chinese. >>> both methods still work(embed fontname argument, or set >>> mpl.rcParams['font.sans-serif']) >>> >>> maybe you can find a font that support Chinese character on your >>> platform with these steps and try again? >>> >>> On Tue, Oct 12, 2010 at 10:41 PM, Benoit Gaillard >>> <ben...@un...> wrote: >>>> >>>> Thank you for your help, >>>> >>>> but it does not seem to work. >>>> >>>> I have downloaded simhei fonts and added it in my directory >>>> /usr/shared/fonts/truetype but even by using >>>> """fontname="simhei" """, >>>> or: >>>> """mpl.rcParams['font.sans-serif'] = ['SimHei'] >>>> mpl.rcParams['axes.unicode_minus'] = False """ >>>> >>>> i still display empty boxes instead of chinese characters. >>>> >>>> It is worth noting that these chinese characters print well on the >>>> console >>>> if i add the line: >>>> """for ytic in ytics: >>>> print ytic""" >>>> >>>> Unfortunately, apart from copying lines of code, i cannot do much with >>>> the >>>> blog you mention, as i don't understand what is written in it. >>>> >>>> @Mike: "monospace" family is one that enables me to display accents of >>>> french words, for the xticks. "fantasy" family was the last family i >>>> tried >>>> for the chinese labels, but to no success. >>>> >>>> So, has anyone managed to do it? Is there something i am missing?, >>>> >>>> regards, >>>> >>>> Benoit. >>>> >>>> Quoting sunqiang <sun...@gm...>: >>>> >>>>> maybe change the line >>>>> """axim.set_yticklabels(ytics,fontsize=15,family='fantasy')""" to >>>>> """axim.set_yticklabels(ytics,fontsize=15, fontname= "simsun (founder >>>>> extended)")""" >>>>> (or replace fontname with "simhei" or "microsoft yahei") is enough. >>>>> >>>>> >>>>> or, put these two lines: >>>>> mpl.rcParams['font.sans-serif'] = ['SimHei'] >>>>> mpl.rcParams['axes.unicode_minus'] = False >>>>> >>>>> there is a Chinese blog (not mine) maybe worth reading: >>>>> http://hi.baidu.com/lijiangshui/blog/item/a0aad703cd65ee7e3812bb49.html >>>>> >>>>> hope this help >>>>> >>>>> On Mon, Oct 11, 2010 at 3:13 AM, Benoit Gaillard >>>>> <ben...@un...> wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> How can one display Mandarin labels in a plot, as yticks_labels for >>>>>> example? >>>>>> It looks to me that there is no font in matplotlib that can display >>>>>> Chinese >>>>>> characters? I can display accentuation from 'utf8' but i could not >>>>>> find a >>>>>> font family that would display Chinese characters. >>>>>> >>>>>> Here is an example of plot that displays empty boxes instead of >>>>>> Chinese >>>>>> characters. In comments you can see various failed attempts: >>>>>> >>>>>> import matplotlib as mpl >>>>>> from matplotlib import cm >>>>>> from matplotlib import rc >>>>>> #rc('font',**{'family':'sans-serif','sans-serif':['SimHei','Arial']}) >>>>>> #mpl.rcParams['font.sans-serif'] = ['SimHei','Arial'] >>>>>> import matplotlib.pyplot as plt >>>>>> >>>>>> matrix=[[skey+tkey for skey in [1,2]] for tkey in [1,2]] >>>>>> fig = plt.figure() >>>>>> axim = fig.add_subplot(111) >>>>>> #ytics: caractères chinois en utf8 >>>>>> ytics=['\xe6\x8a\xb1'.decode('utf8'),'\xe6\x93\x81'.decode('utf8')] >>>>>> >>>>>> xtics=['d\xc3\xa9bo\xc3\xaeter'.decode('utf8'),'diviser'.decode('utf8')] >>>>>> axim.imshow(matrix, cmap=cm.jet, >>>>>> interpolation='nearest',origin='lower') >>>>>> axim.set_xticks(range(2)) >>>>>> >>>>>> >>>>>> axim.set_xticklabels(xtics,fontsize=15,rotation=25,ha='right',family='monospace') >>>>>> axim.set_yticks(range(2)) >>>>>> axim.set_yticklabels(ytics,fontsize=15,family='fantasy')#,fontname='AR >>>>>> PL >>>>>> ungtiL GB') >>>>>> plt.show() >>>>>> >>>>>> Thank you for your help, >>>>>> >>>>>> Benoit >>>>>> >>>>>> >>>>>> >>>>>> ---------------------------------------------------------------- >>>>>> This message was sent using IMP, the Internet Messaging Program. >>>>>> >>>>>> >>>>>> Hi, >>>>>> >>>>>> How can one display mandarin labels in a plot, as yticks_labels for >>>>>> example? >>>>>> It looks to me that there is no font in matplotlib that can display >>>>>> chinese >>>>>> characters? I can display accentuation from 'utf8' but i could not >>>>>> find a >>>>>> font family that would display chinese characters. >>>>>> >>>>>> Here is an example of plot that displays empty boxes instead of >>>>>> chinese >>>>>> characters. In comment you can see various failed attempts: >>>>>> >>>>>> import matplotlib as mpl >>>>>> from matplotlib import cm >>>>>> from matplotlib import rc >>>>>> #rc('font',**{'family':'sans-serif','sans-serif':['SimHei','Arial']}) >>>>>> #mpl.rcParams['font.sans-serif'] = ['SimHei','Arial'] >>>>>> import matplotlib.pyplot as plt >>>>>> >>>>>> matrix=[[skey+tkey for skey in [1,2]] for tkey in [1,2]] >>>>>> fig = plt.figure() >>>>>> axim = fig.add_subplot(111) >>>>>> #ytics: caractères chinois en utf8 >>>>>> >>>>>> ytics=['\xe6\x8a\xb1'.decode('utf8'),'\xe6\x93\x81'.decode('utf8')] >>>>>> >>>>>> >>>>>> xtics=['d\xc3\xa9bo\xc3\xaeter'.decode('utf8'),'diviser'.decode('utf8')] >>>>>> axim.imshow(matrix, cmap=cm.jet, interpolation='nearest', >>>>>> origin='lower') >>>>>> axim.set_xticks(range(2)) >>>>>> axim.set_xticklabels(xtics, >>>>>> fontsize=15,rotation=25,ha='right',family='monospace') >>>>>> axim.set_yticks(range(2)) >>>>>> >>>>>> axim.set_yticklabels(ytics,fontsize=15,family='fantasy')#,fontname='AR >>>>>> PL SungtiL GB') >>>>>> plt.show() >>>>>> >>>>>> Thank you for your help, >>>>>> >>>>>> Benoit >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> Beautiful is writing same markup. Internet Explorer 9 supports >>>>>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. >>>>>> Spend less time writing and rewriting code and more time creating >>>>>> great >>>>>> experiences on the web. Be a part of the beta today. >>>>>> http://p.sf.net/sfu/beautyoftheweb >>>>>> _______________________________________________ >>>>>> Matplotlib-users mailing list >>>>>> Mat...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>>>> >>>>>> >>>>> >>>> >>>> >>>> >>>> ---------------------------------------------------------------- >>>> This message was sent using IMP, the Internet Messaging Program. >>>> >>>> >>> >> >> >> >> ---------------------------------------------------------------- >> This message was sent using IMP, the Internet Messaging Program. > > > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. > >
On Wed, Oct 13, 2010 at 5:46 PM, Pedro M. Ferreira <pmf...@gm...>wrote: > Hi All, > > I have been trying to make a 3D scatter plot using mplot3d and I would > like the markers to have their colour according to the Z value. > >From what I understood in the tutorial and API I have to use the cmap > and norm kwargs, but all my attempts failed. > > I am trying to do it like this: > ax.scatter(x,y,z,s=10,marker='o',c=????,cmap=????,norm=????) > > However I am not sure what to pass to c, cmap and norm. > > Any help ? > Thanks. > > Cheers, > Pedro > > It has been a while since I played around with this, and I am working completely off my memory right now, but here goes... If I remember correctly, the 'c' values can be an array that is parallel to the x, y, z arrays and specifies the color in one of two ways. First, the array could have a list of color specs (e.g., 'k', 'r', 'b'). Second, the array could contain values that would be passed to the colormap to retrieve the colorspec according to where the value lies on the scale of 0 to 1. If you want to use just simple colors, go ahead and just make a list of characters like so: ['k', 'r', 'g', 'g', 'b', 'k'] based on whatever the values are in z (I recommend using numpy's where() function for this. I am not 100% sure if you need the following or if mpl will just autoscale for you. So you might want to first just try out using the 'c' keyword. If you want to use the colormap, then the values passed into c either has to be the normalized values of z c = (z - z.min()) / (z.max()-z.min()) or you can use one of the Normalize classes in matplotlib.color (assuming you have imported matplotlib.pyplot as plt): norm = plt.Normalize(z.min(), z.max()) or whatever minimum and/or maximum values you wish. I believe you can use the default colormap by not specifying anything at all for cmap, but I could be wrong here. You can also specify any colormap by their name like 'spring', 'jet', 'bone' and so on. I hope that helps. Ben Root
On Wed, Oct 13, 2010 at 6:33 AM, Michael Droettboom <md...@st...> wrote: > Yes, but this is fixed in SVN 1.0 branch and trunk -- at least for me. > Not for you? And for the record, I can confirm that from trunk, a saved dolphins.svg opens OK with inkscape. The bug (as mentioned on -dev) we're seeing is actually a Qt bug. Cheers, f
On Wed, Oct 13, 2010 at 11:34 AM, Fernando Perez <fpe...@gm...> wrote: > > Nope, identical behavior, just tested with a rebuilt-from-now numpy and mpl: > OK, the plot thickens. I may have spoken too fast: the behavior we see in the Qt console is indeed the same I reported earlier, and the MPL bug where doing pastefig() (which just calls savefig() to svg) causes the bad redrawing of the axis is still there, and definitely a MPL issue. BUT, if I save the svg manually to a file from mpl or from the Qt console, so the raw SVG data is written out, then it looks fine once I open it in inkscape. So it seems the problem is actually with the Qt widget's display of that SVG file, somehow it seems the Qt widget doesn't correctly understand the clipping info (which Inkscape is OK with). We'll bounce this over to the Qt folks to see if it's a known bug in Qt. In summary, only the bad redrawing of axes is a confirmed MPL issue, sorry for the confusion. Cheers, f
Hi All, I have been trying to make a 3D scatter plot using mplot3d and I would like the markers to have their colour according to the Z value. >From what I understood in the tutorial and API I have to use the cmap and norm kwargs, but all my attempts failed. I am trying to do it like this: ax.scatter(x,y,z,s=10,marker='o',c=????,cmap=????,norm=????) However I am not sure what to pass to c, cmap and norm. Any help ? Thanks. Cheers, Pedro
On Wed, Oct 13, 2010 at 11:29 AM, Jouni K. Seppänen <jk...@ik...> wrote: > > Is there a way to ask apt what the build dependencies for a package are, > and then install only a subset? A crude but functional way is to just run apt-get build-dep, and then cancel the actual download. That list is printed on screen, and one can then manually apt-get install just a subset. I'm sure one of our resident Debian experts can suggest a more elegant solution. Cheers, f
Carl Karsten <ca...@pe...> writes: > Anyone know if this message is archived somewhere: > "Jeez, you guys have some crazy examples. I am surprised there isn't > dolphins swimming around inside a sphere." You probably mean this one: http://article.gmane.org/gmane.comp.python.matplotlib.general/13648 -- Jouni K. Seppänen http://www.iki.fi/jks
On Wed, Oct 13, 2010 at 6:33 AM, Michael Droettboom <md...@st...> wrote: > Yes, but this is fixed in SVN 1.0 branch and trunk -- at least for me. > Not for you? Nope, identical behavior, just tested with a rebuilt-from-now numpy and mpl: amirbar[matplotlib]> svn info Path: . URL: https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib Repository Root: https://matplotlib.svn.sourceforge.net/svnroot/matplotlib Repository UUID: f61c4167-ca0d-0410-bb4a-bb21726e55ed Revision: 8753 Node Kind: directory Schedule: normal Last Changed Author: mdboom Last Changed Rev: 8753 Last Changed Date: 2010年10月13日 11:04:01 -0700 (2010年10月13日) This was tested on linux, ubuntu 10.04 (both 32 and 64 bits). Only numpy and matplotlib are source builds, all other dependencies are system libraries. Cheers, f
Carl Karsten <ca...@pe...> writes: >>> "Need to get 535MB of archives." >> > The following NEW packages will be installed: [...] > texlive-doc-base texlive-extra-utils texlive-font-utils It seems to be pulling in all of TeX Live, which is huge and by no means necessary to run matplotlib. Matplotlib can pass strings through TeX for formatting (the usetex option) but doesn't do that by default. Oh, it's build-dep... I guess you need TeX to build the manual, but I don't think it is needed to get the library itself working. Is there a way to ask apt what the build dependencies for a package are, and then install only a subset? -- Jouni K. Seppänen http://www.iki.fi/jks
On Wed, Oct 13, 2010 at 11:37 AM, Carl Karsten <ca...@pe...> wrote: > On Wed, Oct 13, 2010 at 11:14 AM, John Hunter <jd...@gm...> wrote: >> On Wed, Oct 13, 2010 at 10:45 AM, Carl Karsten <ca...@pe...> wrote: >> >>> "Need to get 535MB of archives." >>> >>> I am on a pretty slow shared connection, so need to wait a week to get >>> back home before I do this. >> >> How much does just the mpl part cost you? >> > > 519 > > carl@dc10:~/Videos/veyepar/test_client/test_show$ sudo apt-get > build-dep python-matplotlib so I checked with the other people on the remote dsl connection and got the ok to hog the bandwidth... 39% [85 texlive-latex-extra-doc 21.9MB/193MB 11%] 14.9kB/s 6h 2min 52s sometimes it goes down to 2h... but still: yuck. ^C, this can wait. -- Carl K
On Wed, Oct 13, 2010 at 11:14 AM, John Hunter <jd...@gm...> wrote: > On Wed, Oct 13, 2010 at 10:45 AM, Carl Karsten <ca...@pe...> wrote: > >> "Need to get 535MB of archives." >> >> I am on a pretty slow shared connection, so need to wait a week to get >> back home before I do this. > > How much does just the mpl part cost you? > 519 carl@dc10:~/Videos/veyepar/test_client/test_show$ sudo apt-get build-dep python-matplotlib [sudo] password for carl: Reading package lists... Done Building dependency tree Reading state information... Done Picking 'matplotlib' as source package instead of 'python-matplotlib' The following NEW packages will be installed: dvipng global graphviz ipython lacheck latex-beamer latex-xcolor libcgraph5 libffi-dev libgvpr1 libwxbase2.8-0 libwxbase2.8-dbg libwxgtk2.8-0 libwxgtk2.8-dbg libxss-dev lmodern luatex pgf preview-latex-style prosper ps2eps python-all python-all-dbg python-all-dev python-apptools python-configobj python-dbg python-docutils python-enthoughtbase python-epydoc python-foolscap python-gobject-dev python-gtk2-dev python-gtk2-doc python-jinja2 python-numpy-dbg python-qt4 python-qt4-dev python-roman python-sip python-sip-dev python-sphinx python-traits python-wxgtk2.8 python-wxgtk2.8-dbg python-wxversion python2.6-dbg tcl8.5-dev tex-common texlive-base texlive-binaries texlive-common texlive-doc-base texlive-extra-utils texlive-font-utils texlive-fonts-recommended texlive-fonts-recommended-doc texlive-generic-recommended texlive-latex-base texlive-latex-base-doc texlive-latex-extra texlive-latex-extra-doc texlive-latex-recommended texlive-latex-recommended-doc texlive-luatex texlive-pictures texlive-pictures-doc texlive-pstricks texlive-pstricks-doc tipa tk8.5-dev wx2.8-headers x11proto-scrnsaver-dev 0 upgraded, 73 newly installed, 0 to remove and 0 not upgraded. Need to get 519MB of archives. After this operation, 1,016MB of additional disk space will be used. -- Carl K
On Wed, Oct 13, 2010 at 10:45 AM, Carl Karsten <ca...@pe...> wrote: > "Need to get 535MB of archives." > > I am on a pretty slow shared connection, so need to wait a week to get > back home before I do this. How much does just the mpl part cost you?