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




Showing 7 results of 7

From: Paul B. <ba...@st...> - 2004年11月01日 20:21:13
John Hunter wrote:
>>>>>>"Carl" == Carl Dr Kleffner <cmk...@gm...> writes:
>>>>>> 
>>>>>>
>
> Carl> I would like to try this. Due to time constraints, it may
> Carl> take some time. As far as I understand I have to use the
> Carl> GlyphIDs as well as the map code from cmap_format_4 to
> Carl> create a latex_to_umbelleek dictionary. Any hints from font
> Carl> experts are appreciated.
>
>The minimum you need to do is provide a dictionary that maps TeX
>symbol name to the fontname/glyphindex for that symbol. Eg for \pm in
>bakoma, the font name is cmsy10.ttf, the glyph index is 8 , the
>character code is 167 (hex is 0xa7) and the glyph name is plusminus.
>The entry in the latex_to_bakoma dict is
>
> r'\pm' : ('cmsy10', 8),
>
>
>From the fontname and glyph index, we can get the character code and
>glyphname from the ttf file. I have written a little helper script
>for you. It's brute force and ain't terribly pretty, but it (mostly,
>see below) works.
>
> http://matplotlib.sf.net/share/font_table.py
>
>This creates a font grid table png using the agg backend and
>matplotlib's ft2font module - you'll probably want to get the latest
>CVS matplotlib for this to work properly - I'm not 100% sure this is
>required but it is at least strongly recommended.
>
>It will produce font grid images for the font specified on the command
>like, like the following for umr10.ttf
>
> http://matplotlib.sf.net/share/umr10.ttf.png
>
>You can use these grid tables to get the hex charcode code of the
>symbol you want, and the output of the script lists the glyphind,
>ccode, hex(ccode), and name, sorted by charcode, so you can look up
>the glyphind form the hex code. Ie
>
> 1) Pick a new tex symbol.
>
> 2) Find the corresponding character in one of the umbellek font
> table pngs, or by using the glyph names listed when you run the
> font_table script.
>
> 3) Use the font_table output to get the glyphind corresponding to
> the symbol/name of interest.
>
> 4) GOTO 1
>
>There is probably a better way, but with a combination of glyphnames
>and grid tables you can knock this out in several hours of tedious
>work. Any other information you want to attach while you are in the
>thick of it (mathml names, unicode chars) would be a great, but is not
>necessary.
>
> Carl> I would like to add codes for accented chars: r'ä':
> Carl> ('umr10', <code>) Should _mathtext_data.py contain a
> Carl> encoding line, i.e. # -*- coding: latin1 -*- to allow
> Carl> non-Ascii chars?
>
>Perhaps others can give input here about what would be the best way to
>proceed. My inclination is to use the TeX names like \"a where
>possible, but by all means add them if you have them - getting the
>codes is the relatively tedious part, providing the proper interface
>to them can be worked out later. It may require some changes to the
>parser to support \"a and friends, but this is no problem.
> 
>
A possible alternative approach to getting the proper glyph from the TTF 
file is to map the LaTeX name into the PostScript name and then use the 
PS name to find the glyph index from ft2font::get_name_index(). This or 
a similar approach is what I had in mind when I first implemented the 
TTF code. This assumes that the glyphs associated with the PS names 
adhere to the Adobe PS naming definition. In this case, the PS name 
could be used to create on-the-fly a lookup dictionary of the 
fontname/index.
My memory is a bit hazy on this issue, but I seem to recall that the TeX 
font names are not completely consistent with the Adobe PS names. In 
addition, there needed to be a mechanism to distinguish between the same 
glyph in different Bakoma fonts. I'm guessing that the more recent 
fonts probably adhere to the PS font naming convention and therefore it 
might be worthwhile persuing this approach again. It sure would make it 
easier to create the math font tables and to use other fonts that 
contain such mathematical glyphs.
>Now, on to the "mostly working" part of the font_table script, which
>is why I CCd Paul on this email. The font_table script is working on
>the um*.ttf fonts but failing on the bl*.ttf fonts. The reason it is
>failing is that FT2Font::get_charmap is returning an empty dict.
>These fonts are not empty, eg ft2font reports 1 face, 2 charmaps, and
>124 glyphs for blsy.ttf, but get_charmap is returning empty, because
>the call to
>
> FT_ULong code = FT_Get_First_Char(face, &index);
>
>is returning 0 for code and index.
>
>Any ideas? 
> 
>
John, you appear to have solved this one yourself.
 -- Paul
