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


Showing results of 290

<< < 1 2 3 4 5 .. 12 > >> (Page 3 of 12)
From: elmar <el...@ne...> - 2011年03月26日 20:50:19
Am 14.03.2011 03:49, schrieb John F. Gibson:
>
> I would like to construct a 3d plot consisting of several 2d quiver plots on
> orthogonal, intersecting planes. Is this possible with matplotlib? In matlab
> I do it by construct several 2d graph and then reorienting them in the 3d
> space using the 'rotate' function. E.g.
>
> xaxis = [1 0 0];
> h = quiver('v6', z, y, w, v, 'k');
> rotate(h, xaxis, 90, [0 0 0]);
>
> This produces a 2d quiver plot of [v,w](y,z) oriented along the y,z axes of
> the 3d space, and then I do the same for x,y and x,z quiver plots.
>
> Any ideas for matplotib 3d? Thanks!
>
> John Gibson
have a look at "Volumetric Slice Plot" in the tutorial of Easyviz 
(http://code.google.com/p/scitools/)
Elmar
Blast from the past!
I just ran into this and it comes from the fact that
'matplotlib.tests.test_text' is not in the default_test_modules
variable inside matplotlib's __init__.py
Here's the necessary diff:
index 82633a5..649e4d8 100644
--- a/lib/matplotlib/__init__.py
+++ b/lib/matplotlib/__init__.py
@@ -968,7 +968,8 @@ default_test_modules =3D [
 'matplotlib.tests.test_spines',
 'matplotlib.tests.test_image',
 'matplotlib.tests.test_simplification',
- 'matplotlib.tests.test_mathtext'
+ 'matplotlib.tests.test_mathtext',
+ 'matplotlib.tests.test_text'
 ]
I added a pull request for this two line change just in case
there was a specific reason to *exclude* test_text from the test
modules?=20
For instance, right now, I get one failure in the test suite if I
include it. The failure is in test_text:test_font_styles, but
this has been the case for a while, it's just that these tests
weren't running before.
Any developers want to chime in on this?
best,
--
Paul Ivanov
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
Michael Droettboom, on 2010年07月27日 11:19, wrote:
> Hmm... surprisingly, I am actually able to reproduce this sort of=20
> behaviour here. I'll look into it further.
>=20
> Mike
>=20
> On 07/27/2010 09:49 AM, Michael Droettboom wrote:
> > Of course, we'll prefer to see all of the tests pass...
> >
> > I'm surprised the two modes of running the tests gives different
> > results. Are you sure they are running the same python? Does
> >
> > python `which nosetests` matplotlib.tests
> >
> > give you the same result as
> >
> > nosetests matplotlib.tests
> >
> > ?
> >
> > There must be some environmental difference between the two to cause the
> > different results.
> >
> > Mike
> >
> > On 07/24/2010 05:09 PM, Adam wrote:
> > =20
> >> Hello, I have just updated to v1.0.0 and am trying to run the test
> >> suite to make sure everything is ok. There seems to be two different
> >> suites and I am not sure which is correct/current:
> >>
> >> $python -c 'import matplotlib; matplotlib.test()'
> >> [...snipped output...]
> >> Ran 138 tests in 390.991s
> >> OK (KNOWNFAIL=3D2)
> >>
> >> $nosetests matplotlib.tests I get:
> >> [...snipped output]
> >> Ran 144 tests in 380.165s
> >> FAILED (errors=3D4, failures=3D1)
> >>
> >> Two of these errors are the known failures from above, and the other
> >> two are in "matplotlib.tests.test_text.test_font_styles":
> >> ImageComparisonFailure: images not close:
> >> /home/adam/result_images/test_text/font_styles.png vs.
> >> /home/adam/result_images/test_text/expected-font_styles.png (RMS
> >> 23.833)
> >> ImageComparisonFailure: images not close:
> >> /home/adam/result_images/test_text/font_styles_svg.png vs.
> >> /home/adam/result_images/test_text/expected-font_styles_svg.png (RMS
> >> 12.961)
> >>
> >> The module that fails is:
> >>
> >> FAIL: matplotlib.tests.test_mlab.test_recarray_csv_roundtrip
> >> ----------------------------------------------------------------------
> >> Traceback (most recent call last):
> >> File "/usr/local/lib/python2.6/dist-packages/nose-0.11.4-py2.6.egg/=
nose/case.py",
> >> line 186, in runTest
> >> self.test(*self.arg)
> >> File "/usr/local/lib/python2.6/dist-packages/matplotlib/tests/test_=
mlab.py",
> >> line 24, in test_recarray_csv_roundtrip
> >> assert np.allclose( expected['x'], actual['x'] )
> >> AssertionError
> >>
> >>
> >>
> >> I am not sure of the importance level of these - but I wanted to ask
> >> to see if I should do anything or if they can safely be ignored.
> >>
> >> Thanks,
> >> Adam.
Blast from the past!
I just ran into this and it comes from the fact that
'matplotlib.tests.test_text' is not in the default_test_modules
variable inside matplotlib's __init__.py
Here's the necessary diff:
index 82633a5..649e4d8 100644
--- a/lib/matplotlib/__init__.py
+++ b/lib/matplotlib/__init__.py
@@ -968,7 +968,8 @@ default_test_modules = [
 'matplotlib.tests.test_spines',
 'matplotlib.tests.test_image',
 'matplotlib.tests.test_simplification',
- 'matplotlib.tests.test_mathtext'
+ 'matplotlib.tests.test_mathtext',
+ 'matplotlib.tests.test_text'
 ]
I added a pull request for this two line change just in case
there was a specific reason to *exclude* test_text from the test
modules? 
For instance, right now, I get one failure in the test suite if I
include it. The failure is in test_text:test_font_styles, but
this has been the case for a while, it's just that these tests
weren't running before.
Any developers want to chime in on this?
best,
-- 
Paul Ivanov
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
Michael Droettboom, on 2010年07月27日 11:19, wrote:
> Hmm... surprisingly, I am actually able to reproduce this sort of 
> behaviour here. I'll look into it further.
> 
> Mike
> 
> On 07/27/2010 09:49 AM, Michael Droettboom wrote:
> > Of course, we'll prefer to see all of the tests pass...
> >
> > I'm surprised the two modes of running the tests gives different
> > results. Are you sure they are running the same python? Does
> >
> > python `which nosetests` matplotlib.tests
> >
> > give you the same result as
> >
> > nosetests matplotlib.tests
> >
> > ?
> >
> > There must be some environmental difference between the two to cause the
> > different results.
> >
> > Mike
> >
> > On 07/24/2010 05:09 PM, Adam wrote:
> > 
> >> Hello, I have just updated to v1.0.0 and am trying to run the test
> >> suite to make sure everything is ok. There seems to be two different
> >> suites and I am not sure which is correct/current:
> >>
> >> $python -c 'import matplotlib; matplotlib.test()'
> >> [...snipped output...]
> >> Ran 138 tests in 390.991s
> >> OK (KNOWNFAIL=2)
> >>
> >> $nosetests matplotlib.tests I get:
> >> [...snipped output]
> >> Ran 144 tests in 380.165s
> >> FAILED (errors=4, failures=1)
> >>
> >> Two of these errors are the known failures from above, and the other
> >> two are in "matplotlib.tests.test_text.test_font_styles":
> >> ImageComparisonFailure: images not close:
> >> /home/adam/result_images/test_text/font_styles.png vs.
> >> /home/adam/result_images/test_text/expected-font_styles.png (RMS
> >> 23.833)
> >> ImageComparisonFailure: images not close:
> >> /home/adam/result_images/test_text/font_styles_svg.png vs.
> >> /home/adam/result_images/test_text/expected-font_styles_svg.png (RMS
> >> 12.961)
> >>
> >> The module that fails is:
> >>
> >> FAIL: matplotlib.tests.test_mlab.test_recarray_csv_roundtrip
> >> ----------------------------------------------------------------------
> >> Traceback (most recent call last):
> >> File "/usr/local/lib/python2.6/dist-packages/nose-0.11.4-py2.6.egg/nose/case.py",
> >> line 186, in runTest
> >> self.test(*self.arg)
> >> File "/usr/local/lib/python2.6/dist-packages/matplotlib/tests/test_mlab.py",
> >> line 24, in test_recarray_csv_roundtrip
> >> assert np.allclose( expected['x'], actual['x'] )
> >> AssertionError
> >>
> >>
> >>
> >> I am not sure of the importance level of these - but I wanted to ask
> >> to see if I should do anything or if they can safely be ignored.
> >>
> >> Thanks,
> >> Adam.
From: Virgil S. <vs...@it...> - 2011年03月25日 23:46:05
I have used the following code (taken from a matplotlib example) to 
produce a 3D plot of planar polygons,
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.collections import PolyCollection
from matplotlib.colors import colorConverter
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(40040157) # Used to allow repeatable experiments (plots)
fig = plt.figure()
ax = fig.gca(projection='3d')
cc = [colorConverter.to_rgba(c,alpha=0.6) for c in 
('r','g','b','c','y','m','k')]
ncc = len(cc)
nxs = 5
xs = np.arange(1, nxs+1, 1) # (X's)
# Add boundary X's
xs = np.insert(xs,0,1);
xs = np.append(xs,nxs)
# Create array for Z's
ys = np.zeros(len(xs))
# Create list for all Y's
npolys = 9
zs = [zs+1 for zs in range(npolys)] # Y coordinates (list of integers)
# Create list of colors (cyclic) for all polygons
colorlist = [cc[j%ncc] for j in range(npolys)]
verts = []
# Generate vertices for polygons
for j in zs: # loop on polys
 ys = np.random.rand(len(ys))
 ys[0], ys[-1] = 0,0 # end points for filled polygons 
(1,0),(n,0)
 verts.append(zip(xs, ys))
poly = PolyCollection(verts, facecolors = colorlist)
poly.set_alpha(0.7)
ax.add_collection3d(poly, zs=zs, zdir='y')
# Right-handed coordinate system
ax.set_xlabel('X') # points to right (X)
ax.set_xlim3d(0, nxs+1)
ax.set_ylabel('Y') # points into screen (Y)
ax.set_ylim3d(0, npolys+1)
ax.set_zlabel('Z') # points up (Z)
ax.set_zlim3d(0, 1)
plt.show()
and this works fine. I then tried to produce a 3D plot of the same form 
as this one,*but with only the top of the polygons plotted* (4 connected 
line
segments for each of the 9 polygons). I thought this would be easily 
accomplished, by replacing PolyCollection with LineCollection. However, 
I have been unable to produce a 3D plot for line segments connecting the 
tops of the polygons.
Note, I am using Python 2.6.6, numpy 1.5.1, and matplotlib 1.0.1.
Any help on producing 3D line segment plot would be appreciated.
From: Lebostein <Leb...@gm...> - 2011年03月25日 21:30:52
Hi,
if I create an eps from a matplotlib chart with
matplot.rc('font', size=fsize, family='serif', serif='Computer Modern
Roman')
matplot.rc('text', usetex = True)
matplot.rc('text.latex', unicode = True)
then I can't mark the letters in eps viewer. And I can't search for letters
and words in the eps. It seems, the letters are curves in the eps. Why? If I
create a pdf, I can mark letters and words an I can search too.
How I can create an eps output with embedded font and "real" letters?
-- 
View this message in context: http://old.nabble.com/usetex-%3D-True-%2B-eps-output--%3E-letters-are-only-curves-tp31242096p31242096.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: ai1836 <len...@li...> - 2011年03月25日 20:54:26
Hello there
I am trying to put together matplotlib-1.0.1-win32-py2.6,
numpy-1.5.1-win32-superpack-python2.6 and
scipy-0.9.0rc1-win32-superpack-python2.6 for py2.6.6.
When I run my file through eclipse I get this error:
Traceback (most recent call last):
 File "C:\Documents and Settings\Colby
Student\Desktop\fungi\src\display.py", line 8, in <module>
 import pylab as pl
 File "C:\Python26\lib\site-packages\pylab.py", line 1, in <module>
 from matplotlib.pylab import *
 File "C:\Python26\lib\site-packages\matplotlib\pylab.py", line 220, in
<module>
 from matplotlib import mpl # pulls in most modules
 File "C:\Python26\lib\site-packages\matplotlib\mpl.py", line 1, in
<module>
 from matplotlib import artist
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 6, in
<module>
 from transforms import Bbox, IdentityTransform, TransformedBbox,
TransformedPath
 File "C:\Python26\lib\site-packages\matplotlib\transforms.py", line 34, in
<module>
 from matplotlib._path import affine_transform
ImportError: DLL load failed: The system cannot find the file specified.
How can I deal with it?
Please, help :-(
-- 
View this message in context: http://old.nabble.com/import-error-of-affine_transform-from-matplotlib._path-tp31241831p31241831.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: unit <e_r...@ya...> - 2011年03月25日 20:20:55
Dear All,
I can't figure out how to make the grid and axes lines more apparent in 3D
plot created by Axes3D. Similar problem was posted a while ago
(http://old.nabble.com/How-to-make-3-D-axes-grid-more-visible--td28917367.html#a28917367)
but there was no resolution. 
I know how to turn the grid on/off. But is there any way to set the
width/color of the grid lines? Because when I save the plot with default
gray lines, they are almost invisible.
Thanks a lot for advice!
-- 
View this message in context: http://old.nabble.com/How-to-control-grid-properties-in-3D--tp31206307p31206307.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Paul I. <piv...@gm...> - 2011年03月25日 19:01:41
Georges Arsouze, on 2011年03月16日 09:48, wrote:
> Hello
> I'am working with Python3.1 under Mac Os Snow Leopard
> I download matplotlib with
> http://www.cgl.ucsf.edu/Outreach/pc204/matplotlib.html
> 
> It doesn't work
> Can you help me ?
Hi Georges,
What version of matplotlib are you trying to run? At the moment,
there isn't a "stable" release which is compatible with Python 3,
and you have to grab it from:
https://github.com/matplotlib/matplotlib-py3
Not all of the backends work in -py3, mostly because the underlying toolkits
have not been ported to Python 3. You can notes about the work in
progress, what's been completed, and what's left to do here:
https://github.com/matplotlib/matplotlib-py3/wiki
(Also, this is more of a matplotlib-users question, so I'm replying
to that list)
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Andre' Walker-L. <wal...@gm...> - 2011年03月25日 16:14:02
Hi Chris,
I think I understand what you are asking. I think the key point is I have used "np.histogram" where you are using "np.hist"
When I make my plots, I use np.hist, but then to access the data, I use np.histogram.
Just to demonstrate, incase this is not what you want, I have found, if I create a bin
> bin = np.histogram(binData,range=(ymin,ymax),weights=binQ,bins=np.arange(ymin,ymax,dm0/4)) 
where 
> ind = np.argsort(my_data) # list to order the data from low to high
> binDat = my_data[ind]
> binQ = weights[ind] / np.sum(weights)		#ordered list of weight factors for the data (for a weighted distribution. example, if you have data with uncertainties, the weights are given by the inverse uncertainties)
and ymin, ymax and dm0 are params I have specified (based on the data) to set the bin size and range of bins
The pdf, in this case, is given by pdf[i] = binQ[i].
I can then access this with
> bin[0][i] #this is the i'th weight (the pdf at i)
also, the data (the x values) can be accessed by
> bin[1][i]
At the very least, this gives a poor-working man's solution. I couldn't figure out how to get it from np.hist.
Andre
On Mar 24, 2011, at 8:47 PM, Chris Edwards wrote:
> Hi,
> 
> I would like to access values in the bins of a matplotlib histogram. The following example script is an attempt to do this. Clearly pdf contains floating point numbers, but I am unable to access them.
> 
> Help with this problem would be much appreciated.
> 
> Chris
> 
> --------------------------------------------------------------------------------------------------------------
> import numpy as np
> import matplotlib.pyplot as plt
> fig = plt.figure()
> ax = fig.add_subplot(111)
> 
> mu, sigma = 100, 15
> x = mu + sigma * np.random.randn(20)
> 
> #Generate the histogram of the data. Example from Matplotlib documentation
> 
> n, bins, patches = plt.hist(x, 50, normed=True, facecolor='g', alpha=0.75)
> plt.xlabel('Smarts')
> plt.ylabel('Probability')
> plt.title('Histogram of IQ')
> plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
> plt.axis([40, 160, 0, 0.03])
> plt.grid(True)
> 
> #From Matplotlib documentation.
> #normed: If True, the first element of the return tuple will be the counts normalized
> #to form a probability density, i.e., n/(len(x)*dbin). In a probability density,
> #the integral of the histogram should be 1; you can verify that with a trapezoidal
> #integration of the probability density function.
> 
> pdf, bins, patches = ax.hist(x, 50, normed=True, facecolor='g', alpha=0.75)
> 
> #print pdf shows pdf contains the value in each bin of the normed histogram
> 
> print "pdf = ", pdf
> 
> print " Integration of PDF = ", np.sum(pdf * np.diff(bins))
> 
> #How to access values in pdf? Various tries made but none successful. Example attempt shown
> 
> count=0
> for line in open(pdf,'r+'):
> x=pdf.readline()
> z=('%.10f' % float(x))
> count=count+1
> print "count = ", count
> 
> ----------------------------------------------------------------------------------------------------
> ------------------------------------------------------------------------------
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software 
> be a part of the solution? Download the Intel(R) Manageability Checker 
> today! http://p.sf.net/sfu/intel-dev2devmar
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Giovanni L. C. <jun...@gm...> - 2011年03月25日 16:01:59
Ah, sorry for the duplicate message!
Cheers,
G
On 15/03/2011 11:30, Giovanni Luca Ciampaglia wrote:
> Hi all,
> I call savefig by passing to it a file-like object but it appears to not
> get the graphics format right:
>
> f = open('not_a_pdf.pdf', 'w')
> plot([1,2,3])
> savefig(f)
>
> but it produces a PNG image. Can anybody confirm this? I am on
> matplotlib 0.99.3
>
> Cheers,
From: Jim F. <jfo...@gm...> - 2011年03月25日 15:25:36
Well, what do you know? For once, the call of the noob, "Hey! there must 
be a bug" speaks truth.
Thanks, Angus! I added a little code to duplicate the last point until 
the array length is at least 5, and everything looks just fine.
On 03/25/2011 01:10 PM, Angus McMorland wrote:
> On 25 March 2011 07:31, jford14685<jfo...@gm...> wrote:
>> I am a newbie Python programmer trying to make 3d barplots like
>> http://matplotlib.sourceforge.net/examples/mplot3d/bars3d_demo.html this
>> one on the Matplotlib site.
>>
>> When I run the demo source (python bars3d_demo.py) it works fine. I then
>> changed the way xs and ys are assigned, to
>> xs = np.array([1.,2.,3.]) # was xs = np.arange(20)
>> ys = np.array([1.,2.,3.]) # was ys = np.random.rand(20)
>> ax.bar(xs, ys, zs=1, zdir='y', color='r', alpha=0.8)
>> (ditto for two other data sets)
>>
>> Now the bars are triangles. The right side of each bar is of the correct
>> height, but the left side of each bar starts at zero.
> Here's another data point. My guess is this is a bug with Axes3D: I
> can recreate the problem with 3 bars, but with>4 bars everything
> works okay. On my setup, with exactly 4 bars, the leftmost edge of the
> bars doesn't get a border, so something possibly related is going on
> there too.
>
> Angus.
From: Fabrice S. <si...@lm...> - 2011年03月25日 15:21:13
Le mardi 15 mars 2011 à 11:30 +0100, Giovanni Luca Ciampaglia a écrit :
> Hi all,
> I call savefig by passing to it a file-like object but it appears to not 
> get the graphics format right:
> 
> f = open('not_a_pdf.pdf', 'w')
> plot([1,2,3])
> savefig(f)
> 
> but it produces a PNG image. Can anybody confirm this? I am on 
> matplotlib 0.99.3
> 
> Cheers,
You may give savefig a filename (string 'tmp.pdf') instead of the file
descriptor (file object f), or use the format keyword argument.
Automatic format selection is not handled for file object (as visible in
backend_bases.py:FigureCanvasBase.print_figure method).
-- 
Fabrice 
From: Mike K. <mc...@gm...> - 2011年03月25日 12:13:39
What the best way to to use data coordinates rather than axes 
coordinates for xmin and xmax with axhline?
Here's my kludgy solution, but it's not elegant:
plot(arange(20))
ax = gca()
inv = ax.transAxes.inverted()
x = inv.transform(ax.transData.transform([10,0]))
ax.axhline(10, xmax=x[0])
I tried doing this:
ax.axhline(15, xmax=15, transform=ax.transData)
but I get:
ValueError: 'transform' is not allowed as a kwarg;axhline generates its 
own transform.
which is a bit strange since transform is listed in the kwargs in the 
help, though there is also this:
 Valid kwargs are :class:`~matplotlib.lines.Line2D` properties,
 with the exception of 'transform':
which could have two meanings: one is that all the kwargs listed are 
Line2D properties except 'transform' which is a valid kwarg, but not a 
Line2D property, OR even though 'transform' is listed, it's not a valid 
kwarg. Somewhat confusing especially given the ValueError...
M
From: Angus M. <am...@gm...> - 2011年03月25日 12:11:14
On 25 March 2011 07:31, jford14685 <jfo...@gm...> wrote:
> I am a newbie Python programmer trying to make 3d barplots like
> http://matplotlib.sourceforge.net/examples/mplot3d/bars3d_demo.html this
> one on the Matplotlib site.
>
> When I run the demo source (python bars3d_demo.py) it works fine. I then
> changed the way xs and ys are assigned, to
> xs = np.array([1.,2.,3.])   # was xs = np.arange(20)
> ys = np.array([1.,2.,3.])   # was ys = np.random.rand(20)
> ax.bar(xs, ys, zs=1, zdir='y', color='r', alpha=0.8)
> (ditto for two other data sets)
>
> Now the bars are triangles. The right side of each bar is of the correct
> height, but the left side of each bar starts at zero.
Here's another data point. My guess is this is a bug with Axes3D: I
can recreate the problem with 3 bars, but with >4 bars everything
works okay. On my setup, with exactly 4 bars, the leftmost edge of the
bars doesn't get a border, so something possibly related is going on
there too.
Angus.
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
From: Angus M. <am...@gm...> - 2011年03月25日 11:53:12
Thanks Paul,
On 24 March 2011 19:23, Paul Ivanov <piv...@gm...> wrote:
> I think you can get the desired functionality with gridspec
> alone. Take a look at
> doc/users/plotting/examples/demo_gridspec06.py which you can find
> here
>
> https://github.com/matplotlib/matplotlib/blob/f1c8/doc/users/plotting/examples/demo_gridspec06.py
I've played around with this example, and it seems like I'm not quite
there yet. I should add that I'm using imshow rather than plot here.
In this case, the inter-inner-grid spacing becomes dependent on the
figure aspect ratio. I presume this is because it is trying to
maintain (as it should) the aspect ratio of the images, but it would
be nice for it do this my manipulating only the outside margins, and
honour the wspace=0., hspace=0. as requested.
Here's a simplified version of the above script to illustrate my point:
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import numpy as np
from itertools import product
f = plt.figure(figsize=(9, 9))
# gridspec inside gridspec
outer_grid = gridspec.GridSpec(2, 3, wspace=0.0, hspace=0.0)
for i in xrange(6):
 inner_grid = gridspec.GridSpecFromSubplotSpec(3, 3,
 subplot_spec=outer_grid[i], wspace=0.0, hspace=0.0)
 for j, (c, d) in enumerate(product(range(1, 4), repeat=2)):
 ax = plt.Subplot(f, inner_grid[j])
 ax.imshow(np.ones((10,10)) * c * d, vmin=1, vmax=9)
 ax.set_xticks([])
 ax.set_yticks([])
 f.add_subplot(ax)
all_axes = f.get_axes()
#show only the outside spines
for ax in all_axes:
 for sp in ax.spines.values():
 sp.set_visible(False)
 if ax.is_first_row():
 ax.spines['top'].set_visible(True)
 if ax.is_last_row():
 ax.spines['bottom'].set_visible(True)
 if ax.is_first_col():
 ax.spines['left'].set_visible(True)
 if ax.is_last_col():
 ax.spines['right'].set_visible(True)
plt.show()
Of course, it is relatively trivial to calculate the correct figure
aspect ratio in this case, but after adding in other elements like
labels, this can become problematic. Is it possible to specify exactly
the inner spacing, and make the outer margins automatically adjusted
to get everything to fit nicely?
Thanks,
Angus
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
From: jford14685 <jfo...@gm...> - 2011年03月25日 11:31:59
I am a newbie Python programmer trying to make 3d barplots like 
http://matplotlib.sourceforge.net/examples/mplot3d/bars3d_demo.html this 
one on the Matplotlib site.
When I run the demo source (python bars3d_demo.py) it works fine. I then
changed the way xs and ys are assigned, to
 xs = np.array([1.,2.,3.]) # was xs = np.arange(20) 
 ys = np.array([1.,2.,3.]) # was ys = np.random.rand(20)
 ax.bar(xs, ys, zs=1, zdir='y', color='r', alpha=0.8)
 (ditto for two other data sets)
Now the bars are triangles. The right side of each bar is of the correct
height, but the left side of each bar starts at zero.
Python version 2.6.5
Matplotlib version 1.0.1
Ubuntu 10.04
Thanks in advance!
Complete source of my (misbehaving) program:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
xs = np.array([1.,2.,3.])
ys = np.array([1.,2.,3.])
ax.bar(xs, ys, zs=1, zdir='y', color='r', alpha=0.8)
ys = np.array([1.,4.,9.])
ax.bar(xs, ys, zs=2, zdir='y', color='r', alpha=0.8)
ys = np.array([2.,1.,2.])
ax.bar(xs, ys, zs=3, zdir='y', color='r', alpha=0.8)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
plt.show()
-- 
View this message in context: http://old.nabble.com/ramp-shaped-bars--tp31236873p31236873.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Chris E. <cb...@oz...> - 2011年03月25日 03:48:08
Hi,
I would like to access values in the bins of a matplotlib histogram. The following example script is an attempt to do this. Clearly pdf contains floating point numbers, but I am unable to access them.
Help with this problem would be much appreciated.
Chris
--------------------------------------------------------------------------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
mu, sigma = 100, 15
x = mu + sigma * np.random.randn(20)
#Generate the histogram of the data. Example from Matplotlib documentation
n, bins, patches = plt.hist(x, 50, normed=True, facecolor='g', alpha=0.75)
plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title('Histogram of IQ')
plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
plt.axis([40, 160, 0, 0.03])
plt.grid(True)
#From Matplotlib documentation.
#normed: If True, the first element of the return tuple will be the counts normalized
#to form a probability density, i.e., n/(len(x)*dbin). In a probability density,
#the integral of the histogram should be 1; you can verify that with a trapezoidal
#integration of the probability density function.
pdf, bins, patches = ax.hist(x, 50, normed=True, facecolor='g', alpha=0.75)
#print pdf shows pdf contains the value in each bin of the normed histogram
print "pdf = ", pdf
print " Integration of PDF = ", np.sum(pdf * np.diff(bins))
#How to access values in pdf? Various tries made but none successful. Example attempt shown
count=0
for line in open(pdf,'r+'):
 x=pdf.readline()
 z=('%.10f' % float(x))
 count=count+1
 print "count = ", count
----------------------------------------------------------------------------------------------------
From: Andre' Walker-L. <wal...@gm...> - 2011年03月24日 23:55:03
Hi Michael,
In both cases, I was first hoping someone else has experienced this problem, to know I am not alone in the universe.
But since you asked, I am using the macosx backend - but find the same problem also with WXAgg and TkAgg.
When you mention included examples, I do not find any in my 
/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/matplotlib/mpl-data/example/
folder. Do you mean ones I find on the web at the matplotlib site?
Thanks,
Andre
On Mar 24, 2011, at 4:31 PM, Michael Droettboom wrote:
> On 03/24/2011 09:35 AM, Andre' Walker-Loud wrote:
>> Hi All,
>> 
>> I am having two slight irritating issues making figures with matplotlib (and have not found a solution with Google)
>> 
>> I am running the Enthought 6.2 distribution (python 2.6, matplotlib 0.99.3, ipython 0.10, ...) which is installed as a Framework on a Mac OSX 10.6 platform. 
>> 
>> I currently am using (matplotlibrc file)
>> 
>> backend : macosx (I find the same issues with WXAgg and TkAgg as well)
>> ...
>> text.usetex : true #use latex for all text handling
>> 
>> 
>> Both problems began with my Enthought distribution (but for reasons I will spare you, I don't want to switch to a different installation if possible, except upgrade Enthought).
>> 
>> 
>> Problem 1:
>> With all my old installations, which existed on previous Mac OSX version (10.5), I did not need to set
>> 
>> text.usetex : true #use latex for all text handling
>> 
>> My text rendering worked fine. But with the Enthought version, for some reason, I got fatal errors. So I switched to having latex render all text. This wasn't a big deal, and it has been a while, so I don't have the error logs anymore. Just wondering if anyone else experienced this, and understands why?
> Without seeing the content of the error, it's very hard to say why it might be failing. Can you set text.usetex back to False and send us the error output?
>> 
>> 
>> Problem 2: (I believe unrelated to 1)
>> 
>> I use the annotate command to add text to my figures, displaying analysis results.
>> 
>> Frequently, when I save the figure as a PDF, these annotated texts do not appear in the saved PDF. I find that if I fiddle with the matplotlib gui figure-window, adjusting the size on my screen, then I can eventually get the saved PDF to contain this text. But this gets very annoying quickly, as almost never is the default size the one needed to properly capture the text in the saved figure, and it requires lots of fine-tuning with trial and error.
>> 
>> If I instead save as PNG, I almost never have this problem (maybe never).
>> 
>> 
>> Infrequently, the text doesn't even display in the gui window, until I fiddle with the size of the window.
>> 
>> In both cases, NO errors are produced. My script which does the analysis and produces the figures uses
>> 
>> from pylab import *
>> 
>> but otherwise no "*" imports.
>> 
>> 
>> My old Fink installation doesn't have this problem - but it was moved from my old Mac OSX 10.5 system, and there are some issues with the upgrade to Mac OSX 10.6, which lead me to need to just re-install everything fresh on the 10.6 OS.
>> 
>> 
>> I am not sure if this problem is specific to Enthought's distribution (the latex tex rendering problem made me suspect this) or is just some bizarre Mac problem or ???
>> 
>> 
>> So, does anyone out there have the same or similar problem? And better yet, understand why and how to fix?
> Which backend are you using? Can you provide a standalone plot that produces the error? Do any of the included examples (particularly those related to annotate) fail for you?
> 
> Mike
> ________________________________________
> From: Andre' Walker-Loud [wal...@gm...]
> Sent: Thursday, March 24, 2011 12:35 PM
> To: Matplotlib Users
> Subject: [Matplotlib-users] matplotlib figures missing text
> 
> Hi All,
> 
> I am having two slight irritating issues making figures with matplotlib (and have not found a solution with Google)
> 
> I am running the Enthought 6.2 distribution (python 2.6, matplotlib 0.99.3, ipython 0.10, ...) which is installed as a Framework on a Mac OSX 10.6 platform.
> 
> I currently am using (matplotlibrc file)
> 
> backend : macosx (I find the same issues with WXAgg and TkAgg as well)
> ...
> text.usetex : true #use latex for all text handling
> 
> 
> Both problems began with my Enthought distribution (but for reasons I will spare you, I don't want to switch to a different installation if possible, except upgrade Enthought).
> 
> 
> Problem 1:
> With all my old installations, which existed on previous Mac OSX version (10.5), I did not need to set
> 
> text.usetex : true #use latex for all text handling
> 
> My text rendering worked fine. But with the Enthought version, for some reason, I got fatal errors. So I switched to having latex render all text. This wasn't a big deal, and it has been a while, so I don't have the error logs anymore. Just wondering if anyone else experienced this, and understands why?
> 
> 
> Problem 2: (I believe unrelated to 1)
> 
> I use the annotate command to add text to my figures, displaying analysis results.
> 
> Frequently, when I save the figure as a PDF, these annotated texts do not appear in the saved PDF. I find that if I fiddle with the matplotlib gui figure-window, adjusting the size on my screen, then I can eventually get the saved PDF to contain this text. But this gets very annoying quickly, as almost never is the default size the one needed to properly capture the text in the saved figure, and it requires lots of fine-tuning with trial and error.
> 
> If I instead save as PNG, I almost never have this problem (maybe never).
> 
> 
> Infrequently, the text doesn't even display in the gui window, until I fiddle with the size of the window.
> 
> In both cases, NO errors are produced. My script which does the analysis and produces the figures uses
> 
> from pylab import *
> 
> but otherwise no "*" imports.
> 
> 
> My old Fink installation doesn't have this problem - but it was moved from my old Mac OSX 10.5 system, and there are some issues with the upgrade to Mac OSX 10.6, which lead me to need to just re-install everything fresh on the 10.6 OS.
> 
> 
> I am not sure if this problem is specific to Enthought's distribution (the latex tex rendering problem made me suspect this) or is just some bizarre Mac problem or ???
> 
> 
> So, does anyone out there have the same or similar problem? And better yet, understand why and how to fix?
> 
> 
> Thanks,
> 
> Andre
> 
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software
> be a part of the solution? Download the Intel(R) Manageability Checker
> today! http://p.sf.net/sfu/intel-dev2devmar
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Michael D. <md...@st...> - 2011年03月24日 23:31:36
On 03/24/2011 09:35 AM, Andre' Walker-Loud wrote:
> Hi All,
>
> I am having two slight irritating issues making figures with matplotlib (and have not found a solution with Google)
>
> I am running the Enthought 6.2 distribution (python 2.6, matplotlib 0.99.3, ipython 0.10, ...) which is installed as a Framework on a Mac OSX 10.6 platform. 
>
> I currently am using (matplotlibrc file)
>
> backend : macosx (I find the same issues with WXAgg and TkAgg as well)
> ...
> text.usetex : true #use latex for all text handling
>
>
> Both problems began with my Enthought distribution (but for reasons I will spare you, I don't want to switch to a different installation if possible, except upgrade Enthought).
>
>
> Problem 1:
> With all my old installations, which existed on previous Mac OSX version (10.5), I did not need to set
>
> text.usetex : true #use latex for all text handling
>
> My text rendering worked fine. But with the Enthought version, for some reason, I got fatal errors. So I switched to having latex render all text. This wasn't a big deal, and it has been a while, so I don't have the error logs anymore. Just wondering if anyone else experienced this, and understands why?
Without seeing the content of the error, it's very hard to say why it might be failing. Can you set text.usetex back to False and send us the error output?
>
>
> Problem 2: (I believe unrelated to 1)
>
> I use the annotate command to add text to my figures, displaying analysis results.
>
> Frequently, when I save the figure as a PDF, these annotated texts do not appear in the saved PDF. I find that if I fiddle with the matplotlib gui figure-window, adjusting the size on my screen, then I can eventually get the saved PDF to contain this text. But this gets very annoying quickly, as almost never is the default size the one needed to properly capture the text in the saved figure, and it requires lots of fine-tuning with trial and error.
>
> If I instead save as PNG, I almost never have this problem (maybe never).
>
>
> Infrequently, the text doesn't even display in the gui window, until I fiddle with the size of the window.
>
> In both cases, NO errors are produced. My script which does the analysis and produces the figures uses
>
> from pylab import *
>
> but otherwise no "*" imports.
>
>
> My old Fink installation doesn't have this problem - but it was moved from my old Mac OSX 10.5 system, and there are some issues with the upgrade to Mac OSX 10.6, which lead me to need to just re-install everything fresh on the 10.6 OS.
>
>
> I am not sure if this problem is specific to Enthought's distribution (the latex tex rendering problem made me suspect this) or is just some bizarre Mac problem or ???
>
>
> So, does anyone out there have the same or similar problem? And better yet, understand why and how to fix?
Which backend are you using? Can you provide a standalone plot that produces the error? Do any of the included examples (particularly those related to annotate) fail for you?
Mike
________________________________________
From: Andre' Walker-Loud [wal...@gm...]
Sent: Thursday, March 24, 2011 12:35 PM
To: Matplotlib Users
Subject: [Matplotlib-users] matplotlib figures missing text
Hi All,
I am having two slight irritating issues making figures with matplotlib (and have not found a solution with Google)
I am running the Enthought 6.2 distribution (python 2.6, matplotlib 0.99.3, ipython 0.10, ...) which is installed as a Framework on a Mac OSX 10.6 platform.
I currently am using (matplotlibrc file)
backend : macosx (I find the same issues with WXAgg and TkAgg as well)
...
text.usetex : true #use latex for all text handling
Both problems began with my Enthought distribution (but for reasons I will spare you, I don't want to switch to a different installation if possible, except upgrade Enthought).
Problem 1:
With all my old installations, which existed on previous Mac OSX version (10.5), I did not need to set
text.usetex : true #use latex for all text handling
My text rendering worked fine. But with the Enthought version, for some reason, I got fatal errors. So I switched to having latex render all text. This wasn't a big deal, and it has been a while, so I don't have the error logs anymore. Just wondering if anyone else experienced this, and understands why?
Problem 2: (I believe unrelated to 1)
I use the annotate command to add text to my figures, displaying analysis results.
Frequently, when I save the figure as a PDF, these annotated texts do not appear in the saved PDF. I find that if I fiddle with the matplotlib gui figure-window, adjusting the size on my screen, then I can eventually get the saved PDF to contain this text. But this gets very annoying quickly, as almost never is the default size the one needed to properly capture the text in the saved figure, and it requires lots of fine-tuning with trial and error.
If I instead save as PNG, I almost never have this problem (maybe never).
Infrequently, the text doesn't even display in the gui window, until I fiddle with the size of the window.
In both cases, NO errors are produced. My script which does the analysis and produces the figures uses
from pylab import *
but otherwise no "*" imports.
My old Fink installation doesn't have this problem - but it was moved from my old Mac OSX 10.5 system, and there are some issues with the upgrade to Mac OSX 10.6, which lead me to need to just re-install everything fresh on the 10.6 OS.
I am not sure if this problem is specific to Enthought's distribution (the latex tex rendering problem made me suspect this) or is just some bizarre Mac problem or ???
So, does anyone out there have the same or similar problem? And better yet, understand why and how to fix?
Thanks,
Andre
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Paul I. <piv...@gm...> - 2011年03月24日 23:24:00
Angus McMorland, on 2011年03月24日 15:46, wrote:
> Hi all,
> 
> I'm trying to get a grid of grids of plots, where the inner grids have
> no inter-plot spacing. Is there a recommended way to go about this?
> I'm aware AxesGrid can do the no-spacing requirement, but it's not so
> obvious that it can be used to nest one grid within another, as
> gridspec can. Can the two work together, or can I achieve what I need
> with gridspec alone?
> I've tried setting the gridspec hspace and wspace both to 0., but that
> doesn't force the spacing to be exactly zero.
Hi Angus,
I think you can get the desired functionality with gridspec
alone. Take a look at
doc/users/plotting/examples/demo_gridspec06.py which you can find
here
https://github.com/matplotlib/matplotlib/blob/f1c8/doc/users/plotting/examples/demo_gridspec06.py
See also the thread called "How to make a grid of (plot) grids?" from
this list in January, 2011 at [1] or [2]:
1. http://old.nabble.com/How-to-make-a-grid-of-%28plot%29-grids--td30581281.html
2. http://www.mail-archive.com/mat...@li.../msg19710.html
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Angus M. <am...@gm...> - 2011年03月24日 19:47:14
Hi all,
I'm trying to get a grid of grids of plots, where the inner grids have
no inter-plot spacing. Is there a recommended way to go about this?
I'm aware AxesGrid can do the no-spacing requirement, but it's not so
obvious that it can be used to nest one grid within another, as
gridspec can. Can the two work together, or can I achieve what I need
with gridspec alone?
I've tried setting the gridspec hspace and wspace both to 0., but that
doesn't force the spacing to be exactly zero.
Thanks for any help,
Angus.
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
From: Andre' Walker-L. <wal...@gm...> - 2011年03月24日 16:35:19
Hi All,
I am having two slight irritating issues making figures with matplotlib (and have not found a solution with Google)
I am running the Enthought 6.2 distribution (python 2.6, matplotlib 0.99.3, ipython 0.10, ...) which is installed as a Framework on a Mac OSX 10.6 platform. 
I currently am using (matplotlibrc file)
backend : macosx (I find the same issues with WXAgg and TkAgg as well)
...
text.usetex : true #use latex for all text handling
Both problems began with my Enthought distribution (but for reasons I will spare you, I don't want to switch to a different installation if possible, except upgrade Enthought).
Problem 1:
With all my old installations, which existed on previous Mac OSX version (10.5), I did not need to set
text.usetex : true #use latex for all text handling
My text rendering worked fine. But with the Enthought version, for some reason, I got fatal errors. So I switched to having latex render all text. This wasn't a big deal, and it has been a while, so I don't have the error logs anymore. Just wondering if anyone else experienced this, and understands why?
Problem 2: (I believe unrelated to 1)
I use the annotate command to add text to my figures, displaying analysis results.
Frequently, when I save the figure as a PDF, these annotated texts do not appear in the saved PDF. I find that if I fiddle with the matplotlib gui figure-window, adjusting the size on my screen, then I can eventually get the saved PDF to contain this text. But this gets very annoying quickly, as almost never is the default size the one needed to properly capture the text in the saved figure, and it requires lots of fine-tuning with trial and error.
If I instead save as PNG, I almost never have this problem (maybe never).
Infrequently, the text doesn't even display in the gui window, until I fiddle with the size of the window.
In both cases, NO errors are produced. My script which does the analysis and produces the figures uses
from pylab import *
but otherwise no "*" imports.
My old Fink installation doesn't have this problem - but it was moved from my old Mac OSX 10.5 system, and there are some issues with the upgrade to Mac OSX 10.6, which lead me to need to just re-install everything fresh on the 10.6 OS.
I am not sure if this problem is specific to Enthought's distribution (the latex tex rendering problem made me suspect this) or is just some bizarre Mac problem or ???
So, does anyone out there have the same or similar problem? And better yet, understand why and how to fix?
Thanks,
Andre
From: Daniel W. <dan...@gm...> - 2011年03月24日 15:44:25
Thanks for your help, Michiel. Two follow up points, one concerning the OSX
backend and one concerning the QT4 backend:
1) A colleague can reproduce the OSX problem we have talked about, but has
never run into it before. We have identical installs of
python/matplotlib/etc through MacPorts, however his OSX plots pop up
automatically without turning interactive plotting on (pyplot.ion()). I did
not have this behavior; show() was required to bring up a plot up until
ion() was called. A fresh install (see item 2) has "fixed" this behavior on
my machine so that our two installs now behave identically.
2) With an understanding of the importance of a +framework install when
using Python/MPL, I wiped my QT4 and pyqt4 installs (again, through
MacPorts) and reinstalled. I also reinstalled MPL. Because I have been
using all of them for some time, I had many old versions installed but not
activated in MacPorts. I removed every old version for all of the programs
listed above and started from scratch. I used the +framework variant (also,
+quartz). Everything seems to work smoothly now. I'm not sure why; was it
the fresh install? was it the +framework variant? This fresh install also
seemed to change the MacOSX backend behavior, however I have done nothing
different with how I installed MPL.
Hopefully, this info is useful to someone down the line. Thanks again to
Michiel for his clarifications and help with the OSX backend; it is one of
the better backends if you are on a Mac!
-dw
On Wed, Mar 23, 2011 at 2:34 PM, Michiel de Hoon <mjl...@ya...>wrote:
> OK, thanks. I got the same behavior using Python (instead of ipython).
> Non-interactive usage has not yet been implemented in the MacOSX backend.
> We should be able to fix the bug that you found when implementing
> interactive/non-interactive usage for the MacOSX backend.
>
> Thanks,
> --Michiel.
>
> --- On *Wed, 3/23/11, Daniel Welling <dan...@gm...>* wrote:
>
>
> From: Daniel Welling <dan...@gm...>
> Subject: Re: [Matplotlib-users] Qt4 on OSX
> To: "Michiel de Hoon" <mjl...@ya...>
> Cc: mat...@li...
> Date: Wednesday, March 23, 2011, 12:27 PM
>
>
> Greetings again, Michiel. Please excuse my slow response time...
>
> First, thanks for explaining the Framework stuff; it clarifies situation.
> I'll be sure to never blame the OSX backend where it is not warranted!
>
> Unfortunately (in terms of easy explanations):
> In [3]: MacOS.WMAvailable()
> Out[3]: True
>
> crap.
>
> Fortunately, I've been able to nail down the problem:
> bash-3.2$ ipython
> Python 2.6.6 (r266:84292, Jan 18 2011, 14:07:55)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.10.1 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help -> Python's own help system.
> object? -> Details about 'object'. ?object also works, ?? prints more.
>
> In [2]: import matplotlib.pyplot as plt
> In [3]: plt.plot([0,1])
> Out[3]: [<matplotlib.lines.Line2D object at 0x118c6be90>]
> In [4]: plt.show()
> (Here, saving the plot works like normal.)
> In [5]: plt.ion()
> In [6]: plt.plot([0,1])
> Out[6]: [<matplotlib.lines.Line2D object at 0x118c8bc90>]
> (Now, when trying to save the plot, the "save" and "cancel" buttons no
> longer respond. I must kill python from another terminal.)
>
> So that's the situation with OSX. It's something that comes up frequently
> enough (typically a quick plot turns into a more thorough customization
> followed by the lockup) that TK becomes a more viable option for me though
> OSX is faster and has better file navigation features. Again, if QT4 was
> working, that is certainly my weapon of choice...
>
>
> On Mon, Mar 21, 2011 at 7:14 AM, Michiel de Hoon <mjl...@ya...<http://mc/compose?to=mjl...@ya...>
> > wrote:
>
> --- On *Sun, 3/20/11, Daniel Welling <dan...@gm...<http://mc/compose?to=dan...@gm...>
> >* wrote:
> > The OSX backend used to have a bug where you cannot type a
> > name in the file name text box.Since that has been fixed, ...
> That was not a bug in the MacOSX backend (and therefore was not fixed), but
> is related to how Python is installed on your system: If your Python is not
> a framework installation, it will not interact correctly with Apple's
> windowing manager. This is due to OS X itself and is independent of the
> MacOSX backend.
>
> I have found a new bug: every so often, when you go to save a file, the
> "save" and "cancel" button stop responding, trapping the user in file saving
> limbo. I'll have to play with it again to figure out what triggers this.
>
> Can you check if your Python is built as a framework? If it is,
> MacOS.WMAvailable() should return True:
>
> $ python
> Python 2.7.1 (r271:86832, Mar 12 2011, 13:44:53)
> [GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import MacOS
> >>> MacOS.WMAvailable()
> True
> >>>
>
>
> Best,
> --Michiel.
>
>
>
>
>
From: Neal B. <ndb...@gm...> - 2011年03月24日 13:24:51
Actually, I got nice results using:
legend (title="blah blah"...)
Jae-Joon Lee wrote:
> The position of the legend is determined at drawing time, so it is a
> bit tricky to get it right.
> I recommend you to use "annotate" instead.
> 
> ax = subplot(111)
> ax.plot([1,2,3], label="u=2,p=3")
> leg = ax.legend()
> 
> ann = ax.annotate("Test 2", xy=(0.5, 1.), xycoords=leg.get_frame(),
> xytext=(0,10), textcoords="offset points",
> va="center", ha="left",
> )
> 
> ann.set_zorder(leg.get_zorder()+0.1)
> # the zorder of ann must be higher than leg so that the position of
> leg is known when ann gets drawn
> 
> See here for some more details.
> 
> http://matplotlib.sourceforge.net/users/annotations_guide.html#using-complex-
coordinate-with-annotation
> 
> Regards,
> 
> -JJ
> 
> 
> 
> On Fri, Mar 18, 2011 at 8:31 PM, Neal Becker <ndb...@gm...> wrote:
>> My legend is going to have a series of entries that look like:
>>
>> u=2,p=3
>> u=1,p=4
>> ...
>>
>>
>> I want to add some (short) text that explains what u and p are.
>>
>> I'm thinking to get the coordinates of the legend box so I can then annotate?
>>
>> How would I get the coordinates of the legend box? Or is there some
>> better/easier way to do what I want?
>>
>>
From: Jae-Joon L. <lee...@gm...> - 2011年03月24日 04:04:00
The position of the legend is determined at drawing time, so it is a
bit tricky to get it right.
I recommend you to use "annotate" instead.
ax = subplot(111)
ax.plot([1,2,3], label="u=2,p=3")
leg = ax.legend()
ann = ax.annotate("Test 2", xy=(0.5, 1.), xycoords=leg.get_frame(),
 xytext=(0,10), textcoords="offset points",
 va="center", ha="left",
 )
ann.set_zorder(leg.get_zorder()+0.1)
# the zorder of ann must be higher than leg so that the position of
leg is known when ann gets drawn
See here for some more details.
http://matplotlib.sourceforge.net/users/annotations_guide.html#using-complex-coordinate-with-annotation
Regards,
-JJ
On Fri, Mar 18, 2011 at 8:31 PM, Neal Becker <ndb...@gm...> wrote:
> My legend is going to have a series of entries that look like:
>
> u=2,p=3
> u=1,p=4
> ...
>
>
> I want to add some (short) text that explains what u and p are.
>
> I'm thinking to get the coordinates of the legend box so I can then annotate?
>
> How would I get the coordinates of the legend box? Or is there some
> better/easier way to do what I want?
>
>
> ------------------------------------------------------------------------------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
9 messages has been excluded from this view by a project administrator.

Showing results of 290

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