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

Showing results of 27

1 2 > >> (Page 1 of 2)
From: jamesf0 <ja...@ut...> - 2009年01月29日 23:56:43
Yeah "trying" to plot sun paths.
I'll be more than happy to share once it's complete.
James.
Timmie wrote:
> 
> Hello,
> 
>>>> I am trying to create a plot that resembles the layout of the chart
>>>> seen
>>>> below:
>>>>
>>>> http://www.nabble.com/file/p21721073/brisbane.png 
> are you actually trying to plot sun path digrams?
> 
> May you share a part of your code once it is completed?
> 
> I'd be very interested in seeing a working example.
> 
> Kind regards,
> Timme
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/How-to-plot-straight-lines-on-polar-plots-tp21721073p21738933.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Tim M. <tim...@gm...> - 2009年01月29日 23:34:10
Hello,
>>> I am trying to create a plot that resembles the layout of the chart seen
>>> below:
>>>
>>> http://www.nabble.com/file/p21721073/brisbane.png 
are you actually trying to plot sun path digrams?
May you share a part of your code once it is completed?
I'd be very interested in seeing a working example.
Kind regards,
Timme
From: jamesf0 <ja...@ut...> - 2009年01月29日 22:59:43
Thanks for the help, but I can't quite see where to add the add_axes code.
Here is the code I have been using to plot, the polar plot is a subplot.
fig=figure()
ax=fig.add_subplot(111, polar=True)
ax.set_xticklabels(["E",45,"N",315,"W",225,"S",135])
ax.set_yticklabels([80,70,60,50,40,30,20,10])
...
ax.plot(az, alt, 'b')
fig.savefig('AzvAlt.png')
show()
Michael Droettboom-3 wrote:
> 
> I'm embarrassed to see that I neglected to document this, but you can 
> pass a "resolution" keyword argument to add_axes which sets the number 
> of points of interpolation between each pair of data points. Set this 
> to 1 to disable interpolation.
> 
> This will be documented shortly.
> 
> Mike
> 
> jamesf0 wrote:
>> Hi,
>>
>> Im having some trouble with this "seemingly" simple task of plotting
>> straight lines/fitted curves on a polar plot.
>>
>> I am trying to create a plot that resembles the layout of the chart seen
>> below:
>>
>> http://www.nabble.com/file/p21721073/brisbane.png 
>>
>>
>>
>> So far I have only been able to plot data like so:
>>
>> http://www.nabble.com/file/p21721073/AzvAlt.png 
>>
>>
>> The blue line should be similar to the bottom line of the first example
>> plot. The line would ultimately be formed by fitting a straight
>> line/curve
>> through the points, instead of the way matplotlib is plotting.
>>
>> I am plotting tuples of values (az and alt), and plotting using:
>>
>>
>> ax.plot(az, alt, 'b')
>> 
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/How-to-plot-straight-lines-on-polar-plots-tp21721073p21737964.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Michael D. <md...@st...> - 2009年01月29日 22:48:05
I'm embarrassed to see that I neglected to document this, but you can 
pass a "resolution" keyword argument to add_axes which sets the number 
of points of interpolation between each pair of data points. Set this 
to 1 to disable interpolation.
This will be documented shortly.
Mike
jamesf0 wrote:
> Hi,
>
> Im having some trouble with this "seemingly" simple task of plotting
> straight lines/fitted curves on a polar plot.
>
> I am trying to create a plot that resembles the layout of the chart seen
> below:
>
> http://www.nabble.com/file/p21721073/brisbane.png 
>
>
>
> So far I have only been able to plot data like so:
>
> http://www.nabble.com/file/p21721073/AzvAlt.png 
>
>
> The blue line should be similar to the bottom line of the first example
> plot. The line would ultimately be formed by fitting a straight line/curve
> through the points, instead of the way matplotlib is plotting.
>
> I am plotting tuples of values (az and alt), and plotting using:
>
>
> ax.plot(az, alt, 'b')
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: <pro...@cl...> - 2009年01月29日 20:05:54
>> Thanks, your example works but what I must do so to plot for example 
y=cos x
>> ? I'm a very beginner.
>
> line, = ax.plot(x, np.cos(x))
> patch = patches.Circle((300,300), radius=100)
> line.set_clip_path(patch)
>
>Everything in the matplotlib figure is an "Artist" (lines, images,
>text, rectangles) and you can set the clippath of any artist. See
>
> http://matplotlib.sourceforge.net/users/artists.html
> http://matplotlib.sourceforge.net/api/artist_api.html
>
>JDH
Thanks a lot ! I'll look more precisely the concept of artist later.
Best regards.
Christophe.
From: Jeff W. <js...@fa...> - 2009年01月29日 19:59:48
Christopher Barker wrote:
> Jeff Whitaker wrote:
>> Chris: Here's a self-contained example of the problem (data file 
>> attached):
>
> yup -- I get the same problem. Interesting, I thought it might be an 
> issue with the 'U' flag creating a difference in byte offset, but 
> that's a unix style file already, so it should make no difference 
> anyway -- weird.
>
> Actually, what's probably happening is that the flags are getting 
> passed in to how python is opening the gzip file itself, in which 
> case, yes, 'U' would, or course, break things.
>
> In the MPL code, is the flag passed on through to either file() or 
> gzip.open() that same way? What I'm getting at is whether it's easy to 
> use 'U' with raw text files and not with gzipped files.
>
> In my grepping of the code (SVN head), I only see gzip.open being 
> called "raw", either with no flags or 'wb', except in mlab.cbook, and 
> I see you (or someone!) already patched that. However, I might suggest:
>
> flag = flag.replace('U','')
>
> instead of:
>
> if flag == 'rU': flag = 'r'
Chris: That's a good idea. Done (r6852).
-Jeff
>
> it case someone passes a U in some other way (not that I know of any 
> other valid way...)
>
>
> Now I wonder if I can find the energy to submit a bug report to Python...
>
> -Chris
>
>
>
>
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Christopher B. <Chr...@no...> - 2009年01月29日 19:59:15
getting carried away here...
I took a look at the Python SVN (2.5.4 and 2.6.1) for the gzip lib. I 
see this:
 # guarantee the file is opened in binary mode on platforms
 # that care about that sort of thing
 if mode and 'b' not in mode:
 mode += 'b'
 if fileobj is None:
 fileobj = self.myfileobj = __builtin__.open(filename, mode 
or 'rb')
this is going to break for 'U' == you'll get 'rUb' -- who knowes what 
that means?
now to figure out how to file a ticket...
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: John H. <jd...@gm...> - 2009年01月29日 19:50:53
On Thu, Jan 29, 2009 at 1:40 PM, <pro...@cl...> wrote:
> Thanks, your example works but what I must do so to plot for example y=cos x
> ? I'm a very beginner.
 line, = ax.plot(x, np.cos(x))
 patch = patches.Circle((300,300), radius=100)
 line.set_clip_path(patch)
