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




Showing results of 312

<< < 1 2 3 4 .. 13 > >> (Page 2 of 13)
From: Benjamin R. <ben...@ou...> - 2010年11月26日 21:40:14
On Thursday, November 25, 2010, robert fujii <rob...@gm...> wrote:
> Hello - I am using python 2.6, numpy-1.3.0-win32-
>
> superpack-python2.6,
> scipy-0.7.1-win32-superpack-python2.6, sympy-0.6.7.win32,
>
> matplotlib-1.0.0.win32-py2.6,
> and brian-1.2.1.win32.
> I would like to "import pylab" , however I get the following messages
> shown below. Any assistnce would be highly appreciated.
> Thank you.
> Robert
> *********************************************************************************
> import pylab
>  File "F:\Python26\lib\site-packages\pylab.py", line 1, in <module>
>   from matplotlib.pylab import *
>  File "F:\Python26\lib\site-packages\matplotlib\pylab.py", line 206, in
> <module>
>   from matplotlib import mpl # pulls in most modules
>  File "F:\Python26\lib\site-packages\matplotlib\mpl.py", line 2, in
> <module>
>   from matplotlib import axis
>  File "F:\Python26\lib\site-packages\matplotlib\axis.py", line 10, in
> <module>
>   import matplotlib.font_manager as font_manager
>  File "F:\Python26\lib\site-packages\matplotlib\font_manager.py", line
> 1301, in <module>
>   _rebuild()
>  File "F:\Python26\lib\site-packages\matplotlib\font_manager.py", line
> 1292, in _rebuild
>   fontManager = FontManager()
>  File "F:\Python26\lib\site-packages\matplotlib\font_manager.py", line 984,
> in __init__
>   self.ttffiles = findSystemFonts(paths) + findSystemFonts()
>  File "F:\Python26\lib\site-packages\matplotlib\font_manager.py", line 330,
> in findSystemFonts
>   for f in win32InstalledFonts(fontdir):
>  File "F:\Python26\lib\site-packages\matplotlib\font_manager.py", line 213,
> in win32InstalledFonts
>   key, direc, any = _winreg.EnumValue( local, j)
> MemoryError
>
>
Did you have a previous version of matplotlib? Did you ever have
difficulties with that version on this computer?
Ben Root
From: Benjamin R. <ben...@ou...> - 2010年11月26日 21:32:38
On Friday, November 26, 2010, C M <cmp...@gm...> wrote:
> This is not important at all and unlikely to be supported, but just
> out of curiosity:
>
> Is it possible to set matplotlib such that, when using the 'o-' marker
> style (marker
> connected by lines) and partially transparent markers, the lines are not shown
> within the transparent marker? That is, the lines would stop at the boundary
> of the marker and pick up again at the other side. This would produce a better
> aesthetic effect, I think, than the lines being seen coursing through the marker
> when the markers are transparent.
>
> Thanks,
> Che
>
> ------------------------------------------------------------------------------
> Increase Visibility of Your 3D Game App & Earn a Chance To Win 500ドル!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with the
> Intel(R) Software Partner Program. Five 500ドル cash prizes are up for grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
If it is at all possible (and I don't think it can yet), I think it
would be with join styles. Otherwise, the lines are simply drawn from
point to point and the markers laid on top of that.
Ben Root
From: C M <cmp...@gm...> - 2010年11月26日 19:01:19
On Thu, Nov 18, 2010 at 12:59 PM, C M <cmp...@gm...> wrote:
> Goals: date plot with two y axes (plotting completely different things)
>      point picking and point labeling
>      As many lines as user wants, all colored differently.
>
> Having some problems with this. (matplotlib 0.98.5)
>
> 1) There is a known bug with twinx() and plot_date:
>
> http://sourceforge.net/tracker/index.php?func=detail&aid=3046812&group_id=80706&atid=560720
>
> But I can get it to work if I change ONE OF the plot_date() calls (the
> one for the values plotted to the right-hand y axis) to just plot().
>
> Is that going to introduce problems? Is there a better workaround?
> (The ones on that page don't work for me).
So far, so good with this. But for others working on it, I have found
that the *order* of plotting matters.
That is, I have two axes and I have to use plot() for one axis and
plot_date() for the other, but it must be plot() that is used first or
else I will get the error: ValueError: ordinal must be >= 1.
I'm managing my lines and grouping them by axes, and then making sure
I plot all the lines on the axis that uses plot() first. Seems to
work fine after that.
> 3) My point picking is not working with the two axes. In my routine,
> I label the picked point and to do that I have to make reference to
> its axis and call plot_date(). How can I know which axis the picked
> point came from, so that I can label it appropriately?
I should have just thought about that more. Of course, there is the
method myline.get_axes() for that.
Che
From: C M <cmp...@gm...> - 2010年11月26日 17:13:02
This is not important at all and unlikely to be supported, but just
out of curiosity:
Is it possible to set matplotlib such that, when using the 'o-' marker
style (marker
connected by lines) and partially transparent markers, the lines are not shown
within the transparent marker? That is, the lines would stop at the boundary
of the marker and pick up again at the other side. This would produce a better
aesthetic effect, I think, than the lines being seen coursing through the marker
when the markers are transparent.
Thanks,
Che
From: Jae-Joon L. <lee...@gm...> - 2010年11月26日 16:14:48
Here is the example that I believe that does what you want.
The way it does is very similar to how legend object is created.
Unfortunately, the offsetbox module, which enables this example, is
not well documented. I hope the example is explanatory enough.
IHTH,
-JJ
import matplotlib.pyplot as plt
from matplotlib.offsetbox import TextArea, DrawingArea, HPacker, AnnotationBbox
import matplotlib.lines as mlines
ax = plt.subplot(111)
fontsize=15
box1 = TextArea("This is the square marker :", textprops=dict(color="k",
 size=fontsize))
