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




Showing 12 results of 12

From: John H. <jd...@gm...> - 2009年03月04日 17:46:09
On Wed, Mar 4, 2009 at 10:54 AM, per freem <per...@gm...> wrote:
> hi all,
>
> i managed to do linear regression on two vectors x, and y using
> linalg.lstsq. what i can't figure out is how to compute the R-squared value
> - the correlation of the two vectors - in matplotlib. can someone please
> point me to the right function? thank you.
You should use numpy rather than matplotlib. R-squared is the square of the
correlation coefficient, so
In [162]: c = np.corrcoef(x, y)[0,1]
In [163]: r2 = c**2
From: per f. <per...@gm...> - 2009年03月04日 16:54:44
hi all,
i managed to do linear regression on two vectors x, and y using
linalg.lstsq. what i can't figure out is how to compute the R-squared value
- the correlation of the two vectors - in matplotlib. can someone please
point me to the right function? thank you.
From: Jeffrey F. <mat...@je...> - 2009年03月04日 14:53:39
I've found that putting the text you want to be sans-serif inside \sf{}
works. So something like:
xlabel(r'$\sf{\Delta direction})
-Jeffrey
On Wed, Mar 4, 2009 at 1:59 AM, Jouni K. Seppänen <jk...@ik...> wrote:
> per freem <per...@gm...> writes:
>
> > i am using the tex feature to put some greek symbols in some labels of my
> > plots. for example,
> >
> > rcParams['text.usetex'] = True
> > plot(a, b, 'o')
> > xlabel('\Delta direction')
>
> Are you sure you need usetex? Matplotlib's own mathtext renderer is
> really quite good these days, and expressions like
>
> xlabel(r'$\Delta$ direction')
>
> should work just fine without usetex.
>
> > the '\Delta' is rendered correctly but that changes the fonts of the
> > tick labels and of all the text in the labels to tex's default font
> > (which looks like times new roman). is there a way to use tex only for
> > greek symbols but retain the default sans-serif font of matplotlib for
> > all the other things?
>
> No, usetex is an all-or-nothing choice. In principle it should be
> possible to change matplotlib to send only some strings (or string
> parts) to TeX, but I guess no-one has needed such a feature badly
> enough - the built-in mathtext renderer is good enough for most uses,
> and the remaining reason to use usetex is that you are including your
> figure in a LaTeX document and want the fonts to perfectly match the
> surrounding text, and in that case the current behavior is exactly
> right.
>
> The ordinary way to specify fonts works with the usetex engine, with the
> restriction that only some fonts are usable with LaTeX. The following
> dictionary (in texmanager.py) has the recognized fonts as keys and the
> corresponding LaTeX packages as (the second part of) the values:
>
> font_info = {'new century schoolbook': ('pnc',
>
> r'\renewcommand{\rmdefault}{pnc}'),
> 'bookman': ('pbk', r'\renewcommand{\rmdefault}{pbk}'),
> 'times': ('ptm', r'\usepackage{mathptmx}'),
> 'palatino': ('ppl', r'\usepackage{mathpazo}'),
> 'zapf chancery': ('pzc', r'\usepackage{chancery}'),
> 'cursive': ('pzc', r'\usepackage{chancery}'),
> 'charter': ('pch', r'\usepackage{charter}'),
> 'serif': ('cmr', ''),
> 'sans-serif': ('cmss', ''),
> 'helvetica': ('phv', r'\usepackage{helvet}'),
> 'avant garde': ('pag', r'\usepackage{avant}'),
> 'courier': ('pcr', r'\usepackage{courier}'),
> 'monospace': ('cmtt', ''),
> 'computer modern roman': ('cmr', ''),
> 'computer modern sans serif': ('cmss', ''),
> 'computer modern typewriter': ('cmtt', '')}
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a 600ドル discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Fernando P. <fpe...@gm...> - 2009年03月04日 13:51:21
Hi all,
sorry for the spam, but in case any of you are coming to the SIAM
Conference on Computational Science and Engineering (CSE09) in Miami:
http://www.siam.org/meetings/cse09/
you might be interested in stopping by the Python sessions on Thursday:
http://meetings.siam.org/sess/dsp_programsess.cfm?SESSIONCODE=8044
http://meetings.siam.org/sess/dsp_programsess.cfm?SESSIONCODE=8045
http://meetings.siam.org/sess/dsp_programsess.cfm?SESSIONCODE=8046
Think of it as the East Coast March mini-edition of Scipy'09 ;)
Cheers,
f
From: Jouni K. S. <jk...@ik...> - 2009年03月04日 07:00:16
per freem <per...@gm...> writes:
> i am using the tex feature to put some greek symbols in some labels of my
> plots. for example,
>
> rcParams['text.usetex'] = True
> plot(a, b, 'o')
> xlabel('\Delta direction')
Are you sure you need usetex? Matplotlib's own mathtext renderer is
really quite good these days, and expressions like
xlabel(r'$\Delta$ direction')
should work just fine without usetex.
> the '\Delta' is rendered correctly but that changes the fonts of the
> tick labels and of all the text in the labels to tex's default font
> (which looks like times new roman). is there a way to use tex only for
> greek symbols but retain the default sans-serif font of matplotlib for
> all the other things?
No, usetex is an all-or-nothing choice. In principle it should be
possible to change matplotlib to send only some strings (or string
parts) to TeX, but I guess no-one has needed such a feature badly
enough - the built-in mathtext renderer is good enough for most uses,
and the remaining reason to use usetex is that you are including your
figure in a LaTeX document and want the fonts to perfectly match the 
surrounding text, and in that case the current behavior is exactly
right.
The ordinary way to specify fonts works with the usetex engine, with the
restriction that only some fonts are usable with LaTeX. The following
dictionary (in texmanager.py) has the recognized fonts as keys and the
corresponding LaTeX packages as (the second part of) the values:
 font_info = {'new century schoolbook': ('pnc',
 r'\renewcommand{\rmdefault}{pnc}'),
 'bookman': ('pbk', r'\renewcommand{\rmdefault}{pbk}'),
 'times': ('ptm', r'\usepackage{mathptmx}'),
 'palatino': ('ppl', r'\usepackage{mathpazo}'),
 'zapf chancery': ('pzc', r'\usepackage{chancery}'),
 'cursive': ('pzc', r'\usepackage{chancery}'),
 'charter': ('pch', r'\usepackage{charter}'),
 'serif': ('cmr', ''),
 'sans-serif': ('cmss', ''),
 'helvetica': ('phv', r'\usepackage{helvet}'),
 'avant garde': ('pag', r'\usepackage{avant}'),
 'courier': ('pcr', r'\usepackage{courier}'),
 'monospace': ('cmtt', ''),
 'computer modern roman': ('cmr', ''),
 'computer modern sans serif': ('cmss', ''),
 'computer modern typewriter': ('cmtt', '')}
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Jouni K. S. <jk...@ik...> - 2009年03月04日 06:46:28
Daniel Soto <dan...@gm...> writes:
> as far as the pdf.compression not working, i was using rcParams in the
> script so i'm almost certain the options were being loaded.
A quick way to check if your pdf.compression setting is being picked up
is to grep the pdf file for /FlateDecode. If pdf.compression is set to 0,
the string should not occur (except of course if you use it in a figure
title or other text), if it is set to any other value, the string should
occur.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Eric F. <ef...@ha...> - 2009年03月04日 02:35:16
lionel keene wrote:
> Hello all, I'd like to create a "matplotlib.pyplot.figure(...)" object
> and specify the size while I'm at it. I see this argument list from
> the matplotlib's documentation:
> 
> pyplot.figure(num=None, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k')
> 
> The on-screen size is being computed using inches (for height and
> width) and dpi. But I don't know what the dpi is in advance. What can
> I do? In case it's relevant, I'm using Python 2.5 and the latest
> download of matplotlib.
> 
> Thanks in advance.
> 
> -L
I'm not quite sure I understand; if you don't know the dpi when you 
create the figure, when *will* you know it?
Lack of knowledge of the actual dpi of a display is a general problem, 
and I don't know of any general solution. Typically one has to guess, 
or let the user measure it and input it as a variable at the start of a 
graphics program. Ideally, every display would communicate its dpi to 
the operating system, and graphics software would be able to read and 
use this value. I don't know if any systems actually work this way.
Eric
From: Daniel S. <dan...@gm...> - 2009年03月04日 01:00:24
>
this seems to be because the default backend was set to something 
without a gui.
i set backend to WXAgg and it works now.
> --------------------------
>
> Message: 7
> Date: Tue, 3 Mar 2009 16:44:41 -0800
> From: Daniel Soto <dan...@gm...>
> Subject: [Matplotlib-users] error with ginput
> To: mat...@li...
> Message-ID: <339...@gm...>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
> hello,
>
> ginput isn't working for me right now but was when i was using 0.98.3.
> running the script below gives me the following traceback.
> anyone know what is going on?
>
> thx,
> drs
>
>> python -c "import matplotlib;print matplotlib.__version__"
> 0.98.5.2
>
>> ./gaelInput.py
> Please click
> Traceback (most recent call last):
> File "./gaelInput.py", line 7, in <module>
> x = ginput(3)
> File "/Library/Frameworks/Python.framework/Versions/4.1.30101/lib/
> python2.5/site-packages/matplotlib/pyplot.py", line 358, in ginput
> return gcf().ginput(*args, **kwargs)
> File "/Library/Frameworks/Python.framework/Versions/4.1.30101/lib/
> python2.5/site-packages/matplotlib/figure.py", line 1073, in ginput
> show_clicks=show_clicks)
> File "/Library/Frameworks/Python.framework/Versions/4.1.30101/lib/
> python2.5/site-packages/matplotlib/blocking_input.py", line 258, in
> __call__
> BlockingInput.__call__(self,n=n,timeout=timeout)
> File "/Library/Frameworks/Python.framework/Versions/4.1.30101/lib/
> python2.5/site-packages/matplotlib/blocking_input.py", line 96, in
> __call__
> self.fig.show()
> AttributeError: 'Figure' object has no attribute 'show'
>
> # gaelInput.py
> from pylab import arange, plot, sin, ginput, show
> t = arange(10)
> plot(t, sin(t))
> print "Please click"
> x = ginput(3)
> print "clicked",x
> show()
>
>
From: per f. <per...@gm...> - 2009年03月04日 00:56:09
hi all,
i have the following plot:
rcParams['xtick.direction'] = 'out'
rcParams['ytick.direction'] = 'out'
scatter(x, y)
this changes the tick directions to be out. how can i make it so only the
ticks on the x axis and y axis appear? i.e. remove the ticks that are in the
top axis (the one parallel to the x-axis) and in the right most axis (the
one parallel to the y-axis)?
thanks.
From: per f. <per...@gm...> - 2009年03月04日 00:54:37
hi all,
i am using the tex feature to put some greek symbols in some labels of my
plots. for example,
rcParams['text.usetex'] = True
plot(a, b, 'o')
xlabel('\Delta direction')
the '\Delta' is rendered correctly but that changes the fonts of the tick
labels and of all the text in the labels to tex's default font (which looks
like times new roman). is there a way to use tex only for greek symbols but
retain the default sans-serif font of matplotlib for all the other things?
i want all the tick labels and text to be in the default font. for example,
in xlabel('\Delta direction'), it should have the sans-serif font in
"direction" but use tex for the \Delta.
is there a way to do this?
thank you.
From: Daniel S. <dan...@gm...> - 2009年03月04日 00:44:52
hello,
ginput isn't working for me right now but was when i was using 0.98.3.
running the script below gives me the following traceback.
anyone know what is going on?
thx,
drs
 > python -c "import matplotlib;print matplotlib.__version__"