Everything in the matplotlib figure is an "Artist" (lines, images,
text, rectangles) and you can set the clippath of any artist. See
 http://matplotlib.sourceforge.net/users/artists.html
 http://matplotlib.sourceforge.net/api/artist_api.html
JDH
From: Christopher B. <Chr...@no...> - 2009年01月29日 19:48:55
Jeff Whitaker wrote:
> Chris: Here's a self-contained example of the problem (data file 
> attached):
yup -- I get the same problem. Interesting, I thought it might be an 
issue with the 'U' flag creating a difference in byte offset, but that's 
a unix style file already, so it should make no difference anyway -- weird.
Actually, what's probably happening is that the flags are getting passed 
in to how python is opening the gzip file itself, in which case, yes, 
'U' would, or course, break things.
In the MPL code, is the flag passed on through to either file() or 
gzip.open() that same way? What I'm getting at is whether it's easy to 
use 'U' with raw text files and not with gzipped files.
In my grepping of the code (SVN head), I only see gzip.open being called 
"raw", either with no flags or 'wb', except in mlab.cbook, and I see you 
(or someone!) already patched that. However, I might suggest:
flag = flag.replace('U','')
instead of:
if flag == 'rU': flag = 'r'
it case someone passes a U in some other way (not that I know of any 
other valid way...)
Now I wonder if I can find the energy to submit a bug report to Python...
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: <pro...@cl...> - 2009年01月29日 19:40:51
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<title>Flashmail</title>
<style type="text/css">
BODY, TABLE, TR, TD, P {margin:0;padding:0;}
BODY {background:#FFFFFF;}
</style>
</head>
<body>
<P>Thanks, your example works but what I must do so to plot for example y=cos x ? I'm a very beginner.</P>
<P>&nbsp;</P>
<P>Christophe.</P>
<P><BR>----Message d'origine---- <BR>&gt;Date: 2009年1月29日 09:34:11 -0600 <BR>&gt;Sujet: Re: [Matplotlib-users] Plot only inside a disc <BR>&gt;De: John Hunter <BR>&gt;A: pro...@cl... <BR>&gt;Copie à: mat...@li... <BR>&gt; <BR>&gt;On Thu, Jan 29, 2009 at 9:19 AM, <PRO...@CL...>wrote: <BR>&gt;&gt; Hello, <BR>&gt;&gt; I would like to make a kind of magnifying glass. So I need to have a piece of <BR>&gt;&gt; a graph and I would like it to have the form
of a disc rather than of a box. <BR>&gt;&gt; So is-it possible to only draw in a disc (I'm searching for a fast way to do <BR>&gt;&gt; that) ? <BR>&gt; <BR>&gt;You can turn off the rendering of the normal axes and axis, and clip <BR>&gt;your data to an arbitrary patch or path; eg <BR>&gt; <BR>&gt; <BR>&gt; """ <BR>&gt; Clipping to arbitrary patches and paths <BR>&gt; """ <BR>&gt; import numpy as np <BR>&gt; import matplotlib.pyplot as plt <BR>&gt; import matplotlib.path as path <BR>&gt; import matplotlib.
patches as patches <BR>&gt; <BR>&gt; <BR>&gt; fig = plt.figure() <BR>&gt; ax = fig.add_subplot(111, frameon=False, xticks=[], yticks=[]) <BR>&gt; <BR>&gt; im = ax.imshow(np.random.rand(10,10)) <BR>&gt; <BR>&gt; patch = patches.Circle((300,300), radius=100) <BR>&gt; im.set_clip_path(patch) <BR>&gt; <BR>&gt; plt.show() <BR>&gt; </P></body></html>
From: Jeff W. <js...@fa...> - 2009年01月29日 19:01:54
Attachments: etopo20lats.gz
Christopher Barker wrote:
> Jeff Whitaker wrote:
>
>> John: 'rU' apparently doesn't work for gzipped text files (at least 
>> in python 2.5.2). I had to change the default in back to 'r' when 
>> using gzip.open (r6846 in trunk).
>
> darn -- sounds like a bug/missing feature in the gzip module. Strange 
> , though, unknown flags seem to be ignored by file(), and gzip.open 
> seems to ignore the 'U' too, in my tests (see below).
>
> I think having the 'U' ignored is less than optimal, but doesn't make 
> anything worse than it is. What problems did you have?
Chris: Here's a self-contained example of the problem (data file attached):
 >> import gzip
 >> f = gzip.open('etopo20lats.gz','rU')
 >> print f.readline()
Traceback (most recent call last):
 File "testread.py", line 3, in <module>
 print f.readline()
 File "/sw/lib/python2.5/gzip.py", line 399, in readline
 c = self.read(readsize)
 File "/sw/lib/python2.5/gzip.py", line 227, in read
 self._read(readsize)
 File "/sw/lib/python2.5/gzip.py", line 279, in _read
 uncompress = self.decompress.decompress(buf)
zlib.error: Error -3 while decompressing: invalid distance too far back
 >> import gzip
 >> f = gzip.open('etopo20lats.gz','r')
 >> print f.readline()
'-8.983333330000000672e+01'
-Jeff
>
> tests (on an OS-X system - native unix newlines):
> (python 2.5.2)
>
> >>> file('test_newlines.txt', 'rb').read()
> 'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
> >>> file('test_newlines.txt', 'r').read()
> 'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
> >>> file('test_newlines.txt', 'U').read()
> 'line 1: unix \nline 2: dos \nline 3: mac \nline 4: unix \n'
>
> # so file() does the right thing
>
> >>> gzip.open('test_newlines.txt.gz', 'rb').read()
> 'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
> >>> gzip.open('test_newlines.txt.gz', 'r').read()
> 'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
> >>> gzip.open('test_newlines.txt.gz', 'rU').read()
> 'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
>
>
> # gzip.open() appears to ignore the 'U' flag -- too bad!
>
> should we post a bug report/feature request to Python?
>
> -Chris
>
>
>
>
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Jeff W. <js...@fa...> - 2009年01月29日 18:38:46
Christopher Barker wrote:
> Jeff Whitaker wrote:
>
>> John: 'rU' apparently doesn't work for gzipped text files (at least 
>> in python 2.5.2). I had to change the default in back to 'r' when 
>> using gzip.open (r6846 in trunk).
>
> darn -- sounds like a bug/missing feature in the gzip module. Strange 
> , though, unknown flags seem to be ignored by file(), and gzip.open 
> seems to ignore the 'U' too, in my tests (see below).
>
> I think having the 'U' ignored is less than optimal, but doesn't make 
> anything worse than it is. What problems did you have?
Chris: If you have basemap, try running the simpletest.py example with 
matplotlib svn r6845. When the filehandle is obtained using 'rU', it's 
reading garbage from the gzipped file. Using 'r', it's fine.
-Jeff
>
> tests (on an OS-X system - native unix newlines):
> (python 2.5.2)
>
> >>> file('test_newlines.txt', 'rb').read()
> 'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
> >>> file('test_newlines.txt', 'r').read()
> 'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
> >>> file('test_newlines.txt', 'U').read()
> 'line 1: unix \nline 2: dos \nline 3: mac \nline 4: unix \n'
>
> # so file() does the right thing
>
> >>> gzip.open('test_newlines.txt.gz', 'rb').read()
> 'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
> >>> gzip.open('test_newlines.txt.gz', 'r').read()
> 'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
> >>> gzip.open('test_newlines.txt.gz', 'rU').read()
> 'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
>
>
> # gzip.open() appears to ignore the 'U' flag -- too bad!
>
> should we post a bug report/feature request to Python?
>
> -Chris
>
>
>
>
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Jae-Joon L. <lee...@gm...> - 2009年01月29日 18:36:48
I don't see any elegant way to do that.
The easiest way I can think of is to use a derived line2d class.
Something like below will work. Others may have better ideas.
import matplotlib.lines
class Line2DNoInterpolation(matplotlib.lines.Line2D):
 def recache(self):
 matplotlib.lines.Line2D.recache(self)
 self._transformed_path.get_transformed_path_and_affine = \
 self._transformed_path.get_transformed_points_and_affine