# create a drwaing area for a marker
# It will have width*height = fontsize*0.8fontsize
# and xdescent, ydescent = 0*0.2fontsize
box2 = DrawingArea(fontsize, 0.8*fontsize,
 0, 0.2*fontsize)
# maker
l1 = mlines.Line2D([0.5*fontsize], [0.25*fontsize], marker="s",
 markersize=(0.5*fontsize))
# add the marker to the drawing area
box2.add_artist(l1)
# now combine the textarea and the drawing area (marker)
box = HPacker(children=[box1, box2],
 align="baseline",
 pad=0, sep=fontsize*0.2)
# Use AnnotationBbox object using *box*. Note that the AnnotationBbox
is very similar to annotate. It uses offsetbox object instead of the
text object
a_box = AnnotationBbox(box, xy=(0., 1.),
 xycoords='data',
 xybox=(fontsize, -fontsize),
 boxcoords="offset points",
 box_alignment=(0., 1),
 frameon=True,
 )
ax.add_artist(a_box)
plt.show()
On Wed, Nov 24, 2010 at 1:22 AM, Alejandro Weinstein
<ale...@gm...> wrote:
> Hi:
>
> I want to use the symbol corresponding to a marker in a text
> annotation. Something like
>
> textstr = 'This is the square marker: ?'
> ax.text(0.05, 0.95, textstr)
>
> Is there something I can place where the question mark is above to get
> the actual square (or any other of the symbols you can use as a
> marker)?
>
> This is similar to what the legend command does, but I need more flexibility.
>
> Alejandro.
>
> ------------------------------------------------------------------------------
> Increase Visibility of Your 3D Game App & Earn a Chance To Win 500ドル!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with the
> Intel(R) Software Partner Program. Five 500ドル cash prizes are up for grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Benoist L. <be...@ib...> - 2010年11月26日 13:35:32
Thank you for your answer.
I read the text and annotate manual pages.
I don't understand how the "polar" xycoords/textcoords works.
I guess I should use this but its not clear to me.
Le 26 nov. 10 à 14:13, Alan G Isaac a écrit :
> On 11/26/2010 8:12 AM, Benoist Laurent wrote:
>> How can I manage the annotation of points forming a circle if I have
>> their coordinates?
>
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.annotate
>
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.text
>
> http://matplotlib.sourceforge.net/examples/api/joinstyle.html
>
> hth,
> Alan Isaac
>
> ------------------------------------------------------------------------------
> Increase Visibility of Your 3D Game App & Earn a Chance To Win 500ドル!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with 
> the
> Intel(R) Software Partner Program. Five 500ドル cash prizes are up for 
> grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Alan G I. <ala...@gm...> - 2010年11月26日 13:13:22
On 11/26/2010 8:12 AM, Benoist Laurent wrote:
> How can I manage the annotation of points forming a circle if I have
> their coordinates?
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.annotate
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.text
http://matplotlib.sourceforge.net/examples/api/joinstyle.html
hth,
Alan Isaac
From: Benoist L. <Be...@ib...> - 2010年11月26日 13:06:55
Hi,
I'm a new matplotlib user and I'm already impressed by matplotlib's 
features!
But I can't find how to do something that looks quite easy.
I have several points making something that looks like a circle.
I would like to anotate these point.
How can I manage the annotation of points forming a circle if I have 
their coordinates?
Any help would be appreciate.
Thank you.
Ben
From: Fred P. <fre...@gm...> - 2010年11月26日 10:28:28
Hi,
I'm trying to install matplotlib on a windows machine at work to try and
demonstrate its usefulness. I have Python 2.6 installed and managed to use
the numpy binary install without admin priviledges.
The matplotlib binary installer, however, requires admin priviledges, and I
don't understand why - is an alternative installer available, because
otherwise, I'll have to drop matplotlib and Python for somethign else, as IT
will take a month or two to install it for me.
I know I could build it myself, but the same restrictions are causing
problems getting the pre-requisites installed!
Cheers,
Fred
From: Daoliang T. <dao...@gm...> - 2010年11月26日 01:54:29
Dear all,
I am facing a weird problem when I import pylab or pyplot modules.
Right now, I can successfully import matplotlib. But after I issue
the command "ipython -pylab --verbose-helpful", I get the following
error:
=================================================================================================================================================
$HOME=/home/michael
CONFIGDIR=/home/michael/.matplotlib
matplotlib data path /usr/share/matplotlib/mpl-data
loaded rc file /etc/matplotlibrc
matplotlib version 0.99.3
verbose.level helpful
interactive is False
units is False
platform is linux2
font search path ['/usr/share/matplotlib/mpl-data/fonts/ttf',
'/usr/share/matplotlib/mpl-data/fonts/afm']
Traceback (most recent call last):
 File "/usr/bin/ipython", line 28, in <module>
 IPython.Shell.start().mainloop()
 File "/usr/lib/pymodules/python2.6/IPython/Shell.py", line 1241, in start
 return shell(user_ns = user_ns)
 File "/usr/lib/pymodules/python2.6/IPython/Shell.py", line 1106, in __init__
 shell_class=MatplotlibShell)
 File "/usr/lib/pymodules/python2.6/IPython/Shell.py", line 73, in __init__
 debug=debug,shell_class=shell_class)
 File "/usr/lib/pymodules/python2.6/IPython/ipmaker.py", line 100, in