-- 
Paul Barrett, PhD Space Telescope Science Institute
Phone: 410-338-4475 ESS/Science Software Branch
FAX: 410-338-4767 Baltimore, MD 21218
From: Jochen V. <vo...@se...> - 2004年11月01日 20:09:15
Hello Alan,
On Mon, Nov 01, 2004 at 11:52:07AM -0500, Alan G Isaac wrote:
> http://sourceforge.net/mailarchive/forum.php?thread_id=3D5562487&forum_id=
=3D33405
Thanks, this looks incredibly useful.
I will have a closer look as soon as I find time.
All the best,
Jochen
--=20
http://seehuhn.de/
From: Jochen V. <vo...@se...> - 2004年11月01日 20:04:04
Hello Cory,
On Mon, Nov 01, 2004 at 04:24:34PM +0000, Cory Davis wrote:
> I'm not suggesting that this is a good way to to so, but it works (the
> last time I tried). Hope this helps.
Thank you very much, it works beautifully.
All the best,
Jochen
--=20
http://seehuhn.de/
From: Alan G I. <ai...@am...> - 2004年11月01日 16:51:07
On Mon, 1 Nov 2004, Jochen Voss apparently wrote:
> I would like to (mis-)use matplotlib to draw some things which
> are not graphs of functions. For this it would be nice to
> be able to fix the aspect ratio of the figure to 1. What is
> a good way to do so?
http://sourceforge.net/mailarchive/forum.php?thread_id=5562487&forum_id=33405
hth,
Alan Isaac
From: Cory D. <cd...@st...> - 2004年11月01日 16:24:54
Hi there,
I'm not suggesting that this is a good way to to so, but it works (the
last time I tried). Hope this helps.
def setDataAspectRatioByFigSize(ax,r):
 """Same idea as matlab. Adjusts the figure size to fix the aspect
ratio"""
 xlim=ax.get_xlim()
 dxlim=xlim[1]-xlim[0]
 ylim=ax.get_ylim()
 dylim=ylim[1]-ylim[0]
 pos=ax.get_position()
 dxpos=pos[2]
 dypos=pos[3]
 f=gcf()
 figsize=f.get_size_inches()
 dxfig=figsize[0]
 dyfig=dylim*dxpos*dxfig/r/dypos/dxlim
 f.set_figsize_inches(dxfig,dyfig)
def setDataAspectRatioByAxisPos(ax,r):
 """Same idea as matlab. Adjusts the axis position to fix the aspect
ratio"""
 xlim=ax.get_xlim()
 dxlim=xlim[1]-xlim[0]
 ylim=ax.get_ylim()
 dylim=ylim[1]-ylim[0]
 pos=ax.get_position()
 dxpos=pos[2]
 dypos=pos[3]
 centreypos=pos[1]+0.5*dypos
 f=gcf()
 figsize=f.get_size_inches()
 dxfig=figsize[0]
 dyfig=figsize[1]
 dypos=dylim*dxpos*dxfig/r/dyfig/dxlim
 ax.set_position([pos[0],centreypos-0.5*dypos,dxpos,dypos])
Cheers,
Cory
On Mon, 2004年11月01日 at 16:02, Jochen Voss wrote:
> Hello,
> 
> I would like to (mis-)use matplotlib to draw some things which
> are not graphs of functions. For this it would be nice to
> be able to fix the aspect ratio of the figure to 1. What is
> a good way to do so?
> 
> Jochen
-- 
))))))))))))))))))))))))))))))))))))))))))))
Cory Davis
Meteorology
School of GeoSciences
University of Edinburgh
King's Buildings
EDINBURGH EH9 3JZ
ph: +44(0)131 6505092
fax +44(0)131 6505780
cd...@st...
co...@me...
http://www.geos.ed.ac.uk/contacts/homes/cdavis
))))))))))))))))))))))))))))))))))))))))))))
From: Jochen V. <vo...@se...> - 2004年11月01日 16:02:25
Hello,
I would like to (mis-)use matplotlib to draw some things which
are not graphs of functions. For this it would be nice to
be able to fix the aspect ratio of the figure to 1. What is
a good way to do so?
Jochen
--=20
http://seehuhn.de/
From: matthew a. <ma...@ca...> - 2004年11月01日 04:33:14
Hi,
I thought I'd mention some small isuues I found with using py2exe to 
deploy matplotlib 0.63.2 on Japanese Windows 2000.
* pytz seems to need a copy of 
C:\Python23\Lib\site-packages\pytz\zoneinfo in the installed folder, 
otherwise it gives a KeyError on UTC when matplotlib is imported
* pygtk.require() is not compatible with py2exe, so I added a wrapper to 
backend_gtk.py to check for freezing:
if not hasattr(sys, 'frozen'):
 try:
 # Don't want to check this for py2exe
 import pygtk
 pygtk.require('2.0')
 except:
 print sys.exc_info()[1]
 raise SystemExit('PyGTK version 1.99.16 or greater is required 
to run the GTK/GTKAgg Matplotlib backend')
* font_manager.py throws an exception, I suspect to do with Japanese 
font names or font directory names:
File "c:\Python23\lib\site-packages\matplotlib\font_manager.py", 
line 111, in
win32InstalledFonts
 key, direc, any = _winreg.EnumValue( local, j)
WindowsError: [Errno 234]
from this site:
http://www.google.com.au/search?q=cache:B8BlgKwVYxcJ:www.cubelab.com/ymasuda/python/index_jp.html+matplotlib+local+None+windowserror&hl=en
I found a workaround to add
local = None
at line 107 of font_manager.py to give this:
 for fontdir in MSFontDirectories:
 try:
 local = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, fontdir)
 except OSError:
 continue
 local = None
 if not local:
 return glob.glob(os.path.join(directory, '*.'+fontext))
* gtk 2.2.? was crashing (segfault) on Japanese Win2k so I upgraded to 
the latest (2.4.13) and now it seems to work. However now I get various 
dprecation warnings about the GTK toolbar when I show a plot. And 
IPython seems to break with GTK 2.4.x.
* Generally getting it all to work required quite a bit of fiddling and 
munging various recipes I found on email lists and in the pygtk FAQ. 
This included copying the matplotlib shared data into the installation 
and experimenting with different locations for it, and copying the gtk 
runtime into the installation and modifying the path within python so it 
could be found.
Thanks for matplotlib!
Cheers,
Matthew.

Showing 7 results of 7

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