ax = subplot(111, projection="polar")
r = np.arange(0, 1.0, 0.1)
theta = 2*np.pi*r
p2 = Line2DNoInterpolation(theta, r, color='r', lw=1)
ax.add_line(p2)
-JJ
On Thu, Jan 29, 2009 at 12:20 AM, jamesf0 <ja...@ut...> wrote:
>
> Hi,
>
> Im having some trouble with this "seemingly" simple task of plotting
> straight lines/fitted curves on a polar plot.
>
> I am trying to create a plot that resembles the layout of the chart seen
> below:
>
> http://www.nabble.com/file/p21721073/brisbane.png
>
>
>
> So far I have only been able to plot data like so:
>
> http://www.nabble.com/file/p21721073/AzvAlt.png
>
>
> The blue line should be similar to the bottom line of the first example
> plot. The line would ultimately be formed by fitting a straight line/curve
> through the points, instead of the way matplotlib is plotting.
>
> I am plotting tuples of values (az and alt), and plotting using:
>
>
> ax.plot(az, alt, 'b')
> --
> View this message in context: http://www.nabble.com/How-to-plot-straight-lines-on-polar-plots-tp21721073p21721073.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Christopher B. <Chr...@no...> - 2009年01月29日 18:21:15
Christopher Barker wrote:
> here are my test files -- just to save you a minute if you want to try 
> it yourself.
oops -- the email process "fixed" the mixed newlines in 
test_newlines.txt! At least with my client.
It's probably work if you unpack the gz though.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Christopher B. <Chr...@no...> - 2009年01月29日 18:09:54
here are my test files -- just to save you a minute if you want to try 
it yourself.
-CHB
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Christopher B. <Chr...@no...> - 2009年01月29日 18:02:50
C Lewis wrote:
> So one argument is that there's 
> no good reason to risk breaking old defaults,
As far as I can see, this won't break any code, though -- Universal 
newlines won't change anything with native newlines anyway.
except maybe with the gzip module...
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Christopher B. <Chr...@no...> - 2009年01月29日 18:00:54
Jeff Whitaker wrote:
> John: 'rU' apparently doesn't work for gzipped text files (at least in 
> python 2.5.2). I had to change the default in back to 'r' when using 
> gzip.open (r6846 in trunk).
darn -- sounds like a bug/missing feature in the gzip module. Strange , 
though, unknown flags seem to be ignored by file(), and gzip.open seems 
to ignore the 'U' too, in my tests (see below).
I think having the 'U' ignored is less than optimal, but doesn't make 
anything worse than it is. What problems did you have?
tests (on an OS-X system - native unix newlines):
(python 2.5.2)
 >>> file('test_newlines.txt', 'rb').read()