make_IPython
 embedded=embedded,**kw)
 File "/usr/lib/pymodules/python2.6/IPython/Shell.py", line 627, in __init__
 user_ns,user_global_ns,b2 =
self._matplotlib_config(name,user_ns,user_global_ns)
 File "/usr/lib/pymodules/python2.6/IPython/Shell.py", line 556, in
_matplotlib_config
 import matplotlib.pylab as pylab
 File "/usr/lib/pymodules/python2.6/matplotlib/pylab.py", line 206, in <module>
 from matplotlib import mpl # pulls in most modules
 File "/usr/lib/pymodules/python2.6/matplotlib/mpl.py", line 2, in <module>
 from matplotlib import axis
 File "/usr/lib/pymodules/python2.6/matplotlib/axis.py", line 10, in <module>
 import matplotlib.font_manager as font_manager
 File "/usr/lib/pymodules/python2.6/matplotlib/font_manager.py", line
1301, in <module>
 _rebuild()
 File "/usr/lib/pymodules/python2.6/matplotlib/font_manager.py", line
1292, in _rebuild
 fontManager = FontManager()
 File "/usr/lib/pymodules/python2.6/matplotlib/font_manager.py", line
1010, in __init__
 self.afmlist = createFontList(self.afmfiles, fontext='afm')
 File "/usr/lib/pymodules/python2.6/matplotlib/font_manager.py", line
578, in createFontList
 font = afm.AFM(fh)
 File "/usr/lib/pymodules/python2.6/matplotlib/afm.py", line 303, in __init__
 parse_afm(fh)
 File "/usr/lib/pymodules/python2.6/matplotlib/afm.py", line 291, in parse_afm
 dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
 File "/usr/lib/pymodules/python2.6/matplotlib/afm.py", line 176, in
