SourceForge logo
SourceForge logo
Menu

matplotlib-devel — matplotlib developers

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
(1)
Nov
(33)
Dec
(20)
2004 Jan
(7)
Feb
(44)
Mar
(51)
Apr
(43)
May
(43)
Jun
(36)
Jul
(61)
Aug
(44)
Sep
(25)
Oct
(82)
Nov
(97)
Dec
(47)
2005 Jan
(77)
Feb
(143)
Mar
(42)
Apr
(31)
May
(93)
Jun
(93)
Jul
(35)
Aug
(78)
Sep
(56)
Oct
(44)
Nov
(72)
Dec
(75)
2006 Jan
(116)
Feb
(99)
Mar
(181)
Apr
(171)
May
(112)
Jun
(86)
Jul
(91)
Aug
(111)
Sep
(77)
Oct
(72)
Nov
(57)
Dec
(51)
2007 Jan
(64)
Feb
(116)
Mar
(70)
Apr
(74)
May
(53)
Jun
(40)
Jul
(519)
Aug
(151)
Sep
(132)
Oct
(74)
Nov
(282)
Dec
(190)
2008 Jan
(141)
Feb
(67)
Mar
(69)
Apr
(96)
May
(227)
Jun
(404)
Jul
(399)
Aug
(96)
Sep
(120)
Oct
(205)
Nov
(126)
Dec
(261)
2009 Jan
(136)
Feb
(136)
Mar
(119)
Apr
(124)
May
(155)
Jun
(98)
Jul
(136)
Aug
(292)
Sep
(174)
Oct
(126)
Nov
(126)
Dec
(79)
2010 Jan
(109)
Feb
(83)
Mar
(139)
Apr
(91)
May
(79)
Jun
(164)
Jul
(184)
Aug
(146)
Sep
(163)
Oct
(128)
Nov
(70)
Dec
(73)
2011 Jan
(235)
Feb
(165)
Mar
(147)
Apr
(86)
May
(74)
Jun
(118)
Jul
(65)
Aug
(75)
Sep
(162)
Oct
(94)
Nov
(48)
Dec
(44)
2012 Jan
(49)
Feb
(40)
Mar
(88)
Apr
(35)
May
(52)
Jun
(69)
Jul
(90)
Aug
(123)
Sep
(112)
Oct
(120)
Nov
(105)
Dec
(116)
2013 Jan
(76)
Feb
(26)
Mar
(78)
Apr
(43)
May
(61)
Jun
(53)
Jul
(147)
Aug
(85)
Sep
(83)
Oct
(122)
Nov
(18)
Dec
(27)
2014 Jan
(58)
Feb
(25)
Mar
(49)
Apr
(17)
May
(29)
Jun
(39)
Jul
(53)
Aug
(52)
Sep
(35)
Oct
(47)
Nov
(110)
Dec
(27)
2015 Jan
(50)
Feb
(93)
Mar
(96)
Apr
(30)
May
(55)
Jun
(83)
Jul
(44)
Aug
(8)
Sep
(5)
Oct
Nov
(1)
Dec
(1)
2016 Jan
Feb
Mar
(1)
Apr
May
Jun
(2)
Jul
Aug
(3)
Sep
(1)
Oct
(3)
Nov
Dec
2017 Jan
Feb
(5)
Mar
Apr
May
Jun
Jul
(3)
Aug
Sep
(7)
Oct
Nov
Dec
2018 Jan
Feb
Mar
Apr
May
Jun
Jul
(2)
Aug
Sep
Oct
Nov
Dec
S M T W T F S
1
2
(6)
3
(6)
4
(9)
5
(3)
6
(4)
7
8
(8)
9
(4)
10
11
(4)
12
(2)
13
(4)
14
(3)
15
(1)
16
(1)
17
(6)
18
(3)
19
20
(2)
21
(3)
22
(4)
23
(2)
24
(5)
25
(1)
26
27
(3)
28
(3)
29
(3)
30
(1)
31
(2)




