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

Showing 18 results of 18

From: Daniel H. <dh...@gm...> - 2012年03月20日 20:39:05
Oops, one thing about the graph that I forgot to point out...does the
antialiasing look a little funny? It seems a bit inconsistent, especially
as the line goes flat. I increased the line width in an effort to make it
less obvious; is there some other way to improve this behavior?
From: Moore, E. (NIH/N. [F] <eri...@ni...> - 2012年03月20日 20:14:23
> -----Original Message-----
> From: Moore, Eric (NIH/NIDDK) [F]
> Sent: Monday, March 19, 2012 1:48 PM
> To: matplotlib-users
> Subject: Re: [Matplotlib-users] xticks when using twinx()
> 
> Mario,
> 
> When you call fig.add_subplot as you are doing, ax1 is None. I'm not
> sure why, but you don't need to set the xticks there anyway. Change
> your call to be ax1 = fig.add_subplot(111) that way ax1 != None. Then
> plot, create ax2, plot. You can then set the xticks by calling
> ax1.set_xticks([10,40,90]) or equivalently ax2.set_xticks([10,40,90]).
> 
> Eric
> 
Looking at the code for Figure.add_subplot in figure.py, the first line is:
if not len(args): return
Why just silently fail if no position arguments are passed? At the very least shouldn't this print an error message? I'm not sure that I understand the rational for just swallowing an error this way. Anyone know why it does this?
Eric
From: C M <cmp...@gm...> - 2012年03月20日 19:05:01
I'm trying to make a rectangle that "highlights" a straight line of markers
such that:
1) it surrounds/contains the points, basically like:
--------------------------------------------------------------------------------------
|
 |
| O O O O
 |
|
 |
|-------------------------------------------------------------------------------------
2) its height doesn't change with zoom. (it should always be approximately
a little taller than the height of the markers' heights).
I can do (1) but so far not (2). I'm pretty sure I need to use a blended
transform for this somehow....and possibly TransformedPath, but I'm lost as
to how to do this.
Thanks,
Che
From: Paul H. <pmh...@gm...> - 2012年03月20日 18:15:09
On Tue, Mar 20, 2012 at 5:27 AM, kususe <ku...@in...> wrote:
>
> If I set the parameter "transparent" in the "savefig" function, more line are
> plotted out on the same figure, when I use the subplot function too.
> If I don't set it, all works well.
> Suggestions?
I don't follow what you're saying very well. Can you provide a minimal
and complete example to demonstrate this behavior.
Thanks,
-paul
From: Benjamin R. <ben...@ou...> - 2012年03月20日 16:41:04
On Tuesday, March 20, 2012, Julien Rebetez <jul...@gm...> wrote:
> Thank you for your answer.
>
> I've read the numpy tutorial and I get it that array and matrices
> behave differently.
>
> Now, what I find kind of strange is that the plot I get when directly
> feeding the matrices to scatter
> doesn't really seem to represent anything.
> I think that, if possible, showing an error or a warning would be much
> more appropriate than showing
> a plot. It would let the user know that the problem is not with her
> dataset, but with the plot.
>
> Wouldn't it be possible to simply check the shape in scatter() and
> display a warning if it has more than one dimension ?
>
> Best,
> Julien
I think this is more of an issue that we simply never tested for matrices.
 As for the shape tests, scatter can take 2d arrays, iirc, with each column
