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

Showing 16 results of 16

From: Eric F. <ef...@ha...> - 2010年04月30日 23:02:05
Margherita Vittone wiersma wrote:
> HI,
> i am making a scatter plot and i simply use defaults for tick formatting etc;
> when i plot the data the plot show on the x axis a multiplier scaling with scintific notation;
> i would like to get rid of it , the data looks like this:
> 
> values5 = [-102.44,-102.51,-102.47,-102.52,-102.52,-102.51,-102.44,-102.51,-102.47
> -102.52,-102.52,-102.51,-102.52,-102.49,-102.51,-102.51,-102.51,-102.52
> -102.57,-102.46,-102.55,-102.51,-102.49,-102.51,-102.51,-102.51,-102.52
> ......]
> 
> values6 = [-98.58,-98.48,-98.5,-98.47,-98.52,-98.48,-98.58,-98.48,-98.5,-98.47,-98.52,
> -98.48,-98.48,-98.48,-98.48,-98.53,-98.48,-98.52,-98.58,-98.58,-98.47,
> -98.55,-98.48,-98.48,-98.53,-98.48,-98.52,-98.58,-98.58,-98.47,-98.55,
> -98.53,-98.48,-98.47,-98.42,-98.48,-98.45,-98.47,-98.52,-98.45,-98.58,
> ....]
> 
> 
> and when the plot is shown as in the the attachement it show the scintific notation
> at the x scale.
If it were just a matter of scientific notation, you would be able to 
use the ticklabel_format Axes method with style='plain' to turn it off. 
 The real problem, though, is that an offset is being used. With mpl 
from svn, you can also turn that off with the ticklabel_format() 
function or method, but with released versions you need something a 
little more arcane, e.g.
import pyplot as plt
plt.scatter(values5, values6)
ax = plt.gca()
ax.xaxis.set_major_formatter(plt.ScalarFormatter(useOffset=False))
#ax.xaxis.set_major_locator(plt.MaxNLocator(nbins=6, steps=[1,2,5,10]))
plt.draw()
The commented-out line reduces the number of tick marks; you may want to 
do this because without the offset, the tick labels can get a bit long 
and crowded.
Eric
> 
> Any input is appreciated. Thank you much
> bye for now
> 
> Margherita
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> HI,
> i am making a scatter plot and i simply use defaults for tick formatting etc;
> when i plot the data the plot show on the x axis a multiplier scaling with scintific notation;
> i would like to get rid of it , the data looks like this:
> 
> values5 = [-102.44,-102.51,-102.47,-102.52,-102.52,-102.51,-102.44,-102.51,-102.47
> -102.52,-102.52,-102.51,-102.52,-102.49,-102.51,-102.51,-102.51,-102.52
> -102.57,-102.46,-102.55,-102.51,-102.49,-102.51,-102.51,-102.51,-102.52
> ......]
> 
> values6 = [-98.58,-98.48,-98.5,-98.47,-98.52,-98.48,-98.58,-98.48,-98.5,-98.47,-98.52,
> -98.48,-98.48,-98.48,-98.48,-98.53,-98.48,-98.52,-98.58,-98.58,-98.47,
> 	 -98.55,-98.48,-98.48,-98.53,-98.48,-98.52,-98.58,-98.58,-98.47,-98.55,
> 	 -98.53,-98.48,-98.47,-98.42,-98.48,-98.45,-98.47,-98.52,-98.45,-98.58,
> ....]
> 
> 
> and when the plot is shown as in the the attachement it show the scintific notation
> at the x scale.
> 
> Any input is appreciated. Thank you much
> bye for now
> 
> Margherita
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Margherita V. w. <vi...@fn...> - 2010年04月30日 20:58:32
Attachments: sendscat.GIF
HI,
i am making a scatter plot and i simply use defaults for tick formatting etc;
when i plot the data the plot show on the x axis a multiplier scaling with scintific notation;
i would like to get rid of it , the data looks like this:
values5 = [-102.44,-102.51,-102.47,-102.52,-102.52,-102.51,-102.44,-102.51,-102.47
 -102.52,-102.52,-102.51,-102.52,-102.49,-102.51,-102.51,-102.51,-102.52
 -102.57,-102.46,-102.55,-102.51,-102.49,-102.51,-102.51,-102.51,-102.52
 ......]