_parse_char_metrics
 bbox = _to_list_of_floats(vals[3][2:])
 File "/usr/lib/pymodules/python2.6/matplotlib/afm.py", line 58, in
_to_list_of_floats
 return [_to_float(val) for val in s.split()]
ValueError: invalid literal for float(): uni2605
===========================================================================================================================================
Each time, as long as I import pylab OR pyplot, I will obtain
"ValueError: invalid literal for float(): uni2605". After googling a
long time, I can not get an idea to address this issue. Can anyone
give me some hints?
My computer configuration is the following:
1. OS: debian squeeze Linux 2.6.32-5-amd64 #1 SMP Sat Oct 30 14:18:21
UTC 2010 x86_64 GNU/Linux
2. matplotlib version: 0.99.3
3. The matplotlib is installed from the debian repository.
4. no any special customization of "matplotlibrc"
5. import pylab will produce this error.
6. python version: 2.6.6-3
I have reinstalled these packages many times and this does not solve
this issue.
Thanks for your help!
Daoliang
From: Gökhan S. <gok...@gm...> - 2010年11月25日 21:40:09
On Wed, Nov 24, 2010 at 8:38 AM, Alejandro Weinstein
<ale...@gm...> wrote:
> On Tue, Nov 23, 2010 at 9:37 AM, Gökhan Sever <gok...@gm...> wrote:
>> As I have learnt from Michael Droettboom, you can simply use unicode
>> characters with a supported font set:
>> In my setup I prefer DejaVu-Sans. First install these fonts into your
>> system, then edit your matplotlibrc
>
> Thanks for the answer. But I think there must be an easier way without
> the need to install anything. After all, the legend command is able to
> create text using the markers.
>
> Alejandro.
>
You have three options then:
1-) Figure out how legend handles symbol drawing.
2-) Use latex / mathtext to represent symbols.
3-) Install a font and more intuitively insert a sqaure box into your string.
For me, as long as the expression that is drawn on screen is not
complicated, I am very happy using the unicode text approach.
-- 
Gökhan
From: Benjamin R. <ben...@ou...> - 2010年11月25日 15:34:16
On Wednesday, November 24, 2010, Daniel Hyams <dh...@gm...> wrote:
> MPL 1.0.0, OSX
> If USE_FONTCONFIG is turned on, the function FontProperties.get_size_in_points will sometimes fail, because it is wanting to use "fontManager", which is still 'None' if USE_FONTCONFIG is on. I'm not sure if it's the proper way to fix it, but here is a small patch that works (meaning that at least the code doesn't die; I can't vouch for much else):
>
>
> ORIGINAL:
>   def get_size_in_points(self):    if self._size is not None:      try:        return float(self._size)
>
>       except ValueError:        pass    default_size = fontManager.get_default_size()    return default_size * font_scalings.get(self._size)
>
>
> NEW:
>   def get_size_in_points(self):    if self._size is not None:      try:        return float(self._size)      except ValueError:
>
>         pass    if fontManager:      default_size = fontManager.get_default_size()    else:      default_size = rcParams['font.size']
>
>     return default_size * font_scalings.get(self._size)
>
> --
> Daniel Hyams
> dh...@gm...
>
>
I personally think that this is reasonable, as it guarantees a size
value to come from somewhere. However, I am concerned about
fontManager being None. If it isn't a bug for it to be None at this
point, then I have to wonder where-else in the code needs a check for
None? If it is a bug, then what should it be when USE_FONTCONFIG is
true?
Good catch Daniel.
Ben Root
From: robert f. <rob...@gm...> - 2010年11月25日 13:24:19
Hello - I am using python 2.6, numpy-1.3.0-win32-
superpack-python2.6, scipy-0.7.1-win32-superpack-python2.6,
sympy-0.6.7.win32,
matplotlib-1.0.0.win32-py2.6, and brian-1.2.1.win32.
I would like to "import pylab" , however I get the following messages
shown below. Any assistnce would be highly appreciated.
Thank you.
Robert
*********************************************************************************
import pylab
 File "F:\Python26\lib\site-packages\pylab.py", line 1, in <module>
 from matplotlib.pylab import *
 File "F:\Python26\lib\site-packages\matplotlib\pylab.py", line 206, in
<module>
 from matplotlib import mpl # pulls in most modules
 File "F:\Python26\lib\site-packages\matplotlib\mpl.py", line 2, in
