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

Showing 16 results of 16

From: Jenna L. <je...@as...> - 2010年07月28日 23:55:53
Hmm that is not what my output looks like. Attached is a capture of my
output. I am using matplotlib version 0.98.5.3 
http://old.nabble.com/file/p29291928/shift_subplot_test.png
shift_subplot_test.png 
Jae-Joon Lee wrote:
> 
> On Thu, Jul 29, 2010 at 1:17 AM, Jenna L. <je...@as...>
> wrote:
>> That looks fine to me too, but if you plot that as one subplot in a 5x5
>> array
>> of subplots or more, then you can see the shift I am talking about in the
>> eps file. Example:
> 
> I still don't see it (a capture of my eps output is attached).
> Can you post your output (original eps file that shows the shift)?
> 
> Again, what is your matplotlib version?
> 
> Regards,
> 
> -JJ
> 
> 
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of 1ドル Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Saving-as-eps-file-shifts-image--tp29232680p29291928.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2010年07月28日 23:41:15
Attachments: image_shift_test.png
On Thu, Jul 29, 2010 at 1:17 AM, Jenna L. <je...@as...> wrote:
> That looks fine to me too, but if you plot that as one subplot in a 5x5 array
> of subplots or more, then you can see the shift I am talking about in the
> eps file. Example:
I still don't see it (a capture of my eps output is attached).
Can you post your output (original eps file that shows the shift)?
Again, what is your matplotlib version?
Regards,
-JJ
From: Simon F. <sim...@a-...> - 2010年07月28日 22:30:20
On 18:32 Sun 18.07.10, Friedrich Romstedt wrote:
> Try to add:
> ax.set_xticks(range(0, 10))
> ax.set_yticks(range(0, 10))
> 
> before the imshow call.
> 
> For some reason it must happen before the imshow call and not after,
> else the yscaling will change (I don't understand this).
Thanks for this tip. Apparently there is a necessary order for some calls.
Is this documented anywhere? It seems quite problematic.
Also I have now finished my confusion matrix program:
http://paste.pocoo.org/show/242834/
Comments on the code would be very welcome.
If people like it maybe it could be included in the examples. I think it's a
relatively common usecase.
Regards
Simon
From: Benjamin R. <ben...@ou...> - 2010年07月28日 21:53:43
On Wed, Jul 28, 2010 at 3:56 PM, Thomas Robitaille <
tho...@gm...> wrote:
> Hi,
>
> How does one plot an arrow in a log log plot? In the following example, I
> can't get the arrow head, regardless of what value I use for the head width:
>
> import matplotlib as mpl
> mpl.use('Agg')
> import matplotlib.pyplot as plt
>
> fig = plt.figure()
> ax = fig.add_subplot(1,1,1)
> ax.arrow(0.2,0.2,0.5,0.5,head_width=1.)
> ax.set_xscale('log')
> ax.set_yscale('log')
> ax.set_xlim(0.1,1.)
> ax.set_ylim(0.1,1.)
> fig.savefig('test.png')
>
> In addition, the documentation for arrow does not even mention any arrow
> specific options such as the head width/length, and the example plot is
> missing (there is a 'Exception occurred rendering plot.' message instead)
>
>
> http://matplotlib.sourceforge.net/api/axes_api.html?highlight=arrow#matplotlib.axes.Axes.arrow
>
> Thanks for any help,
>
> Thomas
>
I can't say anything with regards to why your figure is not working, or why
the plot fails to render online (it renders just fine for myself when built
locally). However, I have noticed that the lack of information regarding
the options for arrow seems to be related to the docstring for arrow()
referring to the kwargs for FancyArrow, but none of those are defined. And
the docstring for FancyArrow appears to be incomplete.
Ben Root
From: Thomas R. <tho...@gm...> - 2010年07月28日 20:56:47
Hi,
How does one plot an arrow in a log log plot? In the following example, I can't get the arrow head, regardless of what value I use for the head width:
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.arrow(0.2,0.2,0.5,0.5,head_width=1.)
ax.set_xscale('log')
ax.set_yscale('log')
ax.set_xlim(0.1,1.)
ax.set_ylim(0.1,1.)
fig.savefig('test.png')
In addition, the documentation for arrow does not even mention any arrow specific options such as the head width/length, and the example plot is missing (there is a 'Exception occurred rendering plot.' message instead)
http://matplotlib.sourceforge.net/api/axes_api.html?highlight=arrow#matplotlib.axes.Axes.arrow
Thanks for any help,
Thomas
From: Benjamin R. <ben...@ou...> - 2010年07月28日 20:00:02
On Wed, Jul 28, 2010 at 2:39 PM, Angus McMorland <am...@gm...> wrote:
> On 28 July 2010 15:25, Waléria Antunes David <wal...@gm...>
> wrote:
> > Hello all,
> >
> > Well, my problem is ... My current code is as follow bellow:
> > http://pastebin.com/7p2N5d64
>
> Hi Waléria,
>
> We can't easily fix your problem without knowing what data f and
> Sserie contain. It would help us to help you if you could post a
> standalone example that shows your problem without relying on external
> data.
>
> Angus.
> --
> AJC McMorland
> Post-doctoral research fellow
> Neurobiology, University of Pittsburgh
>
>
Angus is correct that providing a stand-alone version of the script that
replicates your problem would be most useful. I would like to mention a
couple of possible improvements to your code. These improvements may or may
not fix your issue, but they will improve your current code.
1) Use list comprehensions
Change
y=[]
for n in f:
 y.append(n/Decimal(1000))