values6 = [-98.58,-98.48,-98.5,-98.47,-98.52,-98.48,-98.58,-98.48,-98.5,-98.47,-98.52,
 -98.48,-98.48,-98.48,-98.48,-98.53,-98.48,-98.52,-98.58,-98.58,-98.47,
 -98.55,-98.48,-98.48,-98.53,-98.48,-98.52,-98.58,-98.58,-98.47,-98.55,
 -98.53,-98.48,-98.47,-98.42,-98.48,-98.45,-98.47,-98.52,-98.45,-98.58,
 ....]
and when the plot is shown as in the the attachement it show the scintific notation
at the x scale.
Any input is appreciated. Thank you much
bye for now
Margherita
From: Michael D. <md...@st...> - 2010年04月30日 17:35:37
The following works for me.
 from pylab import *
 plot([1,2,3], linestyle='dashed', label='foo')
 legend()
 show()
Can you be more specific about how you create the error?
Mike
Carlos Grohmann wrote:
> Hi all,
>
> I'm wirking on a wxpython app, and I realized that the legend of a
> matplotlib plot only works with solid lines. If I change the
> linestyles to dashed, dotted or dashdot, it gives an error:
>
> Traceback (most recent call last):
> File "/home/guano/Arbeit/Stout/StereoPanel.py", line 551, in PlotChecked
> self.stereoCanvas.draw()
> File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_wxagg.py",
> line 59, 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 774, 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 1721, in draw
> 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/legend.py", line 386, in draw
> self._legend_box.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
> c.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
> c.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
> c.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
> c.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 488, in draw
> c.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/lines.py", line 535, in draw
> drawFunc(renderer, gc, tpath, affine.frozen())
> File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 874,
> in _draw_lines
> self._lineFunc(renderer, gc, path, trans)
> File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 925,
> in _draw_dashed
> renderer.draw_path(gc, path, trans)
> File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
> line 98, in draw_path
> self._renderer.draw_path(gc, path, transform, rgbFace)
> TypeError: float() argument must be a string or a number
>
>
>
> This happens for Line2D and for LineCollection as well.
>
> TIA
>
> Carlos
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Carlos G. <car...@gm...> - 2010年04月30日 17:30:08
Hi all,
I'm wirking on a wxpython app, and I realized that the legend of a
matplotlib plot only works with solid lines. If I change the
linestyles to dashed, dotted or dashdot, it gives an error:
Traceback (most recent call last):
 File "/home/guano/Arbeit/Stout/StereoPanel.py", line 551, in PlotChecked
 self.stereoCanvas.draw()
 File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_wxagg.py",
line 59, 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 774, 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 1721, in draw
 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/legend.py", line 386, in draw
 self._legend_box.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
 c.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
 c.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
 c.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
 c.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 488, in draw
 c.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/lines.py", line 535, in draw
 drawFunc(renderer, gc, tpath, affine.frozen())
 File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 874,
in _draw_lines
 self._lineFunc(renderer, gc, path, trans)
 File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 925,
in _draw_dashed
 renderer.draw_path(gc, path, trans)
 File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
line 98, in draw_path
 self._renderer.draw_path(gc, path, transform, rgbFace)
