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






Showing 22 results of 22

From: C M <cmp...@gm...> - 2010年02月12日 22:24:15
I would like a custom formatter that does 3 things:
1) Blanks out all the values less than 0.
2) Chooses appropriate major ticks when zoomed out.
3) Shows an integer when the zoom scale is revealing multiple
integers, but shows a decimal number when it is just showing within
one integer; i.e. if it is 1, 2, 3, 4 in first case but 1.1, 1.2,
1.3, 1.4 in the second.
So far I have needs (1) and (2) of this with this super-simple custom formatter:
class MyFormatter(ScalarFormatter):
 def __call__(self, val, pos=None):
 if val < 0:
 return ''
 else:
 return int(val)
But how can I get need (3)? I need to know what the view_interval is
to set a rule for this. Something like:
if view_interval < 1:
 return val #this will be a decimal number
else:
 return int(val) #an integer
So how do I get the view_interval? I'm not understanding how to get
that from matplotlib.ticker.TickHelper()--if that is even the right
way to do it--because get_view_interval() is not a method of
TickHelper but of "DummyAxis", and at that point I've lost the idea.
Any help is appreciated. Thanks,
Che
From: C M <cmp...@gm...> - 2010年02月12日 22:15:23
On Fri, Feb 12, 2010 at 2:24 PM, Stan West <sta...@nr...> wrote:
>> From: C M [mailto:cmp...@gm...]
>> Sent: Wednesday, February 03, 2010 21:59
>>
>> I'm using autoscale_view for the y axis, but find with a marker size >
>> about 10, it will autoscale the graphs such that some markers are
>> bisected by the edges of the frame. I already have it set to:
>>
>>   self.subplot.autoscale_view(tight=False, scalex=False,
>> scaley=True)
>>
>> so I'd basically like "tight" here to be "even less tight". For
>> example, for a graph of time in minutes along the y axis, I'd like the
>> bottom of the graph to actually be a bit below zero to catch events
>> that are 0.5 min, etc., without them being half-buried under the edge
>> of the graph.
>>
>> Can autoscale_view be altered a bit to allow for a more generous view?
>
> For a similar requirement, I made the following custom locator:
Thank you. I've been playing around with a way to do this, and may
have something working now from my attempt to modify the
autoscale_view function in axes.py. My own re-write is below. It's
barely different from what is in the original function. It just gets
the two edges of the bounding box that contains all the lines and
moves them out a bit.
I would like to understand your approach better. So far, I can't get
your code to produce the "margins" indicated--but I'm probably
applying it wrongly. I don't know how to force an autoscale, for
example. Your code is tough for me to understand because there are a
number of things you make use of that I'm not familiar with yet. I
could ask a number of questions but don't want to burden the list with
that unless people are up for it.
Thanks,
Che
# autoscale_view function that allows looser edges.
 def loose_autoscale_view(self, subplot, margin, tight=False,
scalex=True, scaley=True):
 """
 autoscale the view limits using the data limits. You can
 selectively autoscale only a single axis, eg, the xaxis by
 setting *scaley* to *False*. The autoscaling preserves any
 axis direction reversal that has already been done.
 """
 # if image data only just use the datalim
 if not self.subplot._autoscaleon: return
 if scalex:
 xshared = self.subplot._shared_x_axes.get_siblings(self.subplot)
 dl = [ax.dataLim for ax in xshared]
 bb = mtransforms.BboxBase.union(dl)
 xdiff = bb.intervalx[1] - bb.intervalx[0]
 x0 = bb.intervalx[0]-xdiff * margin
 x1 = bb.intervalx[1]+xdiff * margin
 if scaley:
 yshared = self.subplot._shared_y_axes.get_siblings(self.subplot)
 dl = [ax.dataLim for ax in yshared]
 bb = mtransforms.BboxBase.union(dl)
 y0 = bb.intervaly[0]-(bb.intervaly[1]* margin)
 y1 = bb.intervaly[1]* (1+margin)
 if (tight or (len(self.subplot.images)>0 and
 len(self.subplot.lines)==0 and
 len(self.subplot.patches)==0)):
 if scalex:
 self.subplot.set_xbound(x0, x1)
 if scaley:
 self.subplot.set_ybound(y0, y1)
 return
 if scalex:
 XL = self.subplot.xaxis.get_major_locator().view_limits(x0, x1)
 self.subplot.set_xbound(XL)
 if scaley:
 YL = self.subplot.yaxis.get_major_locator().view_limits(y0, y1)
 self.subplot.set_ybound(YL)