Showing 8 results of 8

From: Darren D. <dd...@co...> - 2005年05月08日 22:05:30
On Thursday 05 May 2005 11:44 pm, John Hunter wrote:
[...]
>
> The next task is to take a set of fonts and build a mapping from
> unicode index to fontname, glyph index. This will require some
> mastery of ft2font. Last time I was working on this I wrote
> examples/font_indexing.py, mainly as a reminder to myself, on how to
> use the module to extract the relevant information from font files,
> character names, glyph indexes and character codes. I now wish I had
> added more comments <wink>. You may want to try this example, read
> over it, and make sure you understand what it is doing (add comments
> as you learn and commit the updates to CVS).
Traceback (most recent call last):
 File "font_indexing.py", line 36, in ?
 print 'AV', font.get_kerning(glyphd['A'], glyphd['V'])/64.0
IndexError: Unexpected SeqBase<T> length.
I had to make a change to font_indexing.py, the call to get_kerning() needed a 
kerning mode parameter. This will output information that can be compared 
with values reported by fontforge:
print 'AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNSCALED)
print 'AA', font.get_kerning(glyphd['A'], glyphd['A'], KERNING_UNSCALED)
The results are:
Vera: (same in fontforge)
AV -131
AA 57
VeraSe: (same in fontforge)
AV -102
AA 0
FreeSerif:
AV 0.0 (-131 according to fontforge)
AA 0.0
FreeSans:
AV 0.0 (-75 according to fontforge)
AA 0.0
PostScript output using the freefont afm's also appears to not be kerned, 
which I dont understand. 
Darren
From: Darren D. <dd...@co...> - 2005年05月08日 16:58:18
I am continuing to make progress reproducing Baptiste's results. I am now at 
the final step of his tutorial, I have been able to generate a postscript 
file using afm fonts, by editing the strings as he suggested. On my system, 
~/.fonts is on the gs path, so I stuck the Free*.ps files there and renamed 
them.
One note. The postscript file renders well, but I had trouble converting it to 
a pdf with ghostscript-7.07. Some of the glyphs would render right on top of 
each other, here is an example where I tried to render 
\hbar\hbar\hbar\hbar\omega\omega\omega\omega\hbar\omega\hbar\omega:
http://people.ccmr.cornell.edu/~dd55/matplotlib/unicode/useafm.ps
http://people.ccmr.cornell.edu/~dd55/matplotlib/unicode/useafm.pdf
I ended up uninstalling the GPL'd ghostscript and installed the AFPL verion 
8.51. After that, ps2pdf worked as expected.
Darren
From: Darren D. <dd...@co...> - 2005年05月08日 14:01:23
On Saturday 07 May 2005 10:46 pm, Darren Dale wrote:
>
> At this point, I was not able to save a ps figure with ps.useafm=True. I
> get the following error
[...]
> KeyError: 295
I was able to work through this problem this morning, it was an issue with 
fontforge: inexperienced operator.
> If we try to look at our figure now, ghostscript will complain about
> '/rangecheck yada yada' and fail to display the figure. This is because
> postscript doesn't understand utf-8 encoding.
> Postscript does however understand unicode hexa codes. So we have to replace
> (R(316円251円)) [ octal representation of utf-8 characters ]
> with
> <0052002803a90029> [ each 4 hexa figures are one character ]
> For now, we have to do that manually in our favorite text editor. To compute
> the hexa code in python, we do:
> >>> unistr=u'R(\u03a9)'
> >>> print ('<'+'%04x'*len(unistr)+'>') % tuple([ord(c) for c in unistr])
I tried replacing the characters in my ps file, but was not able to render the 
characters. Would you mind sending me your file, so I can see what you did?
> Producing pretty PDFs is well and nice, but most publishers will ask for
> .eps with all fonts embedded. So we have to embed the fonts into the .eps
> file. I could find no program to do this. DO NOT use gs -sDEVICE=pswrite
> for that. Not only will ghostscript mangle the fonts, but also the plots 
(!).
> 
> Luckily, the FreeSans.ps from above is already a postscript with embedded
> fonts, so we are golden. Just cat the font files together with the .eps
> and merge the headers and footers by hand.
> 
> [ It would be nice to have a ps.embedfonts preference. For Type 0, this is
> easy, as above; I don't know for Type 1. Also, it would be good to embed
> only the needed glyphs, but I haven't looked at how to do it ]
I slept on exactly these considerations last night. I was thinking that we 
should embed only the needed glyphs, and it should not be optional. The 
output has to be portable. Embedding AFM fonts should also take care of the 
PostScript kerning issues we have been talking about.
-- 
Darren S. Dale
Bard Hall
Department of Materials Science and Engineering
Cornell University
Ithaca, NY. 14850
dd...@co...
From: Florent R. <f.r...@fr...> - 2005年05月08日 12:17:21
John Hunter <jdh...@ac...> wrote:
> I think what you are looking for is the "bar" function --
> http://matplotlib.sf.net/matplotlib.pylab.html#-bar. See
> examples/barchart_demo.py.
>
> Or do I misundertand what you are after..
You understood well, thank you. I was confused because at first, when I
looked at hist(), I saw that its argument 'bins' can be a sequence. From
that, I inferred that non-uniform widths were allowed for the bins.
After testing and reading the code, I understood this was wrong. Then, I
quickly looked at Axes.bar's docstring, since it was used in hist(), and
its beginning:
 BAR(left, height, width=0.8, bottom=0,
 color='b', yerr=None, xerr=None, ecolor='k', capsize=3)
 Make a bar plot with rectangles at
 left, left+width, 0, height
 left and height are Numeric arrays.
made me think that 'width' could only be a float, not an array.
So, bar() does what I need. There is still one somewhat weird thing,
however: barh() (as the barv() I wrote based on barh()) works with the
*centers* of the bars (y-coordinates for barh(), x-coordinates for
barv()) whereas bar() expects the *left* x-coordinates of the bars in
its first argument. This is not a drama, but a bit inconsistent.
Thanks.
-- 
Florent
From: John H. <jdh...@ac...> - 2005年05月08日 05:12:25
>>>>> "Florent" == Florent Rougon <f.r...@fr...> writes:
 Florent> direction. Therefore, I wrote its twin sister,
 Florent> Axes.barv(), based on Axes.barh(). The patch included in
I think what you are looking for is the "bar" function --
http://matplotlib.sf.net/matplotlib.pylab.html#-bar. See
examples/barchart_demo.py.
Or do I misundertand what you are after..
JDH
From: Darren D. <dd...@co...> - 2005年05月08日 03:07:38
On Saturday 07 May 2005 10:46 pm, Darren Dale wrote:
> >
> > Now it's time to produce a PDF. Run ps2pdf on one of the plots above,
> > at look at the ugly Type 3 fonts in your prefered PDF viewer.
> > The only way to get decent PDF is to set ps.useafm to True again.
>
> I copied my ttf fonts to matplotlib/fonts/ttf/, and reinstalled MPL from
> CVS. At this point, with ps.useafm=False, I was able to generate a pdf with
> really nice looking fonts. How were your fonts ugly?
I take that back, the fonts look nice in Adobe Reader 7, but not so good in 
kpdf.
From: Darren D. <dd...@co...> - 2005年05月08日 02:46:37
Baptiste,
Thank you so much for this tutorial. It was very easy to follow. I have a 
couple of comments sprinkled through the instructions
On Wednesday 20 April 2005 7:13 pm, Baptiste Carvello wrote:
> Hello,
>
> I've been playing with the unicode rendering code that got added in
> matplotlib 0.74. All tests have been done on Linux with the 0.74-1
> debian package, lazy me... They should work on any platform, but you
> will have to find out the gory details (!).
>
> [ Most of these are examples, but there are a few remarks for the ps
> backend maintainers mostly, enclosed in square brackets in the text. No
> patches yet, but if you find the ideas useful, I can give it a try later. ]
>
> To try this out, you may also need the rather complete FreeFont unicode
> font: 1) download the ttf from
> http://savannah.nongnu.org/download/freefont/freefont-ttf.tar.gz
> 2) put the .ttf files in your prefered Truetype fonts directory
> 3) remove ~/.ttffont.cache
> 4) restart matplotlib
>
> Part I: Guess what I do for a living
>
> Get your favorite interactive backend and display pretty plots
>
> >>> plot([0.3,0.01,-0.01,-0.01,-0.1,-0.1,-0.3,-0.01,0.01,0.01,0.1,0.1,0.3]
> >>>,\
>
> ... [105,100,98,90,92,101,105,100,98,90,92,101,105],'kD-')
>
> >>> ylim(85,110)
> >>> xlabel(u'\u03bc\u2080H(T)', name='FreeSans')
> >>> ylabel(u'R(\u03a9)', name='FreeSans')
> >>> ^D
>
> or weird formulas
>
> >>> figtext(0.5,0.5,u'\u0127\u03c9 \u226a k\u0432T',name='FreeSerif',\
>
> ... size=30, ha='center', va='center', color='r')
>
> >>> ^D
>
> You can also save to svg, and even to postscript (or eps) provided you set
> the ps.useafm preference to False for now.
>
> Part II: All work and no play...
>
> >>> plot([0.3,0.01,-0.01,-0.01,-0.1,-0.1,-0.3,-0.01,0.01,0.01,0.1,0.1,0.3]
> >>>,\
>
> ... [105,100,107,90,92,101,105,100,98,90,92,101,105],'kD-')
>
> >>> ylim(85,110)
> >>> text(-0.01,107,u' \u261c booh! the ugly
> >>> artifact!',name='FreeSerif',\
>
> ... size=20, va='top', ha='left')
>
> >>> ^D
>
> ;-)
>
> Part III: Ugly, dirty and mean
>
> Now it's time to produce a PDF. Run ps2pdf on one of the plots above,
> at look at the ugly Type 3 fonts in your prefered PDF viewer.
> The only way to get decent PDF is to set ps.useafm to True again.
I copied my ttf fonts to matplotlib/fonts/ttf/, and reinstalled MPL from CVS. 
At this point, with ps.useafm=False, I was able to generate a pdf with really 
nice looking fonts. How were your fonts ugly?
>
> For this to work, we have to provide the AFM files for FreeFont:
> 1) download the source of the font from:
> http://savannah.nongnu.org/download/freefont/freefont-sfd.tar.gz
> 2) download fontforge from fontforge.sourceforge.net
> 3) open each .sfd file in freefont, and run File\Generate Fonts;
> choose type 'PS Type 0'; this should produce a corresponding
> .afm and .ps file; save the .ps file for later.
This was a little confusing, I think it should read 'open each .sfd file in 
fontforge, and run ...' I was able to generate afm and ps files, but I think 
something went wrong (see below). Did you have any trouble with this step? 
> 4) move the afm file to a directory which is searched by matplotlib.
> Any subdirectory of /usr/share/fonts/ will do, provided said
> subdirectory is not a symlink
> [ is this a bug ? the implementation is in lib/font_manager.py,
> function x11FontDirectory(); os.path.walk() ignores symlinks ]
> 5) remove ~/.afmfont.cache
> 6) restart matplotlib
> 7) when you save the first .ps figure, the cache is rebuilt
At this point, I was not able to save a ps figure with ps.useafm=True. I get 
the following error, maybe fontforge had trouble generating the afm files? 
At any rate, these fonts look really great. I'm going to start working on the 
unicode mappings so you can do '$\hbar$' instead of u'\u0127'. Again, thanks 
for the tutorial! Can we commit the freefont ttf's to CVS?
Darren
/usr/lib/python2.4/site-packages/matplotlib/pylab.py in savefig(*args, 
**kwargs)
 738 def savefig(*args, **kwargs):
 739 fig = gcf()
