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
(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)






Showing 19 results of 19

From: Fernando P. <fpe...@gm...> - 2010年10月13日 23:46:09
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
From: Fernando P. <fpe...@gm...> - 2010年10月13日 23:11:08
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
From: Pedro M. F. <pmf...@gm...> - 2010年10月13日 22:46:22
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
From: Fernando P. <fpe...@gm...> - 2010年10月13日 18:41:07
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
From: Jouni K. S. <jk...@ik...> - 2010年10月13日 18:35:19
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
From: Fernando P. <fpe...@gm...> - 2010年10月13日 18:34:42
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
From: Jouni K. S. <jk...@ik...> - 2010年10月13日 18:30:11
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
From: Carl K. <ca...@pe...> - 2010年10月13日 17:43:18
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
From: Carl K. <ca...@pe...> - 2010年10月13日 16:37:59
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
From: John H. <jd...@gm...> - 2010年10月13日 16:15:26
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?
From: Carl K. <ca...@pe...> - 2010年10月13日 15:46:12
On Wed, Oct 13, 2010 at 10:43 AM, Carl Karsten <ca...@pe...> wrote:
> On Wed, Oct 13, 2010 at 10:25 AM, John Hunter <jd...@gm...> wrote:
>> sudo apt-get build_dep numpy scipy matplotlib
>
> E: Unable to find a source package for numpy
>
> I am guessing it should be:
>
> sudo apt-get build-dep python-numpy python-scipy python-matplotlib
>
"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.
-- 
Carl K
From: Carl K. <ca...@pe...> - 2010年10月13日 15:43:10
On Wed, Oct 13, 2010 at 10:25 AM, John Hunter <jd...@gm...> wrote:
> sudo apt-get build_dep numpy scipy matplotlib
E: Unable to find a source package for numpy
I am guessing it should be:
 sudo apt-get build-dep python-numpy python-scipy python-matplotlib
-- 
Carl K
From: John H. <jd...@gm...> - 2010年10月13日 15:26:20
On Wed, Oct 13, 2010 at 10:19 AM, Carl Karsten <ca...@pe...> wrote:
> On Wed, Oct 13, 2010 at 8:33 AM, Michael Droettboom <md...@st...> wrote:
>> On 10/12/2010 07:16 PM, Fernando Perez wrote:
>>> On Tue, Oct 12, 2010 at 3:03 PM, Carl Karsten<ca...@pe...> wrote:
>>>
>>>> Run the code, you get a window that has a 'save' button, the dialog
>>>> has a 'type svg' option
>>>> the svg renders with the blue/green dots everywhere (rendering using
>>>> both rsvg-view and inkscape, which use different rendering engines.)
>>>> save as png, display png, dots only inside circle.
>>>>
>>>>
>>> Yup, clipping is completely broken in SVG, reported here:
>>>
>>> http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTik-Ty-V-QFEmkjhJH%2B-%3DtEZTTXyJLXxW%2B34E_hh%40mail.gmail.com&forum_name=matplotlib-devel
>>>
>> Yes, but this is fixed in SVN 1.0 branch and trunk -- at least for me.
>> Not for you?
>>
>
> carl@dc10:~/Videos/veyepar/test_client/test_show/flv$ apt-cache policy
> python-matplotlib
> python-matplotlib:
> Installed: 0.99.3-1ubuntu1
> Candidate: 0.99.3-1ubuntu1
> Version table:
> *** 0.99.3-1ubuntu1 0
>    500 http://us.archive.ubuntu.com/ubuntu/ maverick/universe
> amd64 Packages
>    100 /var/lib/dpkg/status
>
> Is there a PPA that tracks trunk?
I suggest
> sudo apt-get build_dep numpy scipy matplotlib
> svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib matplotlib
> cd matplotlib
> python setup.py install --prefix=~/something
and then set your PYTHONPATH accordingly.
See also http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn
From: Carl K. <ca...@pe...> - 2010年10月13日 15:19:38
On Wed, Oct 13, 2010 at 8:33 AM, Michael Droettboom <md...@st...> wrote:
> On 10/12/2010 07:16 PM, Fernando Perez wrote:
>> On Tue, Oct 12, 2010 at 3:03 PM, Carl Karsten<ca...@pe...> wrote:
>>
>>> Run the code, you get a window that has a 'save' button, the dialog
>>> has a 'type svg' option
>>> the svg renders with the blue/green dots everywhere (rendering using
>>> both rsvg-view and inkscape, which use different rendering engines.)
>>> save as png, display png, dots only inside circle.
>>>
>>>
>> Yup, clipping is completely broken in SVG, reported here:
>>
>> http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTik-Ty-V-QFEmkjhJH%2B-%3DtEZTTXyJLXxW%2B34E_hh%40mail.gmail.com&forum_name=matplotlib-devel
>>
> Yes, but this is fixed in SVN 1.0 branch and trunk -- at least for me.
> Not for you?
>
carl@dc10:~/Videos/veyepar/test_client/test_show/flv$ apt-cache policy
python-matplotlib
python-matplotlib:
 Installed: 0.99.3-1ubuntu1
 Candidate: 0.99.3-1ubuntu1
 Version table:
 *** 0.99.3-1ubuntu1 0
 500 http://us.archive.ubuntu.com/ubuntu/ maverick/universe
amd64 Packages
 100 /var/lib/dpkg/status
Is there a PPA that tracks trunk?
-- 
Carl K
From: John H. <jd...@gm...> - 2010年10月13日 14:43:34
On Wed, Oct 13, 2010 at 9:28 AM, 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?
1. Subscribe to scipy-users:
http://projects.scipy.org/mailman/listinfo/scipy-user
2. Describe your problem in more detail on scipy-users.
3. Most importantly, show what work you have already done, where you
are stuck and why. Post code. Noone wants to do your homework --
people are willing to help those who are working hard on a problem.
JDH
From: Michael D. <md...@st...> - 2010年10月13日 13:33:16
On 10/12/2010 07:16 PM, Fernando Perez wrote:
> On Tue, Oct 12, 2010 at 3:03 PM, Carl Karsten<ca...@pe...> wrote:
> 
>> Run the code, you get a window that has a 'save' button, the dialog
>> has a 'type svg' option
>> the svg renders with the blue/green dots everywhere (rendering using
>> both rsvg-view and inkscape, which use different rendering engines.)
>> save as png, display png, dots only inside circle.
>>
>> 
> Yup, clipping is completely broken in SVG, reported here:
>
> http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTik-Ty-V-QFEmkjhJH%2B-%3DtEZTTXyJLXxW%2B34E_hh%40mail.gmail.com&forum_name=matplotlib-devel
> 
Yes, but this is fixed in SVN 1.0 branch and trunk -- at least for me. 
Not for you?
Mike
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Benoit G. <ben...@un...> - 2010年10月13日 09:30:18
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?
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.
From: Benoit G. <ben...@un...> - 2010年10月13日 09:10:07
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.
From: sunqiang <sun...@gm...> - 2010年10月13日 02:29:57
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.
>
>
1 message has been excluded from this view by a project administrator.

Showing 19 results of 19

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 によって変換されたページ (->オリジナル) /