#Then it would be called with:
 self.loose_autoscale_view(self.subplot, 0.02, tight=False,
scalex=True, scaley=True)
#where self.subplot is my axes object. (self is a panel class)
From: Stan W. <sta...@nr...> - 2010年02月12日 22:10:52
> From: C M [mailto:cmp...@gm...] 
> Sent: Wednesday, February 03, 2010 21:59
> 
> I'm using autoscale_view for the y axis, but find with a marker size >
> about 10, it will autoscale the graphs such that some markers are
> bisected by the edges of the frame. I already have it set to:
> 
> self.subplot.autoscale_view(tight=False, scalex=False, 
> scaley=True)
> 
> so I'd basically like "tight" here to be "even less tight". For
> example, for a graph of time in minutes along the y axis, I'd like the
> bottom of the graph to actually be a bit below zero to catch events
> that are 0.5 min, etc., without them being half-buried under the edge
> of the graph.
> 
> Can autoscale_view be altered a bit to allow for a more generous view?
For a similar requirement, I made the following custom locator:
----
import numpy as np
import matplotlib as mpl
import matplotlib.ticker as mticker
import matplotlib.transforms as mtransforms
class LooseMaxNLocator(mticker.MaxNLocator):
 def __init__(self, margin = 0.05, **kwargs):
 mticker.MaxNLocator.__init__(self, **kwargs)
 self._margin = margin
 def autoscale(self):
 dmin, dmax = self.axis.get_data_interval()
 if self._symmetric:
 maxabs = max(abs(dmin), abs(dmax))
 dmin = -maxabs
 dmax = maxabs
 dmin, dmax = mtransforms.nonsingular(dmin, dmax, expander = 0.05)
 margin = self._margin * (dmax - dmin)
 vmin = dmin - margin
 vmax = dmax + margin
 bin_boundaries = self.bin_boundaries(vmin, vmax)
 vmin = min(vmin, max(bin_boundaries[bin_boundaries <= dmin]))
 vmax = max(vmax, min(bin_boundaries[bin_boundaries >= dmax]))
 return np.array([vmin, vmax])
----
The *margin* argument controls the looseness. For a given axis *ax*, you
instantiate and apply the locator with something like
 ax.xaxis.set_major_locator(LooseMaxNLocator(nbins=7, steps=[1, 2, 5, 10]))
and likewise for the Y axis. I believe that if the plot has already been
drawn, you have to somehow force an autoscaling.
I wrote that about 1.5 years ago for an earlier version of matplotlib, and I
don't know how compatible it is with the current ticker.py code. In
particular, you might need to override *view_limits* instead of *autoscale*.
Anyway, I hope it's useful to you.
From: Gökhan S. <gok...@gm...> - 2010年02月12日 21:34:36
On Fri, Feb 12, 2010 at 10:37 AM, Wayne Watson <sie...@sb...
> wrote:
> I'm beginning to read aboutPython OOP, classes, inheritance and the like.
> It seems like an understanding of those concepts is key to understanding how
> the import needs are met.
>
> --
> "Crime is way down. War is declining. And that's far from the good news."
> -- Steven Pinker (and other sources) Why is this true, but yet the media
> says otherwise? The media knows very well how to manipulate us (see limbic,
> emotion, $$). -- WTW
>
I suggest you studying these books:
http://homepage.mac.com/s_lott/books/index.html
I learnt a great deal of information from the Python for Programmers title.
Besides you can take a look at Fernando's starter page at
http://fperez.org/py4science/starter_kit.html You can find many valuable
general Python sources listed there (especially tutorial videos from
PyCon09)
I can also suggest you trying Eclipse + PyDev combination. PyDev makes
debugging and following the flow of your programs very easier. For instance;
Try:
import matplotlib.pypot as plt
plt.plot(range(10))
plt.show()
and set a breakpoint in the first line and step into the matplotlib code to
see how it flows.
-- 
Gökhan
Hi! Originally, this was to be a question about where to get that described in the subject, but I realized: "hey, it's a yahoo! service and I haven't searched yahoo! yet"; sure enough I easily found:
http://www.gummy-stuff.org/Yahoo-data.htm
Jackpot! All the free, detailed numerical stock data one could ever need (of course, I don't know about its QA/QC, but hey, it's free!)
FWIW to others,
DG
PS: Short of canceling my subscription via this address and resubscribing my other one, is there another way to change my subscription address? Thanks!
 