being a different color. (again, all from my memory, which would easily
fail memcheck).
Ben Root
From: Zachary P. <zac...@ya...> - 2012年03月20日 15:51:47
Hi all,
There are a couple of properties I'd like my plot axes to have by default (tick2On=False for the x and ytics, and having no 'right' or 'top' spines). These seem a bit obscure to put into the rcparams, but it would be nice to not have to call some function to fix this up every time I make a new set of axes.
Is there a good way to get this to happen automatically? Some sort of callback I can register? Or would I need to subclass Axes and monkeypatch that in as the default or something?
Any suggestions welcome!
Zach
From: Julien R. <jul...@gm...> - 2012年03月20日 15:37:10
Thank you for your answer.
I've read the numpy tutorial and I get it that array and matrices
behave differently.
Now, what I find kind of strange is that the plot I get when directly
feeding the matrices to scatter
doesn't really seem to represent anything.
I think that, if possible, showing an error or a warning would be much
more appropriate than showing
a plot. It would let the user know that the problem is not with her
dataset, but with the plot.
Wouldn't it be possible to simply check the shape in scatter() and
display a warning if it has more than one dimension ?
Best,
Julien
On Tue, Mar 20, 2012 at 3:52 PM, Jerzy Karczmarczuk
<jer...@un...> wrote:
> LJulien Rebetez :
>> I've run into a strange behaviour of matplotlib while trying to figure
>> out why my data was displayed incorrectly.
>> I'm note quite sure if this is a bug or expected behaviour, but I feel
>> it's kind of counter-intuitive, so I'm posting here.
>>
>> ...
>> Now there seem to be a difference on how numpy handles A[:,0]
>> depending on if A is a np.array or np.matrix. In the case of
>> an array, a 1D array is returned, in the case of a matrix, a 2D Nx1
>> matrix is returned. Using this matrix seems to confuse matplotlib.
>>
>> Using np.ravel or np.flatten on the slices fix that problem.
>>
>> Is there an explanation for this behaviour or should I fill a bug ?
> Don't fill a bug.
> Read http://www.scipy.org/Tentative_NumPy_Tutorial , please.
> They explain that a slice of a matrix is a matrix, and its "view" is
> different from what you get for arrays.
>
> But, no need to reshape the stuff. Just use the "array attribute" of the
> matrix :
>
> pl.scatter(B.A[:,0], B.A[:,1], c='b')
>
> //Here 'A' is the name of the attribute, nothing to do with your array
> A; by chance it is the same...//
>
>
> The best
>
> Jerzy Karczmarczuk
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jerzy K. <jer...@un...> - 2012年03月20日 14:55:24
LJulien Rebetez :
> I've run into a strange behaviour of matplotlib while trying to figure
> out why my data was displayed incorrectly.
> I'm note quite sure if this is a bug or expected behaviour, but I feel
> it's kind of counter-intuitive, so I'm posting here.
>
> ...
> Now there seem to be a difference on how numpy handles A[:,0]
> depending on if A is a np.array or np.matrix. In the case of
> an array, a 1D array is returned, in the case of a matrix, a 2D Nx1
> matrix is returned. Using this matrix seems to confuse matplotlib.
>
> Using np.ravel or np.flatten on the slices fix that problem.
>
> Is there an explanation for this behaviour or should I fill a bug ?
Don't fill a bug.
Read http://www.scipy.org/Tentative_NumPy_Tutorial , please.
They explain that a slice of a matrix is a matrix, and its "view" is 
different from what you get for arrays.
But, no need to reshape the stuff. Just use the "array attribute" of the 
matrix :
pl.scatter(B.A[:,0], B.A[:,1], c='b')
//Here 'A' is the name of the attribute, nothing to do with your array 
A; by chance it is the same...//
The best
Jerzy Karczmarczuk
From: Benjamin R. <ben...@ou...> - 2012年03月20日 14:47:56
On Mon, Mar 19, 2012 at 5:28 PM, questions anon <que...@gm...>wrote:
> So when I add "np.logical_or" to the beginning of the script it makes no
> difference to the error message that I receive.
>
> I have tried reshaping the array but I receive an error message of:
> Traceback (most recent call last):
> File "<pyshell#0>", line 1, in <module>
> f.reshape(691,886)
> ValueError: total size of new array must be unchanged
>
> Is there a way to use np.genfromtxt and define the rows and columns on
> import?
>
> Thanks
>
>
I think you have two completely separate problems. They are completely
unrelated to each other. The np.logical_or() issue happens within Basemap
while your np.genfromtext() happens in your module. For the
np.logical_or() issue, I suspect that there is something wrong with your
installation (maybe EPD is conflicting with a pre-existing python
install?). As for np.genfromtext(), I would put the code back to the way
it was before (the original call looked right to me).
Ben Root
From: Julien R. <jul...@gm...> - 2012年03月20日 13:20:45
Hello,
I've run into a strange behaviour of matplotlib while trying to figure
out why my data was displayed incorrectly.
I'm note quite sure if this is a bug or expected behaviour, but I feel
it's kind of counter-intuitive, so I'm posting here.
The attached python script does a scatter plot of some data. I'm using
the first column as the x coordinates and the second as
y. Looking at the matrix (x == y), I'd expect the three data point to
be on a diagonal line.
Now there seem to be a difference on how numpy handles A[:,0]
depending on if A is a np.array or np.matrix. In the case of
an array, a 1D array is returned, in the case of a matrix, a 2D Nx1
matrix is returned. Using this matrix seems to confuse matplotlib.
Using np.ravel or np.flatten on the slices fix that problem.
Is there an explanation for this behaviour or should I fill a bug ?
Best regards,
Julien Rebetez
From: kususe <ku...@in...> - 2012年03月20日 12:27:12
If I set the parameter "transparent" in the "savefig" function, more line are
plotted out on the same figure, when I use the subplot function too. 
If I don't set it, all works well. 
Suggestions?
thanks in advance, 
K.
-- 
View this message in context: http://old.nabble.com/Not-understable-behavior-tp33538439p33538439.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: kususe <ku...@in...> - 2012年03月20日 10:00:06
I'd like to save an image with sole the graph. 
I set up 
ax.set_xticklabels([]) 
ax.set_frame_on(False) 
but I get an image with tra graph and some lines on the frame level, wich I
wanna remove. 
I attach the image to be more understandable (I circle in red what I'd like
to get off).
Suggestions??
Thanks in advance
http://old.nabble.com/file/p33537650/geo.png 
-- 
View this message in context: http://old.nabble.com/Remove-all-of-the-%22box-line%22-tp33537650p33537650.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: kususe <ku...@in...> - 2012年03月20日 09:49:50
Worked out. 
Thanks. 
Paul Hobson-2 wrote:
> 
> Sorry...That first line should be:
> fig, axes = plt.subplots(ncols=3) # note: subplotS not subplot
> 
> On Mon, Mar 19, 2012 at 5:45 PM, Paul Hobson <pmh...@gm...> wrote:
>> Try it like this:
>>
>>        fig, axes = plt.subplots(3,1,1)
>>        ax1, ax2, ax3 = axes
>>        p1, = ax1.plot(self.data0,self.data1)
>>        p2, = ax2.plot(self.data0,self.data2)
>>        p3, = ax3.plot(self.data0,self.data4)
>>        for ax in axes:
>>            ax.set_xticks([])
>>
>> -paul
> 
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here 
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33537582.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: 刘一新 <li...@gm...> - 2012年03月20日 09:43:48
The normal shape of a figure is a rectangle. But how can I create a oblique
figure, i.e. with side length not perpendicular each other. Thanks!
-- 
*Yi-Xin Liu, PHD*
*Department of Macromolecular Science*
*Fudan University*
*Room 415, Yuejing Building *
*Handan Rd. 220, **Shanghai, China*
*Tel +86-021-65642863*
*Mobile +86-13916819745*
http://www.mendeley.com/profiles/yi-xin-liu/
From: Sebastian O. <seb...@oh...> - 2012年03月20日 08:29:06
Hi Mike,
On 03/19/2012 06:53 PM, Michael Droettboom wrote:
> What are you using to view the SVG? This works for me in Inkscape,
> Firefox and Google Chrome, but fails using rsvg 2.34 (which is used by
> ImageMagick and emacs, for example). It seems that rsvg doesn't like
> the clip path to appear after the object that uses it, even though this
> is allowed by the SVG spec. SVG compliance is pretty spotty between
> different renderers, but I generally think rsvg is one of the worst.
thanks for the fast reply. actually i was using geeqie and i looks like
it is using a bad renderer. i am now using inkscape to render my svg
(not just for editing) and so far it do what i need it to do.
-- 
Regards
 Sebastian Ohl
 --
 Sebastian Ohl seb...@oh...
 Kurzekampstr. 14 Tel +49 531 7998221
 D-38104 Braunschweig Mobil +49 172 1837678