<module>
 from matplotlib import axis
 File "F:\Python26\lib\site-packages\matplotlib\axis.py", line 10, in
<module>
 import matplotlib.font_manager as font_manager
 File "F:\Python26\lib\site-packages\matplotlib\font_manager.py", line
1301, in <module>
 _rebuild()
 File "F:\Python26\lib\site-packages\matplotlib\font_manager.py", line
1292, in _rebuild
 fontManager = FontManager()
 File "F:\Python26\lib\site-packages\matplotlib\font_manager.py", line 984,
in __init__
 self.ttffiles = findSystemFonts(paths) + findSystemFonts()
 File "F:\Python26\lib\site-packages\matplotlib\font_manager.py", line 330,
in findSystemFonts
 for f in win32InstalledFonts(fontdir):
 File "F:\Python26\lib\site-packages\matplotlib\font_manager.py", line 213,
in win32InstalledFonts
 key, direc, any = _winreg.EnumValue( local, j)
MemoryError
From: Daniel H. <dh...@gm...> - 2010年11月25日 04:51:47
MPL 1.0.0, OSX
If USE_FONTCONFIG is turned on, the function
FontProperties.get_size_in_points will sometimes fail, because it is wanting
to use "fontManager", which is still 'None' if USE_FONTCONFIG is on. I'm
not sure if it's the proper way to fix it, but here is a small patch that
works (meaning that at least the code doesn't die; I can't vouch for much
else):
ORIGINAL:
 def get_size_in_points(self):
 if self._size is not None:
 try:
 return float(self._size)
 except ValueError:
 pass
 default_size = fontManager.get_default_size()
 return default_size * font_scalings.get(self._size)
NEW:
 def get_size_in_points(self):
 if self._size is not None:
 try:
 return float(self._size)
 except ValueError:
 pass
 if fontManager:
 default_size = fontManager.get_default_size()
 else:
 default_size = rcParams['font.size']
 return default_size * font_scalings.get(self._size)