From: Eric F. <ef...@ha...> - 2010年02月12日 18:49:40
Philipp Lies wrote:
> Hi,
> 
> is there a backend that supports 16bit tiff images?
Can you just use png, and use the netpbm utilities or ImageMagick 
convert program to go to and from tiff?
Eric
> According to the website GDK supports tiff but that's wrong:
> 
> >>>import matplotlib
> >>>matplotlib.use('GDK')
> >>>import matplotlib.pyplot as pyplot
> >>>pyplot.imsave(arr=X, fname='test.tif')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 1425, in 
> imsave
> return _imsave(*args, **kwargs)
> File "/usr/lib/pymodules/python2.6/matplotlib/image.py", line 813, in imsave
> fig.savefig(fname, dpi=1, format=format)
> File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 1033, in 
> savefig
> self.canvas.print_figure(*args, **kwargs)
> File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 
> 1420, in print_figure
> '%s.' % (format, ', '.join(formats)))
> ValueError: Format "tif" is not supported.
> Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz.
> >>>matplotlib.backends.backend
> 'gdk'
> 
> matplotlib 0.99.0 python 2.6.4 ubuntu karmic x64
> 
> If matplotlib cannot provide tiff support, does someone know an 
> alternative? PIL doesn't work either, at least not intuitively.
> 
> Cheers
> 
> Philipp
> 
From: Tomasz K. <t.k...@ci...> - 2010年02月12日 18:48:34
Hi
I would like to have a bar plot twice as heigh as it is wide. It seems 
though that setting the aspect ratio is nontrivial. I tried this:
 w, h = fig.figaspect (2.0)
 plt.figure().set_figheight (h)
 plt.figure().set_figwidth (w)