0.98.5.2
 > ./gaelInput.py
Please click
Traceback (most recent call last):
 File "./gaelInput.py", line 7, in <module>
 x = ginput(3)
 File "/Library/Frameworks/Python.framework/Versions/4.1.30101/lib/ 
python2.5/site-packages/matplotlib/pyplot.py", line 358, in ginput
 return gcf().ginput(*args, **kwargs)
 File "/Library/Frameworks/Python.framework/Versions/4.1.30101/lib/ 
python2.5/site-packages/matplotlib/figure.py", line 1073, in ginput
 show_clicks=show_clicks)
 File "/Library/Frameworks/Python.framework/Versions/4.1.30101/lib/ 
python2.5/site-packages/matplotlib/blocking_input.py", line 258, in 
__call__
 BlockingInput.__call__(self,n=n,timeout=timeout)
 File "/Library/Frameworks/Python.framework/Versions/4.1.30101/lib/ 
python2.5/site-packages/matplotlib/blocking_input.py", line 96, in 
__call__
 self.fig.show()
AttributeError: 'Figure' object has no attribute 'show'
# gaelInput.py
from pylab import arange, plot, sin, ginput, show
t = arange(10)
plot(t, sin(t))
print "Please click"
x = ginput(3)
print "clicked",x
show()
From: Daniel S. <dan...@gm...> - 2009年03月04日 00:21:19
ok. i managed to install 0.98.5.x from source into my enthought 
python distribution.
after that, using path.simplify helped considerably.
as far as the pdf.compression not working, i was using rcParams in the 
script so i'm
almost certain the options were being loaded.
thanks mike,
drs
On 3 Mar 2009, at 08:11, Michael Droettboom wrote:
> path.simplify was added some time after 0.98.3. You'll have to 
> upgrade to 0.98.5.x for that feature.
>
> pdf.compression should have some impact on file size, but I doubt it 
> will have much impact on display times, since it doesn't actually 
> remove any data. I'm surprised this isn't having any effect -- 
> perhaps the matplotlibrc file you're editing is not the one being 
> loaded? You can see where the file is being loaded from with:
>
> import matplotlib
> matplotlib.get_configdir()
>
> agg.path.chunksize has no effect on PDF output.
>
> Is it possible you're using the Cairo backend, and not matplotlib's 
> own Python-based PDF backend?
>
> As a cheap workaround, you can also easily decimate your data using 
> Numpy with something like:
>
> data = data[::skip]
>
> where 'skip' is the number of data points to skip.
>
> Cheers,
> Mike
>
> Daniel Soto wrote:
>> thanks for the suggestion. i'm running 0.98.3 and have tried
>>
>> pdf.compression
>> path.simplify
>> agg.path.chunksize
>>
>> without any change in filesize (176KB) or time to open file (13 sec).
>>
>> are there any other options or backends that might help?
>>
>> drs
>>
>> On 3 Mar 2009, at 05:29, Michael Droettboom wrote:
>>
>>> With recent versions of matplotlib, you can set the 
>>> "path.simplify" rcParam to True, which should reduce the data so 
>>> that vertices that have no impact on the plot appearance (at the 
>>> given dpi) are removed.
>>>
>>> You can do either, in your script:
>>>
>>> from matplotlib import rcParam
>>> rcParam['path.simplify'] = True
>>>
>>> or in your matplotlibrc file:
>>>
>>> path.simplify: True
>>>
>>> Hope that helps. The amount of reduction this produces is 
>>> somewhat data-dependent.
>>>
>>> Cheers,
>>> Mike
>>>
>>> Daniel Soto wrote:
>>>> hello,
>>>>
>>>> i'm using matplotlib on os x and am having issues with plots of 
>>>> large data sets. i have some plots which contain about ~10000 
>>>> points and the pdf files generated bring preview.app and 
>>>> quicklook to their knees when they open the pdf files.
>>>>
>>>> here is a small file that reproduces my issues. at 1000 points 
>>>> it is snappy and at 10000 it is a pig.
>>>>
>>>> is there a setting to downsample or otherwise compress?
>>>>
>>>> best,
>>>> drs
>>>>
>>>>
>>>>
>>>> import matplotlib.pyplot
>>>> import scipy
>>>>
>>>> x = scipy.rand(10000)
>>>> matplotlib.pyplot.plot(x)
>>>> matplotlib.pyplot.savefig('rand.pdf')
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Open Source Business Conference (OSBC), March 24-25, 2009, San 
>>>> Francisco, CA
>>>> -OSBC tackles the biggest issue in open source: Open Sourcing the 
>>>> Enterprise
>>>> -Strategies to boost innovation and cut costs with open source 
>>>> participation
>>>> -Receive a 600ドル discount off the registration fee with the source 
>>>> code: SFAD
>>>> http://p.sf.net/sfu/XcvMzF8H
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Mat...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>
>>>
>>> -- 
>>> Michael Droettboom
>>> Science Software Branch
>>> Operations and Engineering Division
>>> Space Telescope Science Institute
>>> Operated by AURA for NASA
>>>
>>
>
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
1 message has been excluded from this view by a project administrator.

Showing 12 results of 12

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