--> 740 return fig.savefig(*args, **kwargs)
 741 if Figure.savefig.__doc__ is not None:
 742 savefig.__doc__ = Figure.savefig.__doc__
/usr/lib/python2.4/site-packages/matplotlib/figure.py in savefig(self, *args, 
**kwargs)
 515 kwargs[key] = rcParams['savefig.%s'%key]
 516
--> 517 self.canvas.print_figure(*args, **kwargs)
 518
 519
/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py in 
print_figure(self, filename, dpi, facecolor, edgecolor, orientation)
 89 else:
 90 agg = self.switch_backends(FigureCanvasAgg)
---> 91 try: agg.print_figure(filename, dpi, facecolor, edgecolor, 
orientation)
 92 except IOError, msg:
 93 error_msg_gtk('Failed to save\nError message: 
%s'%(msg,), self)
/usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py in 
print_figure(self, filename, dpi, facecolor, edgecolor, orientation)
 403 from backend_ps import FigureCanvasPS # lazy import
 404 ps = self.switch_backends(FigureCanvasPS)
--> 405 ps.print_figure(filename, dpi, facecolor, edgecolor, 
orientation)
 406 else:
 407 raise IOError('Do not know know to handle extension 
*%s' % ext)
/usr/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py in 
print_figure(self, outfile, dpi, facecolor, edgecolor, orientation)
 909 self._pswriter = StringIO()
 910 renderer = RendererPS(width, height, self._pswriter)
--> 911 self.figure.draw(renderer)
 912
 913 self.figure.set_facecolor(origfacecolor)
/usr/lib/python2.4/site-packages/matplotlib/figure.py in draw(self, renderer)
 393
 394 # render the axes
--> 395 for a in self.axes: a.draw(renderer)
 396
 397 # render the figure text
/usr/lib/python2.4/site-packages/matplotlib/axes.py in draw(self, renderer)
 1358
 1359 for zorder, i, a in dsu:
-> 1360 a.draw(renderer)
 1361
 1362 self.title.draw(renderer)
/usr/lib/python2.4/site-packages/matplotlib/text.py in draw(self, renderer)
 315
 316 return
--> 317 bbox, info = self._get_layout(renderer)
 318
 319 for line, wh, x, y in info:
/usr/lib/python2.4/site-packages/matplotlib/text.py in _get_layout(self, 
renderer)
 162 whs = []
 163 for line in lines:
--> 164 w,h = renderer.get_text_width_height(
 165 line, self._fontproperties, 
ismath=self.is_math_text())
 166 if not len(line) and not self.is_math_text():
/usr/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py in 
get_text_width_height(self, s, prop, ismath)
 191 if ismath: s = s[1:-1]
 192 font = self._get_font_afm(prop)
--> 193 l,b,w,h = font.get_str_bbox(s)
 194
 195 fontsize = prop.get_size_in_points()
/usr/lib/python2.4/site-packages/matplotlib/afm.py in get_str_bbox(self, s)
 315 for c in s:
 316 if c == '\n': continue
--> 317 wx, name, bbox = self._metrics[ord(c)]
 318 l,b,w,h = bbox
 319 if l<left: left = l
KeyError: 295
From: Florent R. <f.r...@fr...> - 2005年05月08日 00:14:57
PS: it seems you cannot specify the color as an RGB tuple, contrary to
 what the comments suggest. At least, I didn't manage to do it, and
 the bug is most probably also in Axes.barh() since the code for this
 part should be unchanged. No time to investigate, sorry.
-- 
Florent

Showing 8 results of 8

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