but then axis labels or even numbering gets cut off. On the other hand 
playing with:
plt.axes().set_aspect (2.0)
does amazingly strange things. The explanation about what the number 
in the set_aspect function should be is quite vogue in the 
documentation. Hence my questions:
How to specify the aspect ratio of a figure (in my case containing 
some bar plots) so that all remaining things (like axis labels) are 
respected in the final result?
Regards
Tomek
From: Jeremy C. <jlc...@gm...> - 2010年02月12日 18:38:45
On Fri, Feb 12, 2010 at 11:30 AM, C M <cmp...@gm...> wrote:
>> My biggest problem with matplotlib is that the smallest yticklabel and
>> the smallest xticklabel always seem to lie on top of each other (or
>> close to it). See attachment for example. Is there anyway to make it
>> so these don't lie on top of each other? How can I make this the
>> default behavior?
>>
>> Thanks,
>> Jeremy
>
> This was just asked a day or two ago, and here's how that went:
>
> http://old.nabble.com/x%2Cy-ticklabel-too-close-to27551389.html
Oops I didn't notice the other message. Sorry for asking again.
From: C M <cmp...@gm...> - 2010年02月12日 18:31:08
> My biggest problem with matplotlib is that the smallest yticklabel and
> the smallest xticklabel always seem to lie on top of each other (or
> close to it). See attachment for example. Is there anyway to make it
> so these don't lie on top of each other? How can I make this the
> default behavior?
>
> Thanks,
> Jeremy
This was just asked a day or two ago, and here's how that went:
http://old.nabble.com/x%2Cy-ticklabel-too-close-to27551389.html
I guess you could also change the LABELPAD value to bring the labels a
bit off the axes, so they can't collide, like:
axis.xaxis.LABELPAD = 8 #or however much you want
I don't know how you could make this default behavior, but making
matplotlib such that this was hard to do--instead of the
default--might be a useful improvement.
Che
From: Jeremy C. <jlc...@gm...> - 2010年02月12日 18:18:09
Attachments: Burunp.pdf
My biggest problem with matplotlib is that the smallest yticklabel and
the smallest xticklabel always seem to lie on top of each other (or
close to it). See attachment for example. Is there anyway to make it
so these don't lie on top of each other? How can I make this the
default behavior?
Thanks,
Jeremy
From: Christopher B. <Chr...@no...> - 2010年02月12日 17:31:24
Wayne Watson wrote:
> So here's my list of thing to do when I come back to it.
good plan, one comment:
> Determine if a better interpreter tool than IDLE would satisfy the end 
> users of the program I'm modifying. The hurdle is non-Python users who 
> just fire up IDLE and execute the program via F5.
This one is a no brainer -- IDLE is an Integrated Development 
Environment -- if you are not developing, you don't need it, t is NOT a 
tool to run simply run a python program. It's really not hard to run a 
python program.
Note that py2exe and friends might be the best solution -- these are 
tools that build a self-contained executable from a python program, so 
you end up with something to double click on, just like any other program.
I don't know about TkInter, but wxPython has an option where it will put 
up a message window to show the user standard output -- it sounds like 
you want the user to see messages, etc. Maybe TK has something similar.
Good luck,
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Wayne W. <sie...@sb...> - 2010年02月12日 17:17:48
I think I need a time out to consider my recent posts. This particular 
mod can wait while I get to other priority items into action again. So 
here's my list of thing to do when I come back to it.
Check out ipython more thoroughly.
Examine the backend concept
Read about the MPL interactive mode.
Look at the embedded app material in MPL.
Determine if a better interpreter tool than IDLE would satisfy the end 
users of the program I'm modifying. The hurdle is non-Python users who 
just fire up IDLE and execute the program via F5. That plus many are 
even reluctant to move from 2.4 to 2.5. New features could move that along.
Read the parts of the MPL Guide that I've culled out for my interests..
Attend a PUG meeting in the San Francisco Bay Area on the 25th.
Buy the (new) MPL book on Amazon if my local library can't get a loan of 
one of the two libraries in the US that has it.
Watch relevant videos from the 8th Annual Python in Science Conference
That should be enough, and should keep me busy when I expect to return 
to this in a few weeks. Thanks to the participants who responded to my 
posts.
-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW
From: Wayne W. <sie...@sb...> - 2010年02月12日 16:43:48
I'm beginning to read aboutPython OOP, classes, inheritance and the 
like. It seems like an understanding of those concepts is key to 
understanding how the import needs are met.
-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW
From: Yagua R. <yag...@gm...> - 2010年02月12日 16:04:40
Hello world!
I am displaying on my screen a set of data corresponding to points
defined by a longitude and latitude.
The display is fine with the command imshow (mydata ,...)
I would like now associate to the application a callback that draw a rectangle
on two consecutive left mouse's button press defined by its two
opposite vertices.
(also returns points) and a right click button that erases the rectangle.
I found the event_handling example, but I do not know how to do this.
May someone helps me?
Thank's a lot in advance.
Yagua
From: Filipe P. A. F. <oc...@gm...> - 2010年02月12日 15:15:36
Thanks for all the suggestions,
Spines did the trick.
JJ, I would like to be able to contribute more, but my python knowledge is
very limited and I'm still a very Matlab oriented person.
Anyways, maybe people here might be interested in my recent adventure
trying to learn python. I converted the CSIRO seawater library from matlab
to python.
http://www.cmar.csiro.au/datacentre/ext_docs/seawater.htm
I know that this is specific for oceanographers, but I saw some of us in
this list.
Thanks again, this list helped my a lot.
On Thu, Feb 11, 2010 at 12:40 PM, Filipe Pires Alvarenga Fernandes <
oc...@gm...> wrote:
> Hello list,
>
> For the following plotI using a large font for the tick-label that causes
> the first x,y tick-labels to overlap
>
> http://yfrog.com/5zimageykp
>
> for now I'm padding spaces to "fix" the plot, like this:
>
> newtick = ["-10 ", "-5 ", "0 ", "5 ", "10 "]
> pos =[-10, -5, 0, 5, 10]
> yticks(pos, newtick)
>
> However I was wondering if there is any automatic way to avoid or fix this
> overlap.
>
> Thanks, Filipe
>
From: dred <dou...@gm...> - 2010年02月12日 15:09:43
Not read it myself but 'Matplotlib for Python Developers' might be what
you're after - see review http://dalelane.co.uk/blog/?p=1222
Best way to learn Matplotlib is to use a good IDE like Spyder. I find it
much easier than IPython. http://code.google.com/p/spyderlib/
Installing Python(x,y) is the easiest way to set it all up.
Doug
Wayne Watson wrote:
> 
> 
> 
> 
> 
> 
> 
> Thanks for the info. I'm semi-resistant to ipython. I tried if for a
> few hours, and it seemed a bit too much like linux. Years ago I used
> linux a lot, and enjoyed it. I'll consider it. Windows is the game now. 
> 
> Yes, actual use is good, but the needed imports seem a bit baffling.
> scipy, pylab, matplotlib, ...? What components do I only need for a
> particular use? 
> 
> The videos you mentioned could be helpful. 
> 
> I do not belong to any group, and my small town is a long way from any
> educational resources.What I learn is from a few books, FAQs, and
> recently the MPL Guide. Within a 50 mile radius, I know exactly one
> other person who knows Python. He's a very bright high school student. 
> 
> On 2/9/2010 10:33 PM, Gökhan Sever wrote:
> 
> 
> On Tue, Feb 9, 2010 at 8:15 PM, Wayne Watson
> &lt; sie...@sb... &gt;
> wrote: 
> Subject
> is the question. 
> 
> As I see it, it's useful to know MatLab. A simple query with matplotlib 
> tutorial shows a number of hits. The first, reference to v0.99.a 
> documentation barely qualifies. Examples galore and a pretty minimal 
> introduction. In the first 10 or so hits ther's a blog and mention of a 
> video. The blog may appeal to some, but it seems unelementary. The video 
> basically asks to sign in. Who knows where that goes? I've seen a few 
> videos for MPL, but they all look tied into $$. 
> 
> I've made some reasonable progress on MPL, but am still far short of 
> being confident of using it. Too much try this and see. 
> 
> I know of exactly one book on MPL ( for scientists. sounds interesting). 
> It was published recently by a foreign author. It is not yet widely 
> distributed. 
> 
> Your turn. Comments? 
> -- 
> "Crime is way down. War is declining. And that's far from the good 
> news." -- Steven Pinker (and other sources) Why is this true, but yet 
> the media says otherwise? The media knows very well how to manipulate us 
> (see limbic, emotion, $$). -- WTW 
> 
> 
> 
> ------------------------------------------------------------------------------ 
> SOLARIS 10 is the OS for Data Centers - provides features such as
> DTrace, 
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW 
> http://p.sf.net/sfu/solaris-dev2dev 
> _______________________________________________ 
> Matplotlib-users mailing list 
> Mat...@li... 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users 
> 
> 
> 
> 
> 
> For me best way to learn is to use it actually :) Especially on
> homework and projects. Mailing lists are also very helpful as you are
> already doing. 
> 
> Try with ipython --pylab option. 
> 
> Also check SciPy09 ( http://conference.scipy.org/SciPy2009/ )
> videos. There are one introductory and advanced tutorials that you can
> see online (without registering) or downloading to your computer. 
> 
> 
> 
> -- 
> Gökhan 
> 
> 
> -- 
> "Crime is way down. War is declining. And that's far from the good
> news." -- Steven Pinker (and other sources)
> Why is this true, but yet the media says otherwise? The media
> knows very well how to manipulate us (see limbic, emotion, $$). -- WTW 
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/How-Does--One-Learn-to-Use-MatPlotLib--tp27525289p27564958.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Bruce F. <br...@cl...> - 2010年02月12日 14:11:27
Thanks for this. I didn't realize that N could be an array and
contour would know that these are the levels desired.
I found similar in an example, but not in the contour documentation.
Thanks so much!
Bruce
---------------------------------------
Bruce W. Ford
Clear Science, Inc.
br...@cl...
bru...@na...
http://www.ClearScienceInc.com
Phone/Fax: 904-379-9704
8241 Parkridge Circle N.
Jacksonville, FL 32211
Skype: bruce.w.ford
Google Talk: fo...@gm...
On Fri, Feb 12, 2010 at 7:29 AM, Matthias Michler
<Mat...@gm...> wrote:
> Hi Bruce,
>
> why don't you use contour as in the following ;-)
>
> contour(X,Y,Z,V)
> # -> draw contour lines at the values specified in sequence *V*
>
> like in
>
> x, y = np.meshgrid(np.linspace(0, 1, 100), np.linspace(0, 1, 50))
> z = x**4 - x**2 + np.sin(y)
> contour(x, y, z, [-0.2, 0.0, 0.2, 0.4, 0.6, 0.8])
>
> Kind regards,
> Matthias
>
> On Thursday 11 February 2010 21:58:15 Bruce Ford wrote:
>> In using the contour as in:
>>
>> contour(X,Y,Z,N)
>>
>> N is a number of automatically chosen levels.
>>
>> I would like to contour based on data divisions.
>>
>> For instance, perhaps I'd like to use a contour or color-fill
>> (contourf) every 2 units. I'm not seeing how to accomplish this. Any
>> points in the right direction would be appreciated.
>>
>> Thanks!
>>
>> Bruce
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Stephan M. <zw...@we...> - 2010年02月12日 13:55:26
Calling the garbage collector (gc.collect()) also makes no difference.
Even deleting all references manually and dropping the toolbar code
doesn't do the trick.
Am 09.02.2010 16:19, schrieb Stephan Markus:
> I already had my destroy() method look like this:
>
> def destroy(self):
> self.f.clf()
> Tix.Frame.destroy(self)
> self.toolbar.destroy()
> self.canvas._tkcanvas.destroy()
>
>
> But it makes no difference.
>
> Stephan
>
> Am 08.02.2010 17:15, schrieb Michael Droettboom:
> 
>> Have you tried explicitly calling .clf() on the matplotlib Figure object from your Tix.Frame.destroy callback?
>>
>> Mike
>>
>> 
>> 
From: Philipp L. <phi...@tu...> - 2010年02月12日 10:55:00
Hi,
is there a backend that supports 16bit tiff images?
According to the website GDK supports tiff but that's wrong:
 >>>import matplotlib
 >>>matplotlib.use('GDK')
 >>>import matplotlib.pyplot as pyplot
 >>>pyplot.imsave(arr=X, fname='test.tif')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 1425, in 
imsave
return _imsave(*args, **kwargs)
File "/usr/lib/pymodules/python2.6/matplotlib/image.py", line 813, in imsave
fig.savefig(fname, dpi=1, format=format)
File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 1033, in 
savefig
self.canvas.print_figure(*args, **kwargs)
File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 
1420, in print_figure
'%s.' % (format, ', '.join(formats)))
ValueError: Format "tif" is not supported.
Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz.
 >>>matplotlib.backends.backend