TypeError: float() argument must be a string or a number
This happens for Line2D and for LineCollection as well.
TIA
Carlos
-- 
Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil
http://www.igc.usp.br/pessoais/guano
Linux User #89721
________________
Can’t stop the signal.
From: T J <tj...@gm...> - 2010年04月30日 16:37:29
On Fri, Apr 30, 2010 at 1:55 AM, Eric Firing <ef...@ha...> wrote:
>
> I don't see this in the version as I changed it in svn r8282. Are you sure
> you installed and built from svn after I made the change? Using the
> attached script, I get the two attached (gzipped) eps files. The first with
> transparent=True, has no fill operations other than for generation of the
> glyphs; the second differs from the first in having two extra fill
> operations, one for the axes patch, the other for the figure patch.
>
It looks like I messed up my install. On top of that, when I was
testing this second time, I was not bothering to create the ps (from
latex) and just using my OS's default EPS viewer to verify that
transparency was working---the problem was that Evince displays images
on a white background rather than on some distinguishing background to
let me know that it is a transparent image. Sorry for the noise, its
definitely working in r8282.
From: Michael D. <md...@st...> - 2010年04月30日 16:11:47
Michael Droettboom wrote:
> I wasn't aware of these fonts -- we may want to consider distributing 
> them with matplotlib instead (assuming the licensing makes sense) as it 
> would greatly simplify the mathtext code. Of course, that's a project I 
> may not have time for right now.
> 
On further looking into these fonts, it seems they're not appropriate at 
the moment. They are missing a number of math-related symbols (such as 
infinity, for example). They are worth keeping an eye on, because they 
have a much better and more open framework for being built vs. the 
Bakoma fonts which are essentially "closed-source" though free for 
redistribution. (i.e. it makes it a lot harder to fix problems in 
them). Given the time, I may look into what it would take to start 
adding these new symbols.
> I'll look into the case-sensitivity issue -- I'm not sure why that is 
> the case.
> 
This has now been fixed in SVN.
Mike
> Mike
>
> Tony S Yu wrote:
> 
>> On Apr 29, 2010, at 10:43 PM, Tony S Yu wrote:
>>
>> 
>>> On Apr 29, 2010, at 6:09 PM, Michael Droettboom wrote:
>>>
>>> 
>>>> Those Computer Modern fonts (specifically the Bakoma distribution of 
>>>> them that matplotlib includes) use a custom character set mapping 
>>>> where many of the characters are in completely arbitrary locations. 
>>>> For regular text, matplotlib expects a regular Unicode font 
>>>> (particularly to get the minus sign). Since cmr10 doesn't have a 
>>>> standard encoding, it just won't work. 
>>>> 
>>> Hey Mike,
>>>
>>> Thanks for your reply. That makes sense.
>>>
>>> An alternative work around (I presume) would be to install 
>>> the computer modern unicode fonts 
>>> <http://sourceforge.net/projects/cm-unicode/files/> (I made sure to 
>>> install the ttf version). However, I'm having trouble getting MPL to 
>>> find the fonts.
>>>
>>> The installed font is listed when calling 
>>> `mpl.font_manager.OSXInstalledFonts()`, but it's not found when 
>>> calling `mpl.font_manager.findfont` (with various names that would 
>>> make sense: cmunrm, CMU Serif, etc.)
>>>
>>> Any ideas on what I'm doing wrong?
>>> 
>> Sorry, I meant to reply to the list.
>>
>> After clearing the fontlist cache, I was able to get this fix working.
>>
>> Just to summarize:
>>
>> * download unicode version of computer modern fonts 
>> (http://sourceforge.net/projects/cm-unicode/files/)---make sure to get 
>> the ttf version
>>
>> * clear out the fontlist cache (rm ~/.matplotlib/fontList.cache)
>>
>> * add the following to ~/matplotlib/matplotlibrc:
>>
>> font.family: serif
>> font.serif: CMU Serif
>>
>> * alternatively, you could leave the default as sans serif and use the 
>> computer modern sans serif (unicode version):
>>
>> font.sans-serif: CMU Sans Serif
>>
>> These changes produce plots where the size of normal text matches that 
>> of mathtext.
>>
>> Thanks for you help, Mike!
>>
>> -Tony
>>
>> 
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Maxime B. <mb...@es...> - 2010年04月30日 14:38:57
Hi Jae-Joon
This method is also great and it's working with plt.subplot:
from pylab import *
subplot(221)
subplot(222)
subplot(223)
subplot(224)
plot([0.5, 0.5], [0, 1], color='lightgreen', 
lw=5,transform=gcf().transFigure, clip_on=False)
plot([0, 1], [0.5, 0.5], color='lightgreen', 
lw=5,transform=gcf().transFigure, clip_on=False)
Thank you very much
Regards,
Maxime
On 04/30/2010 04:02 PM, Jae-Joon Lee wrote:
> You may do this without creating an extra axes (ax0).
> Try something like
>
> ax4.plot([0.5, 0.5], [0, 1], color='lightgreen', lw=5,
> transform=gcf().transFigure, clip_on=False)
>
> Regards,
>
> -JJ
>
>
> On Fri, Apr 30, 2010 at 3:56 AM, Matthias Michler
> <Mat...@gm...> wrote:
> 
>> On Wednesday 28 April 2010 15:07:21 Maxime Bois wrote:
>> 
>>> Hi all,
>>>
>>> I have created a figure with 4 subplots (2x2) and I want to separate
>>> them with a vertical and horizontal lines (see the green lines on my
>>> figure edited by Gimp) but I don't know if it's possible (I haven't find
>>> any example of that).
>>>
>>> I am using Python 2.5.4 and matplotlib version 0.99.0
>>>
>>> Thanks,
>>> Maxime
>>> 
>> Hi Maxime,
>>
>> I hope my example works for you. Please note: I used plt.axes instead of
>> plt.subplot, although both generate an Axes instance, the latter doesn't
>> support overlapping axes.
>>
>> Kind regards,
>> Matthias
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
From: Jae-Joon L. <lee...@gm...> - 2010年04月30日 14:10:11
On Thu, Apr 29, 2010 at 12:40 PM, acoffeemug
<joa...@gm...> wrote:
> Does anyone know a good fix for this? Preferably one which doesn't involve
> manual resizing?
http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels
While example in the link try to make a room for ticklable, a same can
be done with a label.
If you don't mind your figure size slightly changed, you may try
savefig("yourfilename", bbox_inches="tight")
Regards,
-JJ
From: Jae-Joon L. <lee...@gm...> - 2010年04月30日 14:03:14
You may do this without creating an extra axes (ax0).
Try something like
ax4.plot([0.5, 0.5], [0, 1], color='lightgreen', lw=5,
 transform=gcf().transFigure, clip_on=False)
Regards,
-JJ
On Fri, Apr 30, 2010 at 3:56 AM, Matthias Michler
<Mat...@gm...> wrote:
> On Wednesday 28 April 2010 15:07:21 Maxime Bois wrote:
>> Hi all,
>>
>> I have created a figure with 4 subplots (2x2) and I want to separate
>> them with a vertical and horizontal lines (see the green lines on my
>> figure edited by Gimp) but I don't know if it's possible (I haven't find
>> any example of that).
>>
>> I am using Python 2.5.4 and matplotlib version 0.99.0
>>
>> Thanks,
>> Maxime
>
> Hi Maxime,
>
> I hope my example works for you. Please note: I used plt.axes instead of
> plt.subplot, although both generate an Axes instance, the latter doesn't
> support overlapping axes.
>
> Kind regards,
> Matthias
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Michael D. <md...@st...> - 2010年04月30日 13:07:27
I wasn't aware of these fonts -- we may want to consider distributing 
them with matplotlib instead (assuming the licensing makes sense) as it 
would greatly simplify the mathtext code. Of course, that's a project I 
may not have time for right now.
I'll look into the case-sensitivity issue -- I'm not sure why that is 
the case.
Mike
Tony S Yu wrote:
>
> On Apr 29, 2010, at 10:43 PM, Tony S Yu wrote:
>
>>
>> On Apr 29, 2010, at 6:09 PM, Michael Droettboom wrote:
>>
>>> Those Computer Modern fonts (specifically the Bakoma distribution of 
>>> them that matplotlib includes) use a custom character set mapping 
>>> where many of the characters are in completely arbitrary locations. 
>>> For regular text, matplotlib expects a regular Unicode font 
>>> (particularly to get the minus sign). Since cmr10 doesn't have a 
>>> standard encoding, it just won't work. 
>>
>> Hey Mike,
>>
>> Thanks for your reply. That makes sense.
>>
>> An alternative work around (I presume) would be to install 
>> the computer modern unicode fonts 
>> <http://sourceforge.net/projects/cm-unicode/files/> (I made sure to 
>> install the ttf version). However, I'm having trouble getting MPL to 
>> find the fonts.
>>
>> The installed font is listed when calling 
>> `mpl.font_manager.OSXInstalledFonts()`, but it's not found when 
>> calling `mpl.font_manager.findfont` (with various names that would 
>> make sense: cmunrm, CMU Serif, etc.)
>>
>> Any ideas on what I'm doing wrong?
>
> Sorry, I meant to reply to the list.
>
> After clearing the fontlist cache, I was able to get this fix working.
>
> Just to summarize:
>
> * download unicode version of computer modern fonts 
> (http://sourceforge.net/projects/cm-unicode/files/)---make sure to get 
> the ttf version
>
> * clear out the fontlist cache (rm ~/.matplotlib/fontList.cache)
>
> * add the following to ~/matplotlib/matplotlibrc:
>
> font.family: serif
> font.serif: CMU Serif
>
> * alternatively, you could leave the default as sans serif and use the 
> computer modern sans serif (unicode version):
>
> font.sans-serif: CMU Sans Serif
>
> These changes produce plots where the size of normal text matches that 
> of mathtext.
>
> Thanks for you help, Mike!
>
> -Tony
>
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Maxime B. <mb...@es...> - 2010年04月30日 09:42:38
Hi Matthias,
This is exactly what I wanted to do (excepted for the colors of the 
lines which are quite horrible :-) )
Thanks a lot
Cheers,
Maxime
On 04/30/2010 09:56 AM, Matthias Michler wrote:
> On Wednesday 28 April 2010 15:07:21 Maxime Bois wrote:
> 
>> Hi all,
>>
>> I have created a figure with 4 subplots (2x2) and I want to separate
>> them with a vertical and horizontal lines (see the green lines on my
>> figure edited by Gimp) but I don't know if it's possible (I haven't find
>> any example of that).
>>
>> I am using Python 2.5.4 and matplotlib version 0.99.0
>>
>> Thanks,
>> Maxime
>> 
> Hi Maxime,
>
> I hope my example works for you. Please note: I used plt.axes instead of
> plt.subplot, although both generate an Axes instance, the latter doesn't
> support overlapping axes.
>
> Kind regards,
> Matthias
> 
>
>
> ------------------------------------------------------------------------------
> 
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
T J wrote:
> On Wed, Apr 28, 2010 at 12:22 PM, Eric Firing <ef...@ha...> wrote:
>> It's a bug, made more confusing by the trickery that is done when printing a
>> figure. DPI, facecolor, and edgecolor that are set for a figure object are
>> used only for screen display, and are overridden when the figure is saved.
>> The overriding values can be supplied to the savefig call or via rcParams.
>>
>> I think I have fixed the bug in svn, so that "transparent" will work as
>> advertised. In addition, I made a change so that even with
>> transparent=True, if you supply facecolor and/or edgecolor to the savefig
>> call, those values should be used for the figure patch when the figure is
>> saved. This might be useful if you want to keep the line around the figure,
>> for example.
>>
> 
> This still does not work for me. I dug around a bit and found an
> issue. Figure.savefig() sets the 'edgecolor' and 'facecolor' of the
> axis patches but delegates the patches of the figure to the actual
> print command. It does this by setting the edgecolor and facecolor
> values in the kwargs dict. However, self.canvas.print_figure()
> expects edgecolor and facecolor as args, not kwargs. So
> print_figure() uses the default value: 'w' instead of 'none'. This is
> a bit inconsistent, it seems, especially b/c the PS backend (which is
> called after print_figure()) expects facecolor and edgecolor as
> kwargs.
I don't see this in the version as I changed it in svn r8282. Are you 
sure you installed and built from svn after I made the change? Using 
the attached script, I get the two attached (gzipped) eps files. The 
first with transparent=True, has no fill operations other than for 
generation of the glyphs; the second differs from the first in having 
two extra fill operations, one for the axes patch, the other for the 
figure patch.
When I use your transeps.tex, run latex, and then dvips, the resulting 
ps file (also gzipped and attached) has the figure with a red 
background, sitting on a white page. I presume this is what you expect, 
and so the figure and axes really are transparent.
Eric
> 
> I went ahead and changed this, hoping it'd fix the issue, but it does
> not. At least now, I can see that the edgecolor and facecolor are
> both set to 'none' all the way until self.figure.draw(renderer) is
> called. So somehow, the draw() command is unaffected by this still.
> 
> What next?
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: T J <tj...@gm...> - 2010年04月30日 08:03:38
On Wed, Apr 28, 2010 at 12:22 PM, Eric Firing <ef...@ha...> wrote:
>
> It's a bug, made more confusing by the trickery that is done when printing a
> figure. DPI, facecolor, and edgecolor that are set for a figure object are
> used only for screen display, and are overridden when the figure is saved.
> The overriding values can be supplied to the savefig call or via rcParams.
>
> I think I have fixed the bug in svn, so that "transparent" will work as
> advertised. In addition, I made a change so that even with
> transparent=True, if you supply facecolor and/or edgecolor to the savefig
> call, those values should be used for the figure patch when the figure is
> saved. This might be useful if you want to keep the line around the figure,
> for example.
>
This still does not work for me. I dug around a bit and found an
issue. Figure.savefig() sets the 'edgecolor' and 'facecolor' of the
axis patches but delegates the patches of the figure to the actual
print command. It does this by setting the edgecolor and facecolor
values in the kwargs dict. However, self.canvas.print_figure()
expects edgecolor and facecolor as args, not kwargs. So
print_figure() uses the default value: 'w' instead of 'none'. This is
a bit inconsistent, it seems, especially b/c the PS backend (which is
called after print_figure()) expects facecolor and edgecolor as
kwargs.
I went ahead and changed this, hoping it'd fix the issue, but it does
not. At least now, I can see that the edgecolor and facecolor are
both set to 'none' all the way until self.figure.draw(renderer) is
called. So somehow, the draw() command is unaffected by this still.
What next?
From: Tony S Yu <ts...@gm...> - 2010年04月30日 03:57:46
On Apr 29, 2010, at 11:51 PM, Tony S Yu wrote:
> 
> On Apr 29, 2010, at 10:43 PM, Tony S Yu wrote:
> 
>> 
>> On Apr 29, 2010, at 6:09 PM, Michael Droettboom wrote:
>> 
>>> Those Computer Modern fonts (specifically the Bakoma distribution of them that matplotlib includes) use a custom character set mapping where many of the characters are in completely arbitrary locations. For regular text, matplotlib expects a regular Unicode font (particularly to get the minus sign). Since cmr10 doesn't have a standard encoding, it just won't work. 
>> 
>> 
>> Hey Mike,
>> 
>> Thanks for your reply. That makes sense.
>> 
>> An alternative work around (I presume) would be to install the computer modern unicode fonts (I made sure to install the ttf version). However, I'm having trouble getting MPL to find the fonts.
>> 
>> The installed font is listed when calling `mpl.font_manager.OSXInstalledFonts()`, but it's not found when calling `mpl.font_manager.findfont` (with various names that would make sense: cmunrm, CMU Serif, etc.)
>> 
>> Any ideas on what I'm doing wrong?
> 
> Sorry, I meant to reply to the list.
> 
> After clearing the fontlist cache, I was able to get this fix working.
> 
> Just to summarize:
> 
> * download unicode version of computer modern fonts (http://sourceforge.net/projects/cm-unicode/files/)---make sure to get the ttf version
> 
> * clear out the fontlist cache (rm ~/.matplotlib/fontList.cache)
> 
> * add the following to ~/matplotlib/matplotlibrc:
> 
> font.family: serif
> font.serif: CMU Serif
> 
> * alternatively, you could leave the default as sans serif and use the computer modern sans serif (unicode version):
> 
> font.sans-serif: CMU Sans Serif
> 
> These changes produce plots where the size of normal text matches that of mathtext.
> 
> Thanks for you help, Mike!
> 
> -Tony
> 
Umm, ... last email on this topic, I promise.
Is there any reason the font family rc parameter is case sensitive, while the findfont input is case insensitive? In other words, replacing
> font.serif: CMU Serif
with
> font.serif: cmu serif
does not work. On the other hand, both of the following work:
>>> mpl.font_manager.findfont('cmu serif')
>>> mpl.font_manager.findfont('CMU Serif')
This caused me problems when debugging my earlier font troubles.
Best,
-Tony
From: Tony S Yu <ts...@gm...> - 2010年04月30日 03:51:13
On Apr 29, 2010, at 10:43 PM, Tony S Yu wrote:
> 
> On Apr 29, 2010, at 6:09 PM, Michael Droettboom wrote:
> 
>> Those Computer Modern fonts (specifically the Bakoma distribution of them that matplotlib includes) use a custom character set mapping where many of the characters are in completely arbitrary locations. For regular text, matplotlib expects a regular Unicode font (particularly to get the minus sign). Since cmr10 doesn't have a standard encoding, it just won't work. 
> 
> 
> Hey Mike,
> 
> Thanks for your reply. That makes sense.
> 
> An alternative work around (I presume) would be to install the computer modern unicode fonts (I made sure to install the ttf version). However, I'm having trouble getting MPL to find the fonts.
> 
> The installed font is listed when calling `mpl.font_manager.OSXInstalledFonts()`, but it's not found when calling `mpl.font_manager.findfont` (with various names that would make sense: cmunrm, CMU Serif, etc.)
> 
> Any ideas on what I'm doing wrong?
Sorry, I meant to reply to the list.
After clearing the fontlist cache, I was able to get this fix working.
Just to summarize:
* download unicode version of computer modern fonts (http://sourceforge.net/projects/cm-unicode/files/)---make sure to get the ttf version
* clear out the fontlist cache (rm ~/.matplotlib/fontList.cache)
* add the following to ~/matplotlib/matplotlibrc:
 font.family: serif
 font.serif: CMU Serif
* alternatively, you could leave the default as sans serif and use the computer modern sans serif (unicode version):
 font.sans-serif: CMU Sans Serif
These changes produce plots where the size of normal text matches that of mathtext.
Thanks for you help, Mike!
-Tony
From: <PH...@Ge...> - 2010年04月30日 00:27:39
> -----Original Message-----
> From: melons [mailto:xi...@cc...]
> Sent: Wednesday, April 28, 2010 5:14 AM
> To: mat...@li...
> Subject: [Matplotlib-users] How to set constant y-axis scale value
> 
> 
> Hello,
> 
> I am quite new in matplotlib, I am now facing a quite simple problem but
> have no idea to solve. I just want set the y axis scale to value 100,
> which
> means in the image, the y axis is always of scale 100, because the points
> in
> my image indicates the percentage value(for example, 20%, 87%) which will
> never exceed 100.
> 
> So, How to set the y axis scale to constant value 100 ?? It's really hard
> to
> find a answer from internet.
Give this a shot:
# ----
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(20)
y = np.random.randn(20)
y = y/y.max() * 100
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x,y,'ko', mfc='none')
# you can do this:
ax.set_ylim([0,100])
# or something like this:
ax.set_ylim(ymin=0, ymax=100)
plt.show()
3 messages has been excluded from this view by a project administrator.

Showing 16 results of 16

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