'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
 >>> file('test_newlines.txt', 'r').read()
'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
 >>> file('test_newlines.txt', 'U').read()
'line 1: unix \nline 2: dos \nline 3: mac \nline 4: unix \n'
# so file() does the right thing
 >>> gzip.open('test_newlines.txt.gz', 'rb').read()
'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
 >>> gzip.open('test_newlines.txt.gz', 'r').read()
'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
 >>> gzip.open('test_newlines.txt.gz', 'rU').read()
'line 1: unix \nline 2: dos \r\nline 3: mac \rline 4: unix \n'
# gzip.open() appears to ignore the 'U' flag -- too bad!
should we post a bug report/feature request to Python?
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: C L. <ch...@na...> - 2009年01月29日 16:47:50
To put in an argument each way -- I now recognize that the PEP one 
gets when looking up "universal newline python" has the necessary 
info. I saw but did not recognize over the weekend. So one argument is 
that there's no good reason to risk breaking old defaults, mostly 
users will be able to solve it themselves.
...*but*, on the other hand:
 I've checked that more than one Office 2008 install writes files 
csv2rec can't open without the 'U' flag,
 and I'm trying to persuade various colleagues that they can move 
from Excel calculations to Python gradually,
 and they aren't going to expect line-ending problems.
So I guess I see a backwards compatibility problem balanced against a 
forward evangelizing problem.
&C
On Jan 29, 2009, at 8:18 AM, Jeff Whitaker wrote:
> John Hunter wrote:
>> On Wed, Jan 28, 2009 at 2:11 PM, Christopher Barker
>> <Chr...@no...> wrote:
>>
>>
>>> But why the heck not? and according to the OP, Excel does create 
>>> such files.
>>>
>>> Personally, I try to ALWAYS use 'U' when opening text files -- it 
>>> can
>>> save headaches, and I see no downside. It really should be the 
>>> default
>>> -- it's not, because the default was always text, but that was the 
>>> same
>>> as binary on *nix -- so there is a lot of *nix code out there 
>>> opening
>>> binary files without the 'b' flag. So we couldn't change the default
>>> back in 2002, it would have broken a LOT of code.
>>>
>>
>> Fair enough -- changed on the trunk in r6845
>>
From: Jeff W. <js...@fa...> - 2009年01月29日 16:18:38
John Hunter wrote:
> On Wed, Jan 28, 2009 at 2:11 PM, Christopher Barker
> <Chr...@no...> wrote:
>
> 
>> But why the heck not? and according to the OP, Excel does create such files.
>>
>> Personally, I try to ALWAYS use 'U' when opening text files -- it can
>> save headaches, and I see no downside. It really should be the default
>> -- it's not, because the default was always text, but that was the same
>> as binary on *nix -- so there is a lot of *nix code out there opening
>> binary files without the 'b' flag. So we couldn't change the default
>> back in 2002, it would have broken a LOT of code.
>> 
>
> Fair enough -- changed on the trunk in r6845
>
> JDH
>
> 
John: 'rU' apparently doesn't work for gzipped text files (at least in 
python 2.5.2). I had to change the default in back to 'r' when using 
gzip.open (r6846 in trunk).
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: John H. <jd...@gm...> - 2009年01月29日 15:34:15
On Thu, Jan 29, 2009 at 9:19 AM, <pro...@cl...> wrote:
> Hello,
> I would like to make a kind of magnifying glass. So I need to have a piece of
> a graph and I would like it to have the form of a disc rather than of a box.
> So is-it possible to only draw in a disc (I'm searching for a fast way to do
> that) ?
You can turn off the rendering of the normal axes and axis, and clip
your data to an arbitrary patch or path; eg
 """
 Clipping to arbitrary patches and paths
 """
 import numpy as np
 import matplotlib.pyplot as plt
 import matplotlib.path as path
 import matplotlib.patches as patches
 fig = plt.figure()
 ax = fig.add_subplot(111, frameon=False, xticks=[], yticks=[])
 im = ax.imshow(np.random.rand(10,10))
 patch = patches.Circle((300,300), radius=100)
 im.set_clip_path(patch)
 plt.show()