'gdk'
matplotlib 0.99.0 python 2.6.4 ubuntu karmic x64
If matplotlib cannot provide tiff support, does someone know an 
alternative? PIL doesn't work either, at least not intuitively.
Cheers
Philipp
-- 
Philipp Lies
Max Planck Institute for Biological Cybernetics
Computational Vision & Neuroscience Group
Spemannstr. 41
D-72076 Tuebingen
Germany
Phone: +49-7071-601-1788
Fax: +49-7071-601-552
E-Mail: phi...@tu...
http://www.kyb.mpg.de/bethgegroup
From: Geoff B. <geo...@gm...> - 2010年02月12日 09:44:06
On Thu, Feb 11, 2010 at 4:58 PM, John Hunter <jd...@gm...> wrote:
> On Thu, Feb 11, 2010 at 9:43 AM, Geoff Bache <geo...@je...> wrote:
>>
>> Hi all,
>>
>> I'm trying to generate graphs from my test results, with regions
>> coloured with succeeded and failing tests. It nearly works, but I have
>> the following problem. I am providing the data with fill_between, which
>> returns PolyCollection objects which cannot be provided to a legend. So
>> I use the "proxy artist" trick, as described here
>>
>> http://matplotlib.sourceforge.net/users/legend_guide.html#plotting-guide-legend
>>
> The only reason fill_between uses a PolyCollection is to support the
> "where" keyword argument for non-contiguous fill regions, which you do
> not appear to be using.
Actually, not using it wasn't out of choice. I couldn't figure out how
to make it stop plotting at one point at start again at the next. In
my example, is there a way to plot the red regions using a single call
and "where"? I tried this
where = [False, True, True, True, False, True]
axessubplot4.fill_between([0, 1, 2, 3, 4, 5], [2, 2, 2, 8, 8, 15], [2,
2, 4, 8, 8, 18], where=where, color='#FF3118', linewidth=2,
linestyle='-')
but that fails to plot either to or from point 4, whereas actually I
just want it to leave out the region between points 3 and 4 (where the
values are equal)
Regards,
Geoff
From: Brendan B. <bre...@br...> - 2010年02月12日 08:32:13
	I'm trying to find the quickest way to erase a rectangular area of 