y = numpy.array(y)
into:
y = numpy.array(f) / 1000.0
Also,
ax.grid('TRUE')
should be:
 ax.grid(True)
I hope this helps. If not, then please send a stand-alone example that
duplicates the problem you are having.
Ben Root
From: Angus M. <am...@gm...> - 2010年07月28日 19:39:56
On 28 July 2010 15:25, Waléria Antunes David <wal...@gm...> wrote:
> Hello all,
>
> Well, my problem is ... My current code is as follow bellow:
> http://pastebin.com/7p2N5d64
Hi Waléria,
We can't easily fix your problem without knowing what data f and
Sserie contain. It would help us to help you if you could post a
standalone example that shows your problem without relying on external
data.
Angus.
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
From: Eric F. <ef...@ha...> - 2010年07月28日 18:54:59
On 07/28/2010 05:48 AM, Benjamin Root wrote:
> On Tue, Jul 27, 2010 at 1:31 PM, Friedrich Romstedt
> <fri...@gm... <mailto:fri...@gm...>> wrote:
>
> 2010年7月26日 Benjamin Root <ben...@ou... <mailto:ben...@ou...>>:
> > After some reading of sphinx documentation, it appears to be a
> bug with
> > sphinx (or actually, "smartypants") because it should not be
> doing this sort
> > of interpretation within a docstring. Anyway, supposedly the
> workaround is
> > to put double backticks around the part that needs to be treated
> literally:
> > ``'--'``. I tried this out and built the docs locally and it
> works... sort
> > of. The text that is surrounded by double backticks are getting
> a different
> > background color. This doesn't look great to me. Maybe someone
> else has a
> > thought?
>
> How looks a backticked empty string like? If it is just nothing, it
> could be used in between of the two hyphens, to separate them by
> "nothing". Still very hackish ... But it's just like LaTeX -{}-.
>
> Friedrich
>
>
> Actually, I just took another look at the documentation and realized
> that the docstring for set_linestyle() was inconsistent with the docs
> for plot(). plot() have been using the backticks for a while now, so if
> we just use the double-backticks for all the values in set_linestyle()
> it would be consistent and look much better than it is now.
>
> I can make these changes and commit them to the trunk and the release
> branch, if that is ok.
Ben,
Sounds reasonable--go ahead.
Thanks.
Eric
>
> Ben Root
>
>
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of 1ドル Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Eric F. <ef...@ha...> - 2010年07月28日 18:31:49
On 07/27/2010 02:31 PM, Phil Rosenfield wrote:
> Hi,
>
> I'm 6 months into learning python and haven't been able to find a way
> to do this, so I hope you don't mind a basic question.
>
> I'd like to use the polygons contour makes but I can't figure out how
> to get them from ContourSet. Any examples or links to helpful
> information would be excellent.
They are buried. Each contour set has a list of collections, and
each of those collections has a set of paths, and each of those paths 
has a vertices attribute for its corresponding polygon. In the 
following we will pick out the first path of the first collection.
cs = contour(rand(6,6))
c = cs.collections[0]
p = c.get_paths()[0]
v = p.vertices
lev = cs.levels[0]
The levels attribute is a list of levels corresponding to the list of 
collections: one collection per level.
Eric
> Thanks,
> Phil
>
From: Jenna L. <je...@as...> - 2010年07月28日 16:17:50
That looks fine to me too, but if you plot that as one subplot in a 5x5 array
of subplots or more, then you can see the shift I am talking about in the
eps file. Example:
import matplotlib.pyplot as plt
import numpy as np
arr = np.zeros((11, 11), dtype="d")
arr[3,3]=1
plt.figure(1)
plt.subplot(10,10,1)
im = plt.imshow(arr, interpolation="nearest", origin="lower")
cont = plt.contour(arr, levels=[0.5])
plt.savefig("a.eps")
Jae-Joon Lee wrote:
> 
> I tried a simple array (see the code below) but cannot reproduce the
> problem you reported.
> 
> import matplotlib.pyplot as plt
> import numpy as np
> 
> arr = np.zeros((11, 11), dtype="d")
> arr[3,3]=1
> im = plt.imshow(arr, interpolation="nearest", origin="lower")
> cont = plt.contour(arr, levels=[0.5])
> plt.savefig("a.eps")
> 
> Do you still see the shift with the above example code?
> And what version of matplotlib are you using?
> 
> If possible, please post a complete script with the data (use a
> mock-up data if you want)?
> Regards,
> 
> -JJ
> 
> 
> 
> On Fri, Jul 23, 2010 at 12:16 AM, Jenna Lemonias
> <je...@as...> wrote:
>> No, I don't think the issue is a flip in the y-axis. I have a number of
>> different examples of this, and many in which the contour is an ellipse
>> so I
>> can tell that the overall positioning is correct. It seems like
>> something
>> is going wrong only when I save the image... Thanks for the suggestion
>> though!
>>
>> Jenna
>>
>> On Wed, Jul 21, 2010 at 3:40 PM, Jenna Lemonias
>> <je...@as...>wrote:
>>
>>> I am trying to save a matplotlib 2d array image with an overlaid contour
>>> as
>>> an eps file. The contour appears to be shifted with respect to the
>>> image
>>> underneath in the eps file, particularly when I zoom in on the image.
>>> This
>>> shift is not noticeable in the plot within matplotlib.
>>>
>>> I am using imshow to display the image. The contour is created by
>>> plotting
>>> a list of closely-spaced x,y coordinates. The attached file
>>> matplotlib.png
>>> is a screenshot of the (zoomed-in) image as displayed by matplotlib. 
>>> The
>>> attached file epsfile.png is a screenshot of the (zoomed-in) eps file.
>>> When
>>> I save this image as an eps file, it is actually 1 of 20 subplots and
>>> the
>>> shift is noticeable in each subplot.
>>>
>>> Thanks in advance for your help!
>>>
>>> Jenna
>>>
>>>
>> Just as a wild guess, could this actually be an issue with how imshow
>> uses
>> the upper-left corner for (0,0)? I have seen 1-pixel shifts before, but
>> this shift is a little dramatic and I am left wondering if what we are
>> really seeing is that the contour that is desired should actually be
>> fliped
>> in the y-axis?
>>
>> Maybe you could try another example where you try to draw a contour
>> further
>> away from the center of the image and see if it still goes in the spot
>> you
>> expect it to be?
>>
>> Ben Root
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
> 
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
> of 1ドル Million in cash or HP Products. Visit us here for more details:
> http://ad.doubleclick.net/clk;226879339;13503038;l?
> http://clk.atdmt.com/CRS/go/247765532/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Saving-as-eps-file-shifts-image--tp29232680p29288310.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Benjamin R. <ben...@ou...> - 2010年07月28日 15:49:12
On Tue, Jul 27, 2010 at 1:31 PM, Friedrich Romstedt <
fri...@gm...> wrote:
> 2010年7月26日 Benjamin Root <ben...@ou...>:
> > After some reading of sphinx documentation, it appears to be a bug with
> > sphinx (or actually, "smartypants") because it should not be doing this
> sort
> > of interpretation within a docstring. Anyway, supposedly the workaround
> is
> > to put double backticks around the part that needs to be treated
> literally:
> > ``'--'``. I tried this out and built the docs locally and it works...
> sort
> > of. The text that is surrounded by double backticks are getting a
> different
> > background color. This doesn't look great to me. Maybe someone else has
> a
> > thought?
>
> How looks a backticked empty string like? If it is just nothing, it
> could be used in between of the two hyphens, to separate them by
> "nothing". Still very hackish ... But it's just like LaTeX -{}-.
>
> Friedrich
>
Actually, I just took another look at the documentation and realized that
the docstring for set_linestyle() was inconsistent with the docs for
plot(). plot() have been using the backticks for a while now, so if we just
use the double-backticks for all the values in set_linestyle() it would be
consistent and look much better than it is now.
I can make these changes and commit them to the trunk and the release
branch, if that is ok.
Ben Root
From: Ian T. <ian...@gm...> - 2010年07月28日 15:05:54
Attachments: contour_polygons.py
On 28 July 2010 01:31, Phil Rosenfield <phi...@as...>wrote:
> I'd like to use the polygons contour makes but I can't figure out how
> to get them from ContourSet. Any examples or links to helpful
> information would be excellent.
>
Attached is an example of how to extract the polygons from a ContourSet.
From: John H. <jd...@gm...> - 2010年07月28日 14:57:05
On Wed, Jul 28, 2010 at 8:35 AM, Mario Laforest 2
<mar...@ub...> wrote:
> Hello,
>
>
>
> I am trying to create clickable images for HTML. For transforming the
> coordinates in the examples I found they are using the function
> "seq_x_y()".
>
>
>
> But that function is not available anymore. How can I get transform the
> coordinates with the newer versions of Matplotlib?
Take a look at the transformations tutorial
http://matplotlib.sourceforge.net/users/transforms_tutorial.html
JDH
From: David M. <dav...@gm...> - 2010年07月28日 14:40:41
Thanks so much guys!
This finally worked!
f=gcf()
for i in f.canvas.callbacks.callbacks:
 if i=='key_press_event':
 f.canvas.mpl_disconnect(f.canvas.callbacks.callbacks[i].keys()[0])