-- 
Daniel Hyams
dh...@gm...
From: honglei j. <jho...@gm...> - 2010年11月25日 03:19:23
i get matplotlib from Sourceforge ,it's matplotlib-1.0.0.win32-py2.6.exe
OS:Win7
ActivePython-2.6.6.15-win32-x86.msi
here is the code:
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
plt.figure(figsize=(8,4))
a = plt.text(0.05, 0.05, u"Default Font缺省字体조선어にほんごภาษาไทย")#multi language
,some cann't display
plt.text(0.05, 0.45, u"Microsoft YaHei微软雅黑", fontproperties='Microsoft
YaHei')#Chinese OK
plt.text(0.05, 0.25, u"LilyUPCภาษาไทย", fontproperties='LilyUPC')#Tai OK
plt.xlabel(u"xlabelにほんご",fontproperties='STXihei')#Japanese ,OK
plt.ylabel(u"ylabel조선어",fontproperties='Malgun Gothic')#Korea,OK
plt.show()
C:\Python26\Lib\site-packages\matplotlib\mpl-data\matplotlibrc:
font.family : sans-serif font.sans-serif : Microsoft YaHei,Malgun
Gothic,LilyUPC,FangSong,YouYuan,SimHei,STKaiti,STSong,SimSun-ExtB,Webdings,Bitstream
Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant
Garde, sans-serif
it seems if a default font doesn't have all char's in the "Default
Font缺省字体조선어にほんごภาษาไทย" string,it won't display correctly.
From: Jouni K. S. <jk...@ik...> - 2010年11月24日 16:23:29
David Pine <dp...@ny...> writes:
> "name 'xpdf' is not defined"
>
> params = {'backend': 'Agg',
 ...
> 'ps.usedistiller' : xpdf,
Put xpdf in quotes: 'xpdf' not xpdf. In the matplotlibrc file you don't
need quotes there, but if you use Python to set parameters, you do.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Alejandro W. <ale...@gm...> - 2010年11月24日 14:38:33
On Tue, Nov 23, 2010 at 9:37 AM, Gökhan Sever <gok...@gm...> wrote:
> As I have learnt from Michael Droettboom, you can simply use unicode
> characters with a supported font set:
> In my setup I prefer DejaVu-Sans. First install these fonts into your
> system, then edit your matplotlibrc
Thanks for the answer. But I think there must be an easier way without
the need to install anything. After all, the legend command is able to
create text using the markers.
Alejandro.
From: Alejandro W. <ale...@gm...> - 2010年11月24日 14:36:21
On Tue, Nov 23, 2010 at 8:15 PM, Nicolas Bigaouette
<nbi...@gm...> wrote:
> Why not just use latex?
> plt.text(0.05, 0.95, r"This is the square marker: $\Box$ Subscript: $_\Box$
> superscript: $^\Box$", fontsize=20)
It produces the following error:
Exception in Tkinter callback
Traceback (most recent call last):
 File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1413, in __call__
 return self.func(*args)
 File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py",
line 212, in resize
 self.show()
 File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py",
line 215, in draw
 FigureCanvasAgg.draw(self)
 File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
line 314, in draw
 self.figure.draw(self.renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
in draw_wrapper
 draw(artist, renderer, *kl)
 File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 773, in draw
 for a in self.axes: a.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
in draw_wrapper
 draw(artist, renderer, *kl)
 File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 1735, in draw
 a.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/text.py", line 515, in draw
 bbox, info = self._get_layout(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/text.py", line 279, in
_get_layout
 clean_line, self._fontproperties, ismath=ismath)
 File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
line 156, in get_text_width_height_descent
 self.mathtext_parser.parse(s, self.dpi, prop)
 File "/usr/lib/pymodules/python2.6/matplotlib/mathtext.py", line
2810, in parse
 box = self._parser.parse(s, font_output, fontsize, dpi)
 File "/usr/lib/pymodules/python2.6/matplotlib/mathtext.py", line
2259, in parse
 self._expression.parseString(s)
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
1048, in parseString
 loc, tokens = self._parse( instring, 0 )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
 value = self._parseNoCache( instring, loc, doActions, callPreParse )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
924, in _parseNoCache
 loc,tokens = self.parseImpl( instring, preloc, doActions )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
2559, in parseImpl
 return self.expr._parse( instring, loc, doActions, callPreParse=False )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
 value = self._parseNoCache( instring, loc, doActions, callPreParse )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
924, in _parseNoCache
 loc,tokens = self.parseImpl( instring, preloc, doActions )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
2307, in parseImpl
 loc, exprtokens = e._parse( instring, loc, doActions )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
 value = self._parseNoCache( instring, loc, doActions, callPreParse )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
924, in _parseNoCache
 loc,tokens = self.parseImpl( instring, preloc, doActions )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
2672, in parseImpl
 loc, tokens = self.expr._parse( instring, loc, doActions,
callPreParse=False )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
 value = self._parseNoCache( instring, loc, doActions, callPreParse )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
924, in _parseNoCache
 loc,tokens = self.parseImpl( instring, preloc, doActions )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
2307, in parseImpl
 loc, exprtokens = e._parse( instring, loc, doActions )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
 value = self._parseNoCache( instring, loc, doActions, callPreParse )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
924, in _parseNoCache
 loc,tokens = self.parseImpl( instring, preloc, doActions )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
2416, in parseImpl
 ret = e._parse( instring, loc, doActions )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
 value = self._parseNoCache( instring, loc, doActions, callPreParse )
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
950, in _parseNoCache
 tokens = fn( instring, tokensStart, retTokens )
 File "/usr/lib/pymodules/python2.6/matplotlib/mathtext.py", line
1997, in raise_error
 raise ParseFatalException(msg + "\n" + s)
ParseFatalException: Expected end of math '$'
This is the square marker: $\Box$ Subscript (at char 0), (line:1, col:1)
From: Nicolas B. <nbi...@gm...> - 2010年11月24日 03:15:41
Why not just use latex?
plt.text(0.05, 0.95, r"This is the square marker: $\Box$ Subscript: $_\Box$
superscript: $^\Box$", fontsize=20)
From: David P. <dp...@ny...> - 2010年11月23日 19:39:48
I am using Latex for text rendering in some matplotlib plots and I would like to use the Times rather than the Computer Modern fonts. I would also like to be able to edit the saved plot files with Adobe Illustrator when they are saved. The "Text rendering With LaTeX" web page (http://matplotlib.sourceforge.net/users/usetex.html?highlight=xpdf%20latex) says that to produce postscript text so that in can be edited in Adobe Illustrator I should set ps.usedistiller to xpdf in the rcparams. This I have done, but I get an error message "name 'xpdf' is not defined" when I run the program. Can anyone help?
I am running this on a MacBook Pro under OSX 10.6. I am using the the Enthought 6.3 distribution (which includes matplotlib 1.0). xpdf is installed on my machine and works.
Here is the code where I set the rc params
from matplotlib import rcParams
fig_width = 5.8 # width in inches
fig_height = 3.0 # height in inches
fig_size = (fig_width, fig_height)
params = {'backend': 'Agg',
 'axes.labelsize': 9,
 'axes.titlesize': 9,
 'legend.fontsize': 9,
 'xtick.labelsize': 6,
 'ytick.labelsize': 6,
 'figure.figsize': fig_size,
 'savefig.dpi' : 600,
 'ps.usedistiller' : xpdf,
 'text.usetex' : True,
 'font.family': 'sans-serif',
 'font.serif' : ['Times'],
 'axes.linewidth' : 0.5,
 'xtick.major.size' : 2,
 'ytick.major.size' : 2,
 'font.size' : 9}
rcParams.update(params)
Thanks to anyone who can help
David Pine
From: David P. <dp...@ny...> - 2010年11月23日 19:33:18
I am using Latex for text rendering in some matplotlib plots and I would like to use the Times rather than the Computer Modern fonts. I would also like to be able to edit the saved plot files with Adobe Illustrator when they are saved. The "Text rendering With LaTeX" web page (http://matplotlib.sourceforge.net/users/usetex.html?highlight=xpdf%20latex) says that to produce postscript text so that in can be edited in Adobe Illustrator I should set ps.usedistiller to xpdf in the rcparams. This I have done, but I get an error message "name 'xpdf' is not defined" when I run the program. Can anyone help?
I am running this on a MacBook Pro under OSX 10.6. I am using the the Enthought 6.3 distribution (which includes matplotlib 1.0). xpdf is installed on my machine and works.
Here is the code where I set the rc params
from matplotlib import rcParams
fig_width = 5.8 # width in inches
fig_height = 3.0 # height in inches
fig_size = (fig_width, fig_height)
params = {'backend': 'Agg',
 'axes.labelsize': 9,
 'axes.titlesize': 9,
 'legend.fontsize': 9,
 'xtick.labelsize': 6,
 'ytick.labelsize': 6,
 'figure.figsize': fig_size,
 'savefig.dpi' : 600,
 'ps.usedistiller' : xpdf,
 'text.usetex' : True,
 'font.family': 'sans-serif',
 'font.serif' : ['Times'],
 'axes.linewidth' : 0.5,
 'xtick.major.size' : 2,
 'ytick.major.size' : 2,
 'font.size' : 9}
rcParams.update(params)
Thanks to anyone who can help
David Pine
From: Gökhan S. <gok...@gm...> - 2010年11月23日 16:37:25
On Tue, Nov 23, 2010 at 10:22 AM, Alejandro Weinstein
<ale...@gm...> wrote:
>
> Hi:
>
> I want to use the symbol corresponding to a marker in a text
> annotation. Something like
>
> textstr = 'This is the square marker: ?'
> ax.text(0.05, 0.95, textstr)
>
> Is there something I can place where the question mark is above to get
> the actual square (or any other of the symbols you can use as a
> marker)?
>
> This is similar to what the legend command does, but I need more flexibility.
>
> Alejandro.
>
As I have learnt from Michael Droettboom, you can simply use unicode
characters with a supported font set:
In my setup I prefer DejaVu-Sans. First install these fonts into your
system, then edit your matplotlibrc
font.family : sans-serif
font.sans-serif : DejaVu Sans
or alternatively using your favorite unicode font.
then try this example (suggest using a unicode supported text editor
(e.g., vim)):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
plt.plot(range(100))
plt.text(0.05, 0.95, u"This is the square marker: しろいしかく", fontsize=20)
plt.show()
Unicode characters are great for putting units, but it is not easy to
construct complex equations. Does anyone know if there is
sub/super-script range alphabet (not only numbers) supported unicode
font set?
--
Gökhan
From: Alejandro W. <ale...@gm...> - 2010年11月23日 16:22:46
Hi:
I want to use the symbol corresponding to a marker in a text
annotation. Something like
textstr = 'This is the square marker: ?'
ax.text(0.05, 0.95, textstr)
Is there something I can place where the question mark is above to get
the actual square (or any other of the symbols you can use as a
marker)?
This is similar to what the legend command does, but I need more flexibility.
Alejandro.
From: Tim Å. <qw...@ho...> - 2010年11月23日 14:59:14
Thanks for the reply!
Do you know what makes X climb? And can you control its on some way?
// Tim
> From: jd...@gm...
> Date: 2010年11月17日 05:55:04 -0600
> Subject: Re: [Matplotlib-users] Formatter dates
> To: qw...@ho...
> CC: mat...@li...
> 
> On Wed, Nov 17, 2010 at 2:29 AM, Tim Åberg <qw...@ho...> wrote:
> > Hello!
> >
> > I have now been tampering with a custom formatter and the more i think about
> > it the more i feel there must be a more easy soulution. I have a set of
> > values that are plotted over time (i use date2num, to get the conversion
> > from date to num), i also have a list with dates that corresponds to these
> > values;
> > ['2010-11-05 10:27:45.605000', '2010-11-05 10:27:50.576000', '2010-11-05
> > 10:27:55.913000'], this to not have to do a conversion back, i imagine its
> > the most effective way to do it.
> >
> > Now to the question;
> >
> > The only two values in the datelist that is vital is the first and the last,
> > in between i really just want to have values that corresponds lineary. Thats
> > brings me to resoulution, if the values are far far in between, say weeks or
> > even moth the time (h:s:ms) isnt so important and vice versa.
> >
> > Is there any formatter that do this sort of things? eg. takes in two
> > values(dates) and format it by itself.
> 
> Take a look at this example
> 
> http://matplotlib.sourceforge.net/examples/api/date_index_formatter.html
> 
> It's trying to solve a different but related problem: in financial
> time series you only have data on Monday - Friday, and you don't want
> to plot the gaps on weekends. So you plot the data linearly with an
> index, and use a custom locator and formatter to set and format the
> ticks.
> 
> JDH
 		 	 		 
From: G. D. <g....@in...> - 2010年11月23日 13:34:27
On 11/16/2010 07:41 PM, Stan West wrote:
> I believe I see how you could do it. The errorbar call returns the tuple p =
> (plotline, caplines, barlinecols) [1], and to update the errorbars, you must
> modify the objects in the caplines and barlinecols lists. Each element of the
> caplines list is a Line2D artist [2] for the left, right, top, or bottom caps;
> you can use its methods set_data, set_xdata, or set_ydata to modify its
> coordinates, as you did for the main line. Each element of the barlinecols
> list is a LineCollection [3] artist responsible for all of the x or y
> errorbars; you can use the set_segments method to provide new coordinates.
>
> [1]
> http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.errorbar
> [2]
> http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D
> [3]
> http://matplotlib.sourceforge.net/api/collections_api.html#matplotlib.collections.LineCollection
> 
Thanks Stan,
with your suggestion I was able to solve the problem, even if it is not 
immediate (but not too long). This is what I did:
plotline, caplines, barlinecols = plt.errorbar(x, y, yerr, xerr)
# Now move the line
y = y/2.
# Replot the data first
plotline.set_data(x,y)
# Find the ending points of the errorbars
error_positions = (x-xerr,y), (x+xerr,y), (x,y-yerr), (x,y+yerr)
# Update the caplines
for i,pos in enumerate(error_positions):
 caplines[i].set_data(pos)
# Update the error bars
barlinecols[0].set_segments(zip(zip(x-xerr,y), zip(x+xerr,y)))
barlinecols[1].set_segments(zip(zip(x,y-yerr), zip(x,y+yerr)))
The last lines are a little clumsy, but I could not find a better way. 
Anyway, it could be nice to have a method like set_errorbar(x, y, yerr, 
xerr) to do the job.
Many thanks again
Gianfranco
-- 
Istituto Nazionale di Ricerca Metrologica (I.N.Ri.M)
(former Istituto Elettrotecnico Nazionale Galileo Ferraris)
Strada delle Cacce, 91 - 10135 Torino Italy
tel: ++39 011 3919839 fax: ++39 011 3919834
Personal home page: http://www.inrim.it/~durin/
INRiM home pag: http://www.inrim.it/
=============================================================
Please note my new e-mail: g....@in...
=============================================================
8 messages has been excluded from this view by a project administrator.

Showing results of 312

<< < 1 2 3 4 .. 13 > >> (Page 2 of 13)
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 によって変換されたページ (->オリジナル) /