the figure canvas. I tried using canvas.restore_region with the 
optional bbox argument, but there seems to be some mismatch between 
the measurement units of the saved buffer object and the currently 
shown data. For instance, if I have a Text object on my plot, I tried 
this:
bbox = g.text.get_window_extent()
canvas.restore_region(background, bbox)
. . . but it does not correctly block out the text. (The restored 
rectangle from the background appears elsewhere on the axes.) How can 
I convert the buffer coordinates to the coordinates of the the 
displayed plot?
	I also tried creating a patch with the same bounds as the text bbox 
and adding it to the axes, but this seems to have no effect. Do I 
have to do something besides ax.draw_artist(mypatch) to get it to draw?
	This is part of the same thing I posted about a few days ago with 
trying to do an animation with many moving parts. Are there any 
examples of animations which do not involve restoring the entire 
background with each draw, but rather individually erasing individual 
elements in the plot and redrawing them elsewhere? That's what I'm 
trying to do here.
Thanks,
-- 
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is 
no path, and leave a trail."
 --author unknown
From: Geoff B. <geo...@gm...> - 2010年02月12日 07:59:32
Many thanks for the suggestions, will try these out today.
Incidentally, it looks like there is an interesting bug in the mail
archive software. Viewing my original message there I can see that it
has removed all instances of the combination "pre" (that's p then r
then e if it eats this too!). It does this even in the middle of
words, such as "previous", "appreciate" etc.
Regards,
Geoff
On Thu, Feb 11, 2010 at 6:44 PM, Jae-Joon Lee <lee...@gm...> wrote:
> Or, you may fool the algorithm to find the best location by adding
> invisible lines.
> For example,
>
> axessubplot4.set_autoscale_on(False)
> l1, = axessubplot4.plot([4, 5], [8, 18])
> l1.set_visible(False)
> axessubplot4.set_autoscale_on(True)
>
> Regards,
>
> -JJ
>
>
> On Thu, Feb 11, 2010 at 10:58 AM, John Hunter <jd...@gm...> wrote:
>> On Thu, Feb 11, 2010 at 9:43 AM, Geoff Bache <geo...@je...> wrote:
>>>
>>> Hi all,
>>>
>>> I'm trying to generate graphs from my test results, with regions
>>> coloured with succeeded and failing tests. It nearly works, but I have
>>> the following problem. I am providing the data with fill_between, which
>>> returns PolyCollection objects which cannot be provided to a legend. So
>>> I use the "proxy artist" trick, as described here
>>>
>>> http://matplotlib.sourceforge.net/users/legend_guide.html#plotting-guide-legend
>>>
>>
>> What about creating a proxy artist which is a simple polygon that has
>> the same outline as your fill_between polygon?
>>
>>
>> In [539]: t = np.arange(0, 1, 0.05)
>>
>> In [540]: y = np.sin(2*np.pi*t)
>>
>> In [541]: verts = zip(t, y)
>>
>> In [542]: proxy = mpatches.Polygon(verts, facecolor='yellow')
>>
>> The only reason fill_between uses a PolyCollection is to support the
>> "where" keyword argument for non-contiguous fill regions, which you do
>> not appear to be using. Thus you could simply create the polygon
>> yourself with a little calculation (see mlab.poly_between for a helper
>> function) and then just add that patch to the axes rather than using
>> fill_between::
>>
>> t = np.arange(0, 1, 0.05)
>> ymin = np.sin(2*np.pi*t)-5
>> ymax = np.sin(2*np.pi*t)+5
>> xs, ys = mlab.poly_between(t, ymin, ymax)
>> verts = zip(xs, ys)
>> poly = mpatches.Polygon (verts, facecolor='red', label='my poly')
>> ax = subplot(111)
>> ax.add_patch(poly)
>> ax.legend(loc='best')
>> ax.axis([0, 1, -6, 6])
>> plt.draw()
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
4 messages has been excluded from this view by a project administrator.

Showing 22 results of 22

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