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

Showing results of 312

<< < 1 2 3 4 5 6 .. 13 > >> (Page 4 of 13)
From: Benjamin R. <ben...@ou...> - 2011年09月23日 19:34:26
On Fri, Sep 23, 2011 at 2:28 PM, Gökhan Sever <gok...@gm...> wrote:
> On Fri, Sep 23, 2011 at 1:22 PM, Benjamin Root <ben...@ou...> wrote:
>
>> On Fri, Sep 23, 2011 at 2:07 PM, Gökhan Sever <gok...@gm...>wrote:
>>
>>> Hello,
>>>
>>> Considering this example plot:
>>> http://imageshack.us/photo/my-images/27/imagefki.png/
>>>
>>> How can I get the minor ticks showing correctly? (ie., 9 minor ticks per
>>> decade likewise for the x-axis)
>>>
>>> For some reason
>>>
>>> axis.set_minor_locator(LogLocator(numdecs=9) is not producing the desired
>>> output.
>>>
>>> Any hints?
>>>
>>> Thanks.
>>>
>>> --
>>> Gökhan
>>>
>>>
>> By default, setting the scale to log (e.g., ax.set_yscale('log')) should
>> automatically turn the minor ticks on for you. Note that depending on your
>> version of mpl, there may be a slight error in the documentation for
>> LogLocator.
>>
>> Ben Root
>>
>>
> Hi,
>
> I set the log scales for both axes. However, as you see in the image y-axis
> has only 4 minor ticks (8 expected) where as x-axis has none. I am using a
> couple days old mpl build.
>
>
I guess I would have to see your code. The y-axis ticks works fine in the
examples:
http://matplotlib.sourceforge.net/examples/pylab_examples/log_demo.html
Viewing the pdf or hires png shows 8 minor ticks.
Now, as for the x-axis, there are no minor ticks. That might be an issue...
Ben Root
From: Gökhan S. <gok...@gm...> - 2011年09月23日 19:28:12
On Fri, Sep 23, 2011 at 1:22 PM, Benjamin Root <ben...@ou...> wrote:
> On Fri, Sep 23, 2011 at 2:07 PM, Gökhan Sever <gok...@gm...>wrote:
>
>> Hello,
>>
>> Considering this example plot:
>> http://imageshack.us/photo/my-images/27/imagefki.png/
>>
>> How can I get the minor ticks showing correctly? (ie., 9 minor ticks per
>> decade likewise for the x-axis)
>>
>> For some reason
>>
>> axis.set_minor_locator(LogLocator(numdecs=9) is not producing the desired
>> output.
>>
>> Any hints?
>>
>> Thanks.
>>
>> --
>> Gökhan
>>
>>
> By default, setting the scale to log (e.g., ax.set_yscale('log')) should
> automatically turn the minor ticks on for you. Note that depending on your
> version of mpl, there may be a slight error in the documentation for
> LogLocator.
>
> Ben Root
>
>
Hi,
I set the log scales for both axes. However, as you see in the image y-axis
has only 4 minor ticks (8 expected) where as x-axis has none. I am using a
couple days old mpl build.
-- 
Gökhan
From: Benjamin R. <ben...@ou...> - 2011年09月23日 19:22:35
On Fri, Sep 23, 2011 at 2:07 PM, Gökhan Sever <gok...@gm...> wrote:
> Hello,
>
> Considering this example plot:
> http://imageshack.us/photo/my-images/27/imagefki.png/
>
> How can I get the minor ticks showing correctly? (ie., 9 minor ticks per
> decade likewise for the x-axis)
>
> For some reason
>
> axis.set_minor_locator(LogLocator(numdecs=9) is not producing the desired
> output.
>
> Any hints?
>
> Thanks.
>
> --
> Gökhan
>
>
By default, setting the scale to log (e.g., ax.set_yscale('log')) should
automatically turn the minor ticks on for you. Note that depending on your
version of mpl, there may be a slight error in the documentation for
LogLocator.
Ben Root
From: Gökhan S. <gok...@gm...> - 2011年09月23日 19:08:03
Hello,
Considering this example plot:
http://imageshack.us/photo/my-images/27/imagefki.png/
How can I get the minor ticks showing correctly? (ie., 9 minor ticks per
decade likewise for the x-axis)
For some reason
axis.set_minor_locator(LogLocator(numdecs=9) is not producing the desired
output.
Any hints?
Thanks.
-- 
Gökhan
From: Benjamin R. <ben...@ou...> - 2011年09月23日 14:59:11
On Wednesday, September 21, 2011, Benjamin Root <ben...@ou...> wrote:
>
>
> On Wednesday, September 21, 2011, Keith Jones <K....@ir...> wrote:
>> Hi,
>>
>> I have two questions about using NavigationToolbar2Wx with mplot3d.
>>
>>
>>
>> 1/ Initially the 3D scatter plot will rotate as usual with a mouse, but
after selecting the ‘pan’ or ‘zoom’ buttons the plot responds with some
confusion. How can I restore it to rotation only, i.e. disconnect the zoom
or pan behaviour?
>>
>
> That is a bug that should be resolved in the upcoming release. Use the
right mouse button for zooming instead. In the upcoming release, the zoom
and pan button should have no effect on axes3d objects, if I remember
correctly.
>
>
>>
>>
>> 2/ When using the ‘save’ button I get different behaviours depending on
the backend. With ‘WXAgg’ the saved png image shows only the axes, not the
scatter points. The scatter points and axes do appear correctly in a pdf
file. Using the ‘WX’ backend gives both scatter points and axes for the png
file.
>>
>
> I dont use WxAgg regularly. I will use your code to test this.
>
> Ben Root
I could not reproduce your problem with WxAgg backend on the development
branch. I could only test on Linux, though. However, if there is a
difference between platforms with WxAgg backend, then it is likely a Wx bug
and not a mpl bug (although the fact that the Wx backend worked is odd).
We are putting out an RC of v1.1.0 later today. Could you try out that
version within the next few days and let me know if it still happens for
you?
Ben Root
From: Søren N. <sor...@gm...> - 2011年09月23日 14:58:36
Hi,
I have a canvas with two subplots on it and the user can pick curves on each
subplot (all lines are pickable). I have created the ability to hide one
subplot and only show one of the two. The remaining subplot is also enlarged
to fit the canvas. This is done using:
self.subplot1.set_visible(True)
self.subplot2.set_visible(False)
self.subplot1.change_geometry(1,1,1)
self.canvas.draw()
However, when I do that, its only possible to pick curves in the area where
the original subplot was located.. like it hasn't updated the geometry for
picking feature.
Is there a way for me to do this?
Thanks,
Soren
From: Tony Yu <ts...@gm...> - 2011年09月23日 14:09:15
On Fri, Sep 23, 2011 at 9:01 AM, Kurt Mueller <kur...@gm...
> wrote:
>
> Without the resize event it works as expected.
> With the resize event (as you suggested),
> it only adjusts the borders of the four axes to the outside of the figure.
> But between the axes there is no space at all.
>
> Do I miss something?
>
I think I was saying (I'm not certain, since it's been a while since the
original email) that the function (layout.tight) had to be called again
*after* resizing.
BTW, one of the matplotlib devs (Jae Joon Lee, I believe) completely
rewrote/improved this function and added it to matplotlib as
tight_layout<https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/figure.py#L1312>(both
as a pyplot function and a figure method). I'm not sure if the
function is in the current mpl release, but there's a pending release in the
works.
Best,
-Tony
From: Kurt M. <kur...@gm...> - 2011年09月23日 13:02:15
<quote author="Tony Yu-3">
A while back, I wrote some functions to calculate a good set of parameters for subplots_adjust (see attached; examples in if-main block at bottom). I've been using these functions pretty regularly, and it works pretty well for my purposes.
The function has to draw the figure a couple of times to calculate correct spacing. When redrawing the figure (e.g. when you resize the window), you'd have to re-call the function, which would redraw the figure a couple of times before drawing the final figure. That's all to say: this is a fairly slow function. If you don't have subplots (like in your example), you can call "layout.tight_borders()" (instead of "layout.tight()"), which only requires a single redraw.
When I originally posted this to the developers list, the functions didn't work with the GtkAgg backend. As far as I know, this hasn't changed. It should work fine for Qt4Agg, macosx, and TkAgg backends.
</quote>
Hi Tony,
I copied your layout.py.
Then run the following python script:
------------------------------------------------------
import matplotlib.pyplot as plt
import layout
import random
fontsizes = [8, 16, 24, 32]
def example_plot(ax):
 ax.plot([1, 2])
 ax.set_xlabel('x-label', fontsize=random.choice(fontsizes))
 ax.set_ylabel('y-label', fontsize=random.choice(fontsizes))
 ax.set_title('Title', fontsize=random.choice(fontsizes))
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2)
example_plot(ax1)
example_plot(ax2)
example_plot(ax3)
example_plot(ax4)
def on_resize(event):
 print( 'on_resize()' )
 layout.tight()
def on_close(event):
 print( 'on_close()' )
 fig.canvas.mpl_disconnect( rsiz_id )
 print rsiz_id
layout.tight()
if False:
#if True:
 rsiz_id = fig.canvas.mpl_connect('resize_event', on_resize)
 print rsiz_id
 fig.canvas.mpl_connect('close_event', on_close)
plt.show()
------------------------------------------------------
Without the resize event it works as expected.
With the resize event (as you suggested),
it only adjusts the borders of the four axes to the outside of the figure.
But between the axes there is no space at all.
Do I miss something?
Thanks a lot
Kurt
-- 
Kurt Mueller
From: yam850 <mu...@pr...> - 2011年09月23日 12:20:53
Tony Yu-3 wrote:
> 
> A while back, I wrote some functions to calculate a good set of parameters
> for subplots_adjust (see attached; examples in if-main block at bottom).
> I've been using these functions pretty regularly, and it works pretty well
> for my purposes. 
> 
> The function has to draw the figure a couple of times to calculate correct
> spacing. When redrawing the figure (e.g. when you resize the window),
> you'd have to re-call the function, which would redraw the figure a couple
> of times before drawing the final figure. That's all to say: this is a
> fairly slow function. If you don't have subplots (like in your example),
> you can call "layout.tight_borders()" (instead of "layout.tight()"), which
> only requires a single redraw.
> 
> When I originally posted this to the developers list, the functions didn't
> work with the GtkAgg backend. As far as I know, this hasn't changed. It
> should work fine for Qt4Agg, macosx, and TkAgg backends.
> 
Hi Tony,
I copied your layout.py.
Then run the following python script:
------------------------------------------------------
import matplotlib.pyplot as plt
import layout
import random
fontsizes = [8, 16, 24, 32]
def example_plot(ax):
 ax.plot([1, 2])
 ax.set_xlabel('x-label', fontsize=random.choice(fontsizes))
 ax.set_ylabel('y-label', fontsize=random.choice(fontsizes))
 ax.set_title('Title', fontsize=random.choice(fontsizes))
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2)
example_plot(ax1)
example_plot(ax2)
example_plot(ax3)
example_plot(ax4)
def on_resize(event):
 print( 'on_resize()' )
 layout.tight()
def on_close(event):
 print( 'on_close()' )
 fig.canvas.mpl_disconnect( rsiz_id )
 print rsiz_id
layout.tight()
if False:
#if True:
 rsiz_id = fig.canvas.mpl_connect('resize_event', on_resize)
 print rsiz_id
 fig.canvas.mpl_connect('close_event', on_close)
plt.show()
------------------------------------------------------
Without the resize event it works as expected.
With the resize event (as you suggested),
it only adjusts the borders of the four axes to the outside of the figure.
But between the axes there is no space at all.
Do I miss something?
Thanks a lot
Kurt
-- 
View this message in context: http://old.nabble.com/axis-labels-clipped-tp29738218p32503869.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Martijn <mar...@gm...> - 2011年09月23日 11:04:25
Hi,
I found that ndarray is the wrong class to use for this purpose. The
vector I created in the example below was just en uninitialised 3D
vector. Arrays cannot be subclassed:
class Vector(np.array):
	pass
returns an error. But using a matrix as base class works:
class Vector(np.matrix):
	def __abs__(self):
		l = np.sqrt(self*self.transpose())
		return(l[0,0])
V1 = Vector([1,2,2])
V2 = Vector([5,0,4])
print abs(V2-2*V1)
prints 5.0, as it should.
It is very crude (no check on dimensions!), but works.
Martijn
On Thu, 2011年09月22日 at 23:54 +0200, Martijn wrote:
> Hi,
> I am trying to create an ndarry subclass for vector calculations. The
> result is not what I intent:
> 
> import numpy as np
> 
> class Vector(np.ndarray):
> 	def __abs__(self):
> 		return(np.sqrt(sum(self**2)))
> 
> V = Vector([1,2,3])
> 
> print np.sqrt(sum(self**2))
> print abs(V)
> 
> I do not understand the docs at http://www.scipy.org/Subclasses but it
> is late now.
> 
> 
> Martijn
> 
> 
> P.S. I know this is not strictly matplotlib related, but since MP uses
> numpy so heavily, I felt free to ask.
> 
> 
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Kurt M. <kur...@gm...> - 2011年09月23日 06:58:17
Am 17.09.2011 18:49, schrieb Kurt Mueller:
> Am 17.09.2011 um 15:38 schrieb Jae-Joon Lee:
>> Thanks for reporting this.
>> I opened a pull request that I believe fixes this problem.
>> https://github.com/matplotlib/matplotlib/pull/472
> Thank you very much!
>> Please test this if you can.
> I hope next week.
I did a brief test.
(I added the three "if ax. ..." to the file gridspec.py in the matplotlib library.)
(matplotlib 1.0.1)
As far as I can tell is, that the unexpected effect did not occur any more.
I did not test it with shared axis.
>> Depending on your need, you may work around this by calling all the
>> set_position method always after all the GridSpec.update call.
In my programs I will use this approach until we move to a more recent matplotlib version.
Thanks
-- 
Kurt Mueller
From: gary r. <gr...@bi...> - 2011年09月23日 06:28:37
The dpi value, which can be overridden, will determine the size of the
output image. It looks to me like you just want the output to always
be the same size as your input image, so use imsave() instead of
imshow() followed by savefig() for this:
i.e. just do
map = Basemap(......)
pilImg = Image.open('bkgmap.gif')
rgba = pil_to_array(pilImg)
pyplot.imsave('outimg.png', rgba)
On Fri, Sep 23, 2011 at 9:10 AM, Isidora <is...@ju...> wrote:
> Hi,
>
> I am new to matplotlib so I may not have found the right answer because I am looking in the wrong places.
>
> I wrote a script to draw lines on a 800x600 pixels GIF background map. The output image I get is 620x450. Could someone let me know what I am doing wrong?
>
> Code Snippet:
>
> map = Basemap(......)
> pilImg = Image.open('bkgmap.gif')
> rgba = pil_to_array(pilImg)
> map.imshow(rgba)
> # Plot some lines and labels here
> ....
> pyplot.savefig('outimg.png',format='PNG',bbox_inches='tight',pad_inches=0)
>
>
> Thank you
>
>
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: William R. t. L. <me...@li...> - 2011年09月23日 02:36:45
LinkedIn
------------
 William Ratcliff ha chiesto di aggiungerti ai suoi collegamenti su LinkedIn:
 
------------------------------------------
Vorrei aggiungerti alla mia rete professionale su LinkedIn.
Accetta l'invito di William Ratcliff
http://www.linkedin.com/e/-b7qixr-gswk7oea-2f/_dML4GcZf3-2F5VO_wzm4ASVf0JrnPVO-ObO4eeHsZV8OPkmQwLeZN8i/blk/I3137892780_2/1BpC5vrmRLoRZcjkkZt5YCpnlOt3RApnhMpmdzgmhxrSNBszYOnP0UdP8Ve3sPcjd9bSF4qlhiemtBbPsQejAQcz4OcPgLrCBxbOYWrSlI/EML_comm_afe/?hs=false&tok=0Wg_wQR1SsTkU1
Visualizza l'invito di William Ratcliff
http://www.linkedin.com/e/-b7qixr-gswk7oea-2f/_dML4GcZf3-2F5VO_wzm4ASVf0JrnPVO-ObO4eeHsZV8OPkmQwLeZN8i/blk/I3137892780_2/39vc3wTczAUdPcNcQALqnpPbOYWrSlI/svi/?hs=false&tok=04ZxCHkESsTkU1 
------------------------------------------
SAPEVI CHE puoi usare il profilo di LinkedIn come se fosse il tuo sito Web? Seleziona un URL di reindirizzamento a un microsito e promuovi questo indirizzo sui tuoi biglietti da visita, nella firma di posta elettronica, sul tuo sito Web, ecc.
http://www.linkedin.com/e/-b7qixr-gswk7oea-2f/ewp/inv-21/?hs=false&tok=2AAzpjUy6sTkU1
 
-- 
(c) 2011, LinkedIn Corporation
From: Isidora <is...@ju...> - 2011年09月22日 23:12:46
Hi,
I am new to matplotlib so I may not have found the right answer because I am looking in the wrong places.
I wrote a script to draw lines on a 800x600 pixels GIF background map. The output image I get is 620x450. Could someone let me know what I am doing wrong?
Code Snippet:
map = Basemap(......)
pilImg = Image.open('bkgmap.gif')
rgba = pil_to_array(pilImg)
map.imshow(rgba)
# Plot some lines and labels here 
....
pyplot.savefig('outimg.png',format='PNG',bbox_inches='tight',pad_inches=0)
Thank you
From: Martijn <mar...@gm...> - 2011年09月22日 21:54:11
Hi,
I am trying to create an ndarry subclass for vector calculations. The
result is not what I intent:
import numpy as np
class Vector(np.ndarray):
	def __abs__(self):
		return(np.sqrt(sum(self**2)))
V = Vector([1,2,3])
print np.sqrt(sum(self**2))
print abs(V)
I do not understand the docs at http://www.scipy.org/Subclasses but it
is late now.
Martijn
P.S. I know this is not strictly matplotlib related, but since MP uses
numpy so heavily, I felt free to ask.
From: Benjamin R. <ben...@ou...> - 2011年09月22日 19:49:59
On Thu, Sep 22, 2011 at 2:31 PM, Andreas Matthias <
and...@gm...> wrote:
> I would like to plot a masked array with plot_surface().
> But unlike imshow() which really plots the masked data,
> plot_surface() only plots the non-masked data.
>
> How can I plot the masked array?
>
> Ciao
> Andreas
>
>
>
> import numpy as np
> import pylab as mpl
> from mpl_toolkits.mplot3d import axes3d
>
> x = np.arange(1,10,1)
> y = np.arange(1,10,1)
> x,y = np.meshgrid(x,y)
> z = x**3 + y**3 - 500
> z = np.ma.masked_array(z, z<0)
>
> cm = mpl.cm.jet
>
> ax1 = mpl.subplot(1,2,1, projection='3d')
> ax1.plot_surface(x,y,z,
> rstride=1, cstride=1, linewidth=0,
> cmap=cm)
>
> ax2 = mpl.subplot(1,2,2)
> ax2.imshow(z, cmap=cm)
>
> mpl.show()
>
>
Andreas,
I once had a patch I made for someone else with this request, but it broke a
bunch of things for regular uses of plot_surface, so I never added it. I
will see if I can dig it up for you as a work-around.
In the meantime, could you file a feature request for this in the github
tracker, please?
Ben Root
From: Andreas M. <and...@gm...> - 2011年09月22日 19:35:30
I would like to plot a masked array with plot_surface().
But unlike imshow() which really plots the masked data,
plot_surface() only plots the non-masked data.
How can I plot the masked array?
Ciao
Andreas
import numpy as np
import pylab as mpl
from mpl_toolkits.mplot3d import axes3d
x = np.arange(1,10,1)
y = np.arange(1,10,1)
x,y = np.meshgrid(x,y)
z = x**3 + y**3 - 500
z = np.ma.masked_array(z, z<0)
cm = mpl.cm.jet
ax1 = mpl.subplot(1,2,1, projection='3d')
ax1.plot_surface(x,y,z,
 rstride=1, cstride=1, linewidth=0,
 cmap=cm)
ax2 = mpl.subplot(1,2,2)
ax2.imshow(z, cmap=cm)
mpl.show()
From: Michael D. <md...@st...> - 2011年09月22日 14:59:30
I'm not able to reproduce the problem: I get the watermark in both png 
and pdf output. This was with git master.
What version of matplotlib are you using? Can you send (off-list) the 
png and pdf files so I can have a look at your output?
Mike
On 09/21/2011 10:28 AM, Dave Hirschfeld wrote:
> Is this a bug in the PDF/SVG backends or am I doing something wrong? If the
> former is there any workaround?
>
> The simple testcase below demonstrates the problem whereby the watermark doesn't
> show up in the pdf output but does in the png output.
>
> import Image
> from scipy import lena
> from scipy.ndimage import map_coordinates
> from cStringIO import StringIO
>
> def add_watermark(fig, watermark):
> import matplotlib.image as image
> im = image.imread(watermark)
> dpi = fig.get_dpi()
> offset = dpi*fig.get_size_inches()[0] - im.shape[1]
> fig.figimage(im, offset, 0, alpha=0.3)
> return fig
> #
>
> im = Image.fromarray(map_coordinates(lena(), mgrid[0:512:100j, 0:512:100j]))
> watermark = StringIO()
> im.save(watermark, format='png')
> watermark.seek(0)
>
> fig = figure(figsize=(12, 8))
> plot(randn(1000))
> add_watermark(fig, watermark)
> fig.savefig('test.png', dpi=fig.get_dpi())
> fig.savefig('test.pdf', dpi=fig.get_dpi())
>
> Thanks,
> Dave
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Armando S. L. <ars...@gm...> - 2011年09月22日 12:11:46
On Wed, Sep 21, 2011 at 9:28 PM, Benjamin Root <ben...@ou...> wrote:
> On Wed, Sep 21, 2011 at 2:00 PM, Armando Serrano Lombillo <
> ars...@gm...> wrote:
>
>> Hello I have a dat set like this one
>> a=[[x1, y1, cat1], [x2, y2, cat1], ..., [x8, y8, cat1], [x9, y9, cat2],
>> ..., [x34, y34, cat2], [x35, y35, cat3],...]
>> and I don't know beforehand how many diffferent categories there will be
>> or how long they will be.
>>
>> I would like to make a plot like this:
>> ax.plot(a[0:i1, 0], a[0:i1, 1], label=cat1)
>> ax.plot(a[i1:i2, 0], a[i1:i2, 1], label=cat2)
>> ax.plot(a[i2:i3, 0], a[i2:i3, 1], label=cat3)
>> ...
>>
>> where i1, i2... are the indices where the data set changes fomt cat1 to
>> cat2, cat2 to cat3...
>>
>> Does anybody see an easy way of coding this?
>>
>> Thanks,
>> Armando.
>>
>
> Maybe something like this? (Warning: untested!)
>
> from collections import OrderedDict
> b = OrderedDict()
> for index, coords in enumerate(a) :
> b[coords[2]] = index + 1
>
> a = np.array([[c[0], c[1]] for c in a])
>
> prevIndex = 0
> for cat, curIndex in b.iteritems() :
> ax.plot(a[prevIndex:curIndex, 0], a[prevIndex:curIndex, 1], label=cat)
> prevIndex = curIndex
>
> The ordered dictionary may or may not be available in whatever version of
> python you use, but it guarantees the order.
>
> I hope that helps!
> Ben Root
>
>
Ok, thanks Ben, I was thinking that maybe with some numpy array manipulation
there might have been a straightforward way I wasn't seeing.
Armando.
From: A. S. B. <ab...@gm...> - 2011年09月22日 08:47:38
Dear all,
I have some large data sets that I need to evaluate graphically. I
find the graph navigation tools (left-click and drag to pan,
right-click and drag to zoom) in matplotlib absolutely superb and I'd
like to be able to better use them with the large data sets.
At the moment, I'm achieving this by plotting subsets of the data to
browse and then when I've completed the assessment, plotting the next
subset of data. This is fairly laborious...
What I'd really like to do is have a matplotlib plot figure appear on
the screen and as I browse it would pass the limits to some callback
function which would provide the data to plot within those limits.
The callback function could then manage the memory a bit better and
only read a subset of the data out of the file at any one time.
Ideally, the figure would hold the data it had while you browse and
(maybe) when you release the mouse button it would get the new data.
The data might not look perfect when you zoom in, but it would quickly
refresh and therefore improve. The callback function could provide a
bit of extra data either side of the visible area on the screen to
make panning work.
Is this a mammoth task involving writing a rather complex application
that reimplements a lot of the matplotlib plotting stuff, or is it
something that can be done relatively easily with the API?
Thanks in advance,
Al
From: Stef M. <ste...@gm...> - 2011年09月21日 19:40:55
thanks Nicolas,
On 18-09-2011 19:25, Nicolas Rougier wrote:
>
>
> The interactive plot has been done using the AntTweakBar library and is not really user friendly. 
> You can view the source from the demos directory:
>
> http://code.google.com/p/glumpy/source/browse/demos/atb.py
>
I'll take a look,
> Also, note that glumpy is not a replacement for matplotlib but rather a testbed for a future 
> OpenGL backend to be integrated into matplotlib.
Yes but I'm an engineer and therefor not interested in high quality publication plots.
cheers,
Stef
>
> Nicolas
>
>
> On Sep 18, 2011, at 14:00 , Stef Mientki wrote:
>
>> hi Nicolas,
>>
>> looks very interesting.
>>
>> I was considering to move from MatPlotLib to guiqwt,
>> because of it's easy interactive plots.
>> But I see glumpy has it too.
>> Can show the source code for the interactive plot in your examples ?
>>
>> thanks,
>> stef
>>
>>
>> On 17-09-2011 19:22, Nicolas Rougier wrote:
>>>
>>> Hi folks,
>>>
>>> I am pleased to announce a new release of glumpy, a small python library for the (very) fast 
>>> vizualization of numpy arrays, (mainly two dimensional) that has been designed with efficiency 
>>> in mind. If you want to draw nice figures for inclusion in a scientific article, you’d better 
>>> use matplotlib but if you want to have a sense of what’s going on in your simulation while it is 
>>> running, then maybe glumpy can help you.
>>>
>>>
>>> Download and screenshots at: http://code.google.com/p/glumpy/
>>>
>>> Nicolas
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
>>> http://p.sf.net/sfu/rim-devcon-copy2
>>>
>>>
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>> ------------------------------------------------------------------------------
>> BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
>> http://p.sf.net/sfu/rim-devcon-copy2_______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Benjamin R. <ben...@ou...> - 2011年09月21日 19:28:53
On Wed, Sep 21, 2011 at 2:00 PM, Armando Serrano Lombillo <
ars...@gm...> wrote:
> Hello I have a dat set like this one
> a=[[x1, y1, cat1], [x2, y2, cat1], ..., [x8, y8, cat1], [x9, y9, cat2],
> ..., [x34, y34, cat2], [x35, y35, cat3],...]
> and I don't know beforehand how many diffferent categories there will be or
> how long they will be.
>
> I would like to make a plot like this:
> ax.plot(a[0:i1, 0], a[0:i1, 1], label=cat1)
> ax.plot(a[i1:i2, 0], a[i1:i2, 1], label=cat2)
> ax.plot(a[i2:i3, 0], a[i2:i3, 1], label=cat3)
> ...
>
> where i1, i2... are the indices where the data set changes fomt cat1 to
> cat2, cat2 to cat3...
>
> Does anybody see an easy way of coding this?
>
> Thanks,
> Armando.
>
Maybe something like this? (Warning: untested!)
from collections import OrderedDict
b = OrderedDict()
for index, coords in enumerate(a) :
 b[coords[2]] = index + 1
a = np.array([[c[0], c[1]] for c in a])
prevIndex = 0
for cat, curIndex in b.iteritems() :
 ax.plot(a[prevIndex:curIndex, 0], a[prevIndex:curIndex, 1], label=cat)
 prevIndex = curIndex
The ordered dictionary may or may not be available in whatever version of
python you use, but it guarantees the order.
I hope that helps!
Ben Root
From: Armando S. L. <ars...@gm...> - 2011年09月21日 19:01:06
Hello I have a dat set like this one
a=[[x1, y1, cat1], [x2, y2, cat1], ..., [x8, y8, cat1], [x9, y9, cat2], ...,
[x34, y34, cat2], [x35, y35, cat3],...]
and I don't know beforehand how many diffferent categories there will be or
how long they will be.
I would like to make a plot like this:
ax.plot(a[0:i1, 0], a[0:i1, 1], label=cat1)
ax.plot(a[i1:i2, 0], a[i1:i2, 1], label=cat2)
ax.plot(a[i2:i3, 0], a[i2:i3, 1], label=cat3)
...
where i1, i2... are the indices where the data set changes fomt cat1 to
cat2, cat2 to cat3...
Does anybody see an easy way of coding this?
Thanks,
Armando.
From: Eric O L. (EOL) <Eri...@no...> - 2011年09月21日 16:11:53
With the Mac OS X backend (at least...), error messages are repeatedly printed
when the mouse leaves the axes rectangle:
Traceback (most recent call last):
 File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backend_bases.py",
line 1625, in motion_notify_event
 self.callbacks.process(s, event)
 File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/cbook.py",
line 265, in process
 proxy(*args, **kwargs)
 File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/cbook.py",
line 191, in __call__
 return mtd(*args, **kwargs)
 File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backend_bases.py",
line 2573, in drag_zoom
 self.draw_rubberband(event, x, y, lastx, lasty)
 File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py",
line 420, in draw_rubberband
 self.canvas.set_rubberband(x0, y0, x1, y1)
TypeError: integer argument expected, got float
This problem is annoying because the error messages clutter the terminal,
and useful printed information leaves the screen. :)
Configuration: Mac OS X 10.7, latest MacPort's Python and modules,
Matplotlib 1.0.1 with Mac OS X backend.
-- 
View this message in context: http://old.nabble.com/Error-when-zooming-manually-with-the-mouse-outside-of-the-axes-tp32503759p32503759.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Benjamin R. <ben...@ou...> - 2011年09月21日 15:36:56
On Wednesday, September 21, 2011, Keith Jones <K....@ir...> wrote:
> Hi,
>
> I have two questions about using NavigationToolbar2Wx with mplot3d.
>
>
>
> 1/ Initially the 3D scatter plot will rotate as usual with a mouse, but
after selecting the ‘pan’ or ‘zoom’ buttons the plot responds with some
confusion. How can I restore it to rotation only, i.e. disconnect the zoom
or pan behaviour?
>
That is a bug that should be resolved in the upcoming release. Use the
right mouse button for zooming instead. In the upcoming release, the zoom
and pan button should have no effect on axes3d objects, if I remember
correctly.
>
>
> 2/ When using the ‘save’ button I get different behaviours depending on
the backend. With ‘WXAgg’ the saved png image shows only the axes, not the
scatter points. The scatter points and axes do appear correctly in a pdf
file. Using the ‘WX’ backend gives both scatter points and axes for the png
file.
>
I dont use WxAgg regularly. I will use your code to test this.
Ben Root
9 messages has been excluded from this view by a project administrator.

Showing results of 312

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