From: Joshua L. <jos...@gm...> - 2012年03月20日 05:27:29
Setting interpolation="none" in imshow fixed the problem.
Thanks for the help,
Joshua
On Mon, Mar 19, 2012 at 11:34 AM, Joshua Lande <jos...@gm...> wrote:
> Hi. I have attached a screenshot of the way the image looks when
> viewed by Preview on my mac, evince on my RHEL5 machine, and the built
> in google docs image viewer.
>
> The image should look like 22x22 square pixels, but (at least for me)
> has stripes of strange looking rectangular pixels. The preview
> screenshot shows both the good and bad version of the image.
>
> I hope this makes sense.
>
> Joshua
>
> On Mon, Mar 19, 2012 at 10:59 AM, Benjamin Root <ben...@ou...> wrote:
>> On Sun, Mar 18, 2012 at 5:07 PM, Joshua Lande <jos...@gm...> wrote:
>>>
>>> Hello.
>>>
>>> I have run into a strange error where matplotlib compresses images
>>> that are saved with the eps backend. Strangely, this compression seems
>>> to happen only for images saved with certain figure sizes. I created a
>>> very simple example which produces this behavior.
>>>
>>>  import pylab as P
>>>  import numpy as np
>>>  np.random.seed(0)
>>>  z=np.random.uniform(size=(22,22))
>>>
>>>  for figsize in [.5,.55]:
>>>    F = P.figure(None,(figsize,figsize))
>>>    ax = F.add_subplot(111)
>>>    im = ax.imshow(z, origin="lower", interpolation="nearest")
>>>    ax.xaxis.set_ticks([])
>>>    ax.yaxis.set_ticks([])
>>>
>>>    P.savefig('test_%.2f.eps' % figsize)
>>>
>>> This code produces test_0.50.eps (attached) which shows ugly
>>> compression whereas test_0.55.eps (also attached) is uncompressed.
>>>
>>> Is there an easy way to disable this compression?
>>>
>>> For reference, I am using python version 2.7.2, matplotlib version
>>> 1.1.0, and for clarity I do not have a matplotlibrc file.
>>>
>>> Thanks for your help,
>>>
>>> Joshua
>>>
>>
>> Using Firefox, I see no difference between the two images. What are you
>> using?
>>
>> Ben Root
>>
From: Paul H. <pmh...@gm...> - 2012年03月20日 00:47:04
Sorry...That first line should be:
fig, axes = plt.subplots(ncols=3) # note: subplotS not subplot
On Mon, Mar 19, 2012 at 5:45 PM, Paul Hobson <pmh...@gm...> wrote:
> Try it like this:
>
>        fig, axes = plt.subplots(3,1,1)
>        ax1, ax2, ax3 = axes
>        p1, = ax1.plot(self.data0,self.data1)
>        p2, = ax2.plot(self.data0,self.data2)
>        p3, = ax3.plot(self.data0,self.data4)
>        for ax in axes:
>            ax.set_xticks([])
>
> -paul
From: Paul H. <pmh...@gm...> - 2012年03月20日 00:45:31
Try it like this:
 fig, axes = plt.subplots(3,1,1)
 ax1, ax2, ax3 = axes
 p1, = ax1.plot(self.data0,self.data1)
 p2, = ax2.plot(self.data0,self.data2)
 p3, = ax3.plot(self.data0,self.data4)
 for ax in axes:
 ax.set_xticks([])
-paul
On Thu, Mar 15, 2012 at 1:06 AM, kususe <ku...@in...> wrote:
>
>
>
> On Wed, Mar 14, 2012 at 2:38 PM, kususe <ku...@in...> wrote:
>
>>
>> I got an error using the first subplot function because I have to specify
>> 3
>> parameters.
>> If i do it, I get that "AxesSubplot' object is not iterable"
>> I coded using 3 subplot functions, getting the same error.
>>
>> Thanks
>> K.
>>
>>
> Note that I wrote `subplots` with an "s", which is a different command than
> `subplot`. (You're really having problems with "s"s today :)
>
> BTW, would you mind interleaving or bottom-posting
> replies<http://en.wikipedia.org/wiki/Posting_style#Placement_of_replies>.
> It's a bit easier to follow the conversation that way.
>
> -Tony
>
>
> Yes, for sure I coded:
>
>        fig, axes = plt.subplot(3,1,1)
>        ax1, ax2, ax3 = axes
>        p1, = ax1.plot(self.data0,self.data1)
>        ....
>        plt.subplot(3,1,2)
>        p2, = ax2.plot(self.data0,self.data2)
>        .......
>        plt.subplot(3,1,3)
>        p3, = ax3.plot(self.data0,self.data4)
>        ........
>        for ax in axes:
>            ax.set_xticks([])
>
> but I got the error which said you.
> --
> View this message in context: http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33507959.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
1 message has been excluded from this view by a project administrator.

Showing 18 results of 18

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