From: <pro...@cl...> - 2009年01月29日 15:19:37
Hello,
I would like to make a kind of magnifying glass. So I need to have a piece of 
a graph and I would like it to have the form of a disc rather than of a box.
So is-it possible to only draw in a disc (I'm searching for a fast way to do 
that) ?
Best regards.
Christophe.
From: John H. <jd...@gm...> - 2009年01月29日 12:07:10
On Thu, Jan 29, 2009 at 3:43 AM, Oliver Marks
<Oli...@ho...> wrote:
> are there any tutorials / examples / documentation on the use of the
> cairo backend i am currently using gtk and want to work with cairo for
> printing.
>
> I have looked around and not found much information on this backend.
In general, you don't need to know much about a backed to use it, just
switch to that backend by either doing
 import matplotlib
 matplotlib.use('Cairo')
at the top of your script (before importing pylab/pyplot) or making it
permanent in your rc file. See
 http://matplotlib.sourceforge.net/users/customizing.html
 http://matplotlib.sourceforge.net/faq/installing_faq.html#id1
You can also use cairo rendering in a gtk window by selecting the
GTKCairo backend.
JDH
From: dikshie <di...@gm...> - 2009年01月29日 11:26:47
On Wed, Jan 28, 2009 at 9:29 PM, Jeff Whitaker <js...@fa...> wrote:
> dikshie wrote:
>>
>> hi,
>> does matplotlib support tgif?
>>
>>
>> with best regards,
>>
>
> I had to google tgif to find out that it is the file format output by the
> tgif drawing program (http://bourbon.usc.edu:8001/tgif/current.html). It is
> not an image format, and matplotlib cannot read or write it.
yes, that's what i mean. tgif :)
thanks!
-dikshie-
From: Oliver M. <Oli...@ho...> - 2009年01月29日 09:59:25
are there any tutorials / examples / documentation on the use of the
cairo backend i am currently using gtk and want to work with cairo for
printing.
I have looked around and not found much information on this backend.
From: <pro...@cl...> - 2009年01月29日 08:57:08
hello,
I would like to know if there is a way to draw something like x**3+y**2<=3.
If there is not a direct way to do that, I would like to know if it could be 
possible to subclass the method that plots the contours.
Best regards.
Christophe.

Showing results of 27

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