Thanks!
-David
Aha! I thought you were using 1.0. For 1.0, these things are rc 
settings; I had no idea they even existed back in 0.99.0. I only 
tripped over "f" very recently.
The key bindings are coded in the key_press() method of 
FigureManagerBase. The callback is connected to the canvas in the 
__init__ method. The trick is to disconnect the callback:
fig = figure()
fig.canvas.mpl_disconnect(3)
plot([1,2,3])
Now key presses have no effect in that figure. The bad thing here is 
that I used the cid 3, a seemingly random number. I suspect, though, 
that once you find out what it is in your version of mpl (and it may 
still be 3), you will be able to rely on it for your purposes. To find 
it, print out fig.canvas.callbacks.callbacks and look for 
key_press_event. You could have your program use this dictionary to 
look it up.
Eric
From: Mario L. 2 <mar...@ub...> - 2010年07月28日 14:10:25
Hello,
I am trying to create clickable images for HTML. For transforming the coordinates in the examples I found they are using the function "seq_x_y()".
But that function is not available anymore. How can I get transform the coordinates with the newer versions of Matplotlib?
Thanks
Mario
From: Phil R. <phi...@as...> - 2010年07月28日 00:57:02
Hi,
I'm 6 months into learning python and haven't been able to find a way
to do this, so I hope you don't mind a basic question.
I'd like to use the polygons contour makes but I can't figure out how
to get them from ContourSet. Any examples or links to helpful
information would be excellent.
Thanks,
Phil
-- 
Phil Rosenfield
Graduate Student: UW Astronomy
Additional contact info:
http://www.astro.washington.edu/philrose
1 message has been excluded from this view by a project administrator.

Showing 16 results of 16

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /