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






Showing 22 results of 22

From: Jonathan S. <js...@cf...> - 2010年10月22日 20:25:42
Is there some way to get minor tick marks on plots by default? I can
do:
plt.minorticks_on()
easily enough, but it seems that there is no setting I can put in my
matplotlibrc file that will give me them by default. Is that right?
Jon
From: Ryan M. <rm...@gm...> - 2010年10月22日 18:40:07
On Fri, Oct 22, 2010 at 11:31 AM, Maarten Sneep <maa...@kn...> wrote:
> On Fri, 2010年10月22日 at 11:12 -0500, Ryan May wrote:
>> On Fri, Oct 22, 2010 at 9:40 AM, Christopher Fonnesbeck
>>
>> > If there are only 7 possible values of the data, which are
>> evenly-spaced, it should probably not go in and create more than 6
>> bins as the default behavior. I know I can specify bins by hand, but
>> when automated it would be nice to have a more sensible default.
>>
>> It just defaults to creating 10 bins (which is identical to
>> numpy.histogram, which is what does the work under the hood.) If you
>> know how many bins you want, you can just do:
>>
>> hist(x, bins=6)
>>
>> This gives (for your example) the behavior you seem to want. I don't
>> know of any way that would sensibly choose a number of bins
>> automatically, but I'd consider a patch that proves me wrong. :)
>
> I'm moving on from IDL. From that background I used the Coyote library
> quite a bit, and there I found:
>
>  binsize = (3.5 * numpy.std(data)) / len(data)**(0.3333)
>
> (from http://www.dfanning.com/programs/histoplot.pro known as Scott's
> Choice of bin size for histograms).
Thanks for that. This actually led me here:
http://en.wikipedia.org/wiki/Histogram which gives a bunch of
different ways to estimate the number of bins/binsize. It might be
worth looking at one of these in general. However, ironically enough,
these wouldn't actually give the original poster the desired
results--the binsizes would lead to lots of bins, many of which would
be empty due to the integer data. In fact, it seems that all of these
methods are going to break down due to integer data. I guess you could
take the ceiling of the calculated binsize...anyone have an opinion on
whether calculating binsize/nbins would be a step forward over leaving
the default (of 10) and letting the user calculate if they like?
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: ny <nik...@gm...> - 2010年10月22日 17:33:06
Hi,
I am trying to install matplotlib on Mac Os 10.6.x without any success.
I am on *Snow Leopard w/ g++ --version i686-apple-darwin10-g++-4.2.1 (GCC)
4.2.1*
I am following the steps described below:
http://sites.google.com/site/michaelsafyan/setup-guide/mac-os-x-10-6-snow-leopard
see *Python_Setup**.*
**So, I install *Python 2.6.6 *since NumPy and SciPy and do not comply with
newer Python 2.7.x releases.
I test *NumPy 1.5.1rc1 and SciPy 0.8.0* and the configuration is OK for both
(I get only a few failures
after using *python -c 'import numpy; numpy.test()' & python -c 'import
scipy; scipy.test()'*
respectively).
When I am trying to install *matplotlib 1.0.0,* I get the following
warnings
*/usr/include/AvailabilityMacros.h:108:14: *
*warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4
is invalid.*
*
*
but it compiles. However, when I test matplotlib 1.0.0 with a trivial module
*>>> import demo_axes_divider.py*
*
*
I get
*
*
*traceback (most recent call last):*
* File "<stdin>", line 1, in <module>*
* File "demo_axes_divider.py", line 1, in <module>*
* import matplotlib.pyplot as plt*
* File
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pyplot.py",
line 23, in <module>*
* from matplotlib.figure import Figure, figaspect*
* File
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py",
line 18, in <module>*
* from axes import Axes, SubplotBase, subplot_class_factory*
* File
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py",
line 14, in <module>*
* import matplotlib.axis as maxis*
* File
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py",
line 10, in <module>*
* import matplotlib.font_manager as font_manager*
* File
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py",
line 52, in <module>*
* from matplotlib import ft2font*
*ImportError:
dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so,
2):
 Symbol not found: _FT_Attach_File*
* Referenced from:
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so
*
* Expected in: dynamic lookup*
It turns out that *Freetype2 *feature is a required dependency for
matplotlib.
I install FontForge via macports (
http://openfontlibrary.org/wiki/How_to_install_FontForge)
so that Freetype2 is enabled.
Now I clean-up and re-install everything from scratch as mentioned here
http://www.mail-archive.com/mat...@li.../msg17448.html,
but the problem persists (also that user does not seem to have resolved the
issue).
So, any hints on what's wrong?
Many thanks!
N
From: Stan W. <sta...@nr...> - 2010年10月22日 17:27:53
> From: Ruggero [mailto:giu...@gm...] 
> Sent: Thursday, October 21, 2010 17:59
> 
> I want to merge axes from f1 and f2 in a unique axes (withou splitting
> the figure). For example if f1 produces a line and f2 produces another
> line I want to see two lines in the same plot at the end.
If you can modify the functions slightly, perhaps having an optional axes
parameter would accomplish what you want:
 def f1(axes=None):
 if axes is None:
 axes = plt.figure().add_subplot(1, 1, 1)
 # Now plot into the axes
 # Likewise for f2
 # Plot separately
 f1()
 f2()
 # Plot together
 axes = plt.figure().add_subplot(1, 1, 1)
 f1(axes=axes)
 f2(axes=axes)
From: Alan G I. <ai...@am...> - 2010年10月22日 17:24:55
On 10/22/2010 12:39 PM, Stan West wrote:
> markerline.set_zorder(markerline.get_zorder() + 0.1)
Nice idea.
Thanks,
Alan
From: Maarten S. <maa...@kn...> - 2010年10月22日 17:06:43
On Fri, 2010年10月22日 at 11:12 -0500, Ryan May wrote:
> On Fri, Oct 22, 2010 at 9:40 AM, Christopher Fonnesbeck
>
> > If there are only 7 possible values of the data, which are
> evenly-spaced, it should probably not go in and create more than 6
> bins as the default behavior. I know I can specify bins by hand, but
> when automated it would be nice to have a more sensible default.
> 
> It just defaults to creating 10 bins (which is identical to
> numpy.histogram, which is what does the work under the hood.) If you
> know how many bins you want, you can just do:
> 
> hist(x, bins=6)
> 
> This gives (for your example) the behavior you seem to want. I don't
> know of any way that would sensibly choose a number of bins
> automatically, but I'd consider a patch that proves me wrong. :)
I'm moving on from IDL. From that background I used the Coyote library
quite a bit, and there I found:
 binsize = (3.5 * numpy.std(data)) / len(data)**(0.3333)
(from http://www.dfanning.com/programs/histoplot.pro known as Scott's
Choice of bin size for histograms).
>From the binsize and the range of the data, you then figure out an axis
for the histogram).
Maarten
-- 
KNMI, De Bilt
T: 030 2206 747
E: Maa...@kn...
Room B 2.42
From: Stan W. <sta...@nr...> - 2010年10月22日 16:41:07
> From: Alan G Isaac [mailto:ai...@am...] 
> Sent: Thursday, October 14, 2010 19:12
> 
> ax.stem(x, y, '-.') draws the stem second,
> so that it is visible on top of the dot.
> 
> Is this intentional?
> (I think it looks better with the dot on top.)
> How to reverse?
I would usually place the dot on top, too. The stacking is determined by the
order of the plot commands in the stem method, but you could modify the zorder
[1] of the objects after the fact to order them as you like:
 markerline, stemlines, baseline = axes.stem(x, y, '-.')
 markerline.set_zorder(markerline.get_zorder() + 0.1)
[1] http://matplotlib.sourceforge.net/examples/pylab_examples/zorder_demo.html
From: Gökhan S. <gok...@gm...> - 2010年10月22日 16:30:46
On Fri, Oct 22, 2010 at 6:26 AM, Jae-Joon Lee <lee...@gm...> wrote:
> On Thu, Oct 21, 2010 at 4:31 AM, Gökhan Sever <gok...@gm...> wrote:
>> How could I change the appearance of the legend symbol in this case?
>> It auto-uses a patch object (rectangle in this case).
>> I would like to get a straight line instead.
>
> You may use proxy artists.
>
> http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
>
> Regards,
>
> -JJ
>
Thanks for the suggestion JJ.
I have actually changed my initial approach. Now I am just using
colored text to create pseudo-legends, like shown below:
ax1.text(0.40, 0.8, "Cloud-base", fontsize=14, transform=ax1.transAxes)
ax1.text(0.40, 0.7, "BallVario", fontsize=14, color='b',
transform=ax1.transAxes)
ax1.text(0.40, 0.6, "AIMMS", fontsize=14, color='g', transform=ax1.transAxes)
By the way, from the linked construct, changing width and height of
the rectangle doesn't have any affect.
p = Rectangle((0, 0), 1, 1, fc="r")
legend([p], ["Red Rectangle"])
p = Rectangle((0, 0), 10.0, 2.0, fc="r")
plt.legend([p], ["Red Rectangle"])
or making trying a smaller rectangle:
p = Rectangle((0, 0), 0.2, 1, fc="r")
plt.figure(); plt.legend([p], ["Red Rectangle"])
-- 
Gökhan
From: Stan W. <sta...@nr...> - 2010年10月22日 16:24:41
> From: Brian J. Soher [mailto:bs...@br...] 
> Sent: Thursday, October 14, 2010 10:27
> 
> I'm using matplotlib 0.98.5.2, wxPython version 2.8-msw-unicode, on 
> Windows XP Professional x64 at work (and 32bit at home). At work I 
> have a plain old Dell 2 button mouse with a scroll wheel which you 
> can scroll or click as a middle mouse button. At home I have an 
> equivalent mouse from Logitec. Both mice exhibit useful 
> functionality for the "middle button" in browsers. And I did install 
> the latest Logitec drivers at home and specifically set the scroll 
> click to have the functionality of a middle mouse button.
> 
> In all cases, home or work, I failed to detect a middle mouse button 
> press or release event.
> 
> I've attached an example program and copied the text below.
> 
> If anyone could please check to see if this is happening for them, or 
> has any idea how to fix this, I'd very much appreciate it.
Hi, Brian. Your code reports left, middle, and right button events for me
with the same wx version but with matplotlib 1.0.0 on Windows 7 Pro x64. Do
you have the option of trying a more recent matplotlib?
From: Robert K. <rob...@gm...> - 2010年10月22日 16:20:18
On 10/22/10 6:28 AM, Matthew Matic wrote:
>
> I'm trying to get a delaunay triangulation of a set of points on the surface
> of the torus. I'm using matplotlib.delaunay, but it seems to only give the
> triangulation for a flat surface. Is there any way to tell it to take the
> periodic boundary conditions into account, or alter the points I input such
> that matplotlib.delaunay interprets them as being on the surface of the
> torus.
Having said that, assuming your points are reasonably dense, then you can simply 
repeat your points 9 (or 25) times in a tiled grid, then pull out the center. 
That's probably close enough. There's some bookkeeping left as an exercise for 
the reader, but it's nothing unreasonable.
-- 
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
 -- Umberto Eco
From: Robert K. <rob...@gm...> - 2010年10月22日 16:14:05
On 10/22/10 6:28 AM, Matthew Matic wrote:
>
> I'm trying to get a delaunay triangulation of a set of points on the surface
> of the torus. I'm using matplotlib.delaunay, but it seems to only give the
> triangulation for a flat surface. Is there any way to tell it to take the
> periodic boundary conditions into account, or alter the points I input such
> that matplotlib.delaunay interprets them as being on the surface of the
> torus.
No, there isn't.
-- 
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
 -- Umberto Eco
From: Ryan M. <rm...@gm...> - 2010年10月22日 16:12:45
On Fri, Oct 22, 2010 at 9:40 AM, Christopher Fonnesbeck
<sta...@me...> wrote:
> On Oct 22, 2010, at 9:13 AM, Ryan May wrote:
>>
>> On Fri, Oct 22, 2010 at 8:47 AM, Christopher Fonnesbeck
>> <sta...@me...> wrote:
>>> I notice that when the number of bins in a histogram is sparse, the spacing between the bins can be irregular. For example:
>>>
>>> http://cl.ly/7e0ad7039873d5446365
>>> http://cl.ly/c7cb20b567722928ac3c
>>>
>>> Is there a way of normalizing this, and better, can the default behavior result in something more consistent (i.e. publication-quality)?
>>
>> That looks like some bizarre rounding/truncation or something like it.
>> Can you post an example (can just use made up data) that reproduces
>> this? I've not seen this before, so I sense it's due to the specific
>> data types you're passing in.
>
> Here is a very simple example. The data are just a list of integers:
>
> http://dl.dropbox.com/u/233041/histexample.py
>
> and it results in an odd choice of intervals.
>
> (array([863, 775,  0, 271,  0, 67, 23,  0,  0,  1]),
> array([ 0. , 0.6, 1.2, 1.8, 2.4, 3. , 3.6, 4.2, 4.8, 5.4, 6. ]),
> <a list of 10 Patch objects>)
>
> If there are only 7 possible values of the data, which are evenly-spaced, it should probably not go in and create more than 6 bins as the default behavior. I know I can specify bins by hand, but when automated it would be nice to have a more sensible default.
It just defaults to creating 10 bins (which is identical to
numpy.histogram, which is what does the work under the hood.) If you
know how many bins you want, you can just do:
hist(x, bins=6)
This gives (for your example) the behavior you seem to want. I don't
know of any way that would sensibly choose a number of bins
automatically, but I'd consider a patch that proves me wrong. :)
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Gökhan S. <gok...@gm...> - 2010年10月22日 15:14:14
On Fri, Oct 22, 2010 at 1:47 AM, Dmitry Vinokurov <df...@gm...> wrote:
> Hello,
>
> When I plot graph with values 10^5 and more at y axis, the labels are
> too long and run out of the picture borders. So I get "600000" instead
> of "1600000" at y axis or something like this. Tried to use
> ====
> majorFormatter = ticker.FormatStrFormatter('%e')
> ax.yaxis.set_major_formatter(majorFormatter)
> ====
> but it became even worse -- "00e+00", "00e+05", "00e+06", i.e. first
> digits run out of picture border or I see only part of digit.
>
> Is it possible to make matplotlib automatically change picture size due
> to it's content? Or maybe there is some other way to solve my problem?
>
> Thanks.
Simply you can log scale your axes for such big ranges. Other
alternative would be shifting your subplot to left using figure
subplots_adjust function. Both Wx and Qt4 backends provide graphical
access to this function on navigation toolbar, so you can first
experiment to make the visual fit your need (If you use WX backend
actually you can see the numeric values to use in subplots_adjust
function).
You can also follow this thread:
http://old.nabble.com/scientific-notation-in-ticklabels-for-linear-plot-td29993489.html
to make fancier adjustments to tick labels.
-- 
Gökhan
From: Lorenzo I. <lor...@gm...> - 2010年10月22日 14:56:37
Dear All,
Please consider the snippet at the end of the email.
Admittedly, I am still quite cumbersome with the matplotlib pipeline
(I am a bit unsure about how to manipulate objects and their
properties).
The snippet below produces two plots. I have some questions
(1) for both plots: how do I add some text to the plot(possibly in
latex) in a specified position and fine-tune its properties (size,
bold etc...)?
(2) Last generated plot: I would like to have arrows like in the
previous plot, just rotated by 90 degrees so that they hit the red
areas at the north and south poles. However, this does not look
possible right now without shortening the arrows (there is not enough
vertical space; somehow the whole aspect ratio of the plot+boundary is
not 1). Any suggestions about how to fix this?
Many thanks
Lorenzo
####################################################################################33
 #!/usr/bin/env python
"""
See pcolor_demo2 for a much faster way of generating pcolor plots
"""
from __future__ import division
from pylab import *
def func3(x,y):
 return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)
def func4(x,y):
 theta=arcsin(y)
 return cos(theta)
def func5(x,y):
 return abs(sin(y))
def func6(x,y):
 return abs(cos(y))
# make these smaller to increase the resolution
dx, dy = 0.05, 0.05
# x = arange(-1.0, 1.0, dx)
# y = arange(-1.0, 1.0, dy)
x = arange(-pi/2., pi/2., dx)
y = arange(-pi/2., pi/2., dy)
X,Y = meshgrid(x, y)
Z = func6(X, Y)
# print "Z is, ", Z
ini=pi/2.+0.5
ax = subplot(111)
ax.axis('off')
im = imshow(Z,cmap=cm.jet, extent=(-pi/2., pi/2., -pi/2., pi/2.))
im.set_interpolation('bilinear')
im.set_clip_path(Circle((0,0),pi/2., transform=ax.transData))
annotate("", xy=(-pi/2., 0), xytext=(-ini, 0), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., .2), xytext=(-ini, .2), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -.2), xytext=(-ini, -.2), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., .4), xytext=(-ini, .4), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -.4), xytext=(-ini, -.4), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., .6), xytext=(-ini, .6), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -.6), xytext=(-ini, -.6), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., .8), xytext=(-ini, .8), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -.8), xytext=(-ini, -.8), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., 1), xytext=(-ini, 1), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -1), xytext=(-ini, -1), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., 1.2), xytext=(-ini, 1.2), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -1.2), xytext=(-ini, -1.2), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., 1.4), xytext=(-ini, 1.4), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -1.4), xytext=(-ini, -1.4), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., 0), xytext=(ini, 0), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., .2), xytext=(ini, .2), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -.2), xytext=(ini, -.2), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., .4), xytext=(ini, .4), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -.4), xytext=(ini, -.4), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., .6), xytext=(ini, .6), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -.6), xytext=(ini, -.6), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., .8), xytext=(ini, .8), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -.8), xytext=(ini, -.8), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., 1), xytext=(ini, 1), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -1), xytext=(ini, -1), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., 1.2), xytext=(ini, 1.2), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -1.2), xytext=(ini, -1.2), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., 1.4), xytext=(ini, 1.4), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -1.4), xytext=(ini, -1.4), arrowprops=dict(fc="g"))
savefig("first-plot.pdf")
clf()
Z = func5(X, Y)
ax = subplot(111,aspect='equal')
ax.axis('off')
im = imshow(Z,cmap=cm.jet, extent=(-pi/2., pi/2., -pi/2., pi/2.))
im.set_interpolation('bilinear')
im.set_clip_path(Circle((0,0),pi/2., transform=ax.transData))
annotate("", xy=(pi/2., 0), xytext=(ini, 0), arrowprops=dict(fc="g"))
annotate("", xy=(0., -1.6), xytext=(ini, 0), arrowprops=dict(fc="g"))
savefig("second-plot.pdf")
clf()
From: Christopher F. <sta...@me...> - 2010年10月22日 14:40:33
On Oct 22, 2010, at 9:13 AM, Ryan May wrote:
> 
> On Fri, Oct 22, 2010 at 8:47 AM, Christopher Fonnesbeck
> <sta...@me...> wrote:
>> I notice that when the number of bins in a histogram is sparse, the spacing between the bins can be irregular. For example:
>> 
>> http://cl.ly/7e0ad7039873d5446365
>> http://cl.ly/c7cb20b567722928ac3c
>> 
>> Is there a way of normalizing this, and better, can the default behavior result in something more consistent (i.e. publication-quality)?
> 
> That looks like some bizarre rounding/truncation or something like it.
> Can you post an example (can just use made up data) that reproduces
> this? I've not seen this before, so I sense it's due to the specific
> data types you're passing in.
Here is a very simple example. The data are just a list of integers:
http://dl.dropbox.com/u/233041/histexample.py
and it results in an odd choice of intervals.
(array([863, 775, 0, 271, 0, 67, 23, 0, 0, 1]),
 array([ 0. , 0.6, 1.2, 1.8, 2.4, 3. , 3.6, 4.2, 4.8, 5.4, 6. ]),
 <a list of 10 Patch objects>)
If there are only 7 possible values of the data, which are evenly-spaced, it should probably not go in and create more than 6 bins as the default behavior. I know I can specify bins by hand, but when automated it would be nice to have a more sensible default.
Thanks,
cf
From: Alexander D. <ale...@go...> - 2010年10月22日 14:32:01
Hi Eric,
thanks a lot, that was exactly I was looking for...
Alex
On Thu, Oct 21, 2010 at 20:23, Eric Firing <ef...@ha...> wrote:
> On 10/20/2010 11:41 PM, Alexander Dietz wrote:
> > Hi,
> >
> > I am generating a scatter plot with a colorbar, and want to pass on the
> > colorbar to some function to do something with it, like
> >
> > plt.scatter(px, py, c=pz, ...)
> > cb = plt.colorbar()
> > foo(cb)
> >
> >
> > My question: How can I extract the range of the colorbar from the cb
> > object? The colorbar extends from min(pz) to max(pz), but can I access
> > these values from the cb object alone, without the need to pass pz to
> > foo as well?
>
> cb.norm.vmin
> cb.norm.vmax
>
> Or you can get the same thing from the collection returned by scatter:
>
> col = scatter(...)
> col.norm.vmin
> col.norm.vmax
>
> The colorbar uses the norm and colormap from the current image (or more
> generally, the color-mappable object), which in this case is the
> collection generated by scatter().
>
> Eric
>
> >
> >
> > Thanks
> > Alex
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Nokia and AT&T present the 2010 Calling All Innovators-North America
> contest
> > Create new apps& games for the Nokia N8 for consumers in U.S. and
> Canada
> > 10ドル million total in prizes - 4ドルM cash, 500 devices, nearly 6ドルM in
> marketing
> > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> > http://p.sf.net/sfu/nokia-dev2dev
> >
> >
> >
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America
> contest
> Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
> 10ドル million total in prizes - 4ドルM cash, 500 devices, nearly 6ドルM in
> marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Ryan M. <rm...@gm...> - 2010年10月22日 14:14:01
On Fri, Oct 22, 2010 at 8:47 AM, Christopher Fonnesbeck
<sta...@me...> wrote:
> I notice that when the number of bins in a histogram is sparse, the spacing between the bins can be irregular. For example:
>
> http://cl.ly/7e0ad7039873d5446365
> http://cl.ly/c7cb20b567722928ac3c
>
> Is there a way of normalizing this, and better, can the default behavior result in something more consistent (i.e. publication-quality)?
That looks like some bizarre rounding/truncation or something like it.
Can you post an example (can just use made up data) that reproduces
this? I've not seen this before, so I sense it's due to the specific
data types you're passing in.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Christopher F. <sta...@me...> - 2010年10月22日 13:48:11
I notice that when the number of bins in a histogram is sparse, the spacing between the bins can be irregular. For example:
http://cl.ly/7e0ad7039873d5446365
http://cl.ly/c7cb20b567722928ac3c
Is there a way of normalizing this, and better, can the default behavior result in something more consistent (i.e. publication-quality)?
Thanks,
Chris
From: Jae-Joon L. <lee...@gm...> - 2010年10月22日 12:53:05
Attachments: tererer.py
Kenshi,
I'm sorry that I completely forgot about this issue.
I just took a look and it seems to be due to a bug in clabel routine.
The fix is easy and I'll commit it soon. Meanwhile, here is a work
around. Basically, you need to draw a contour in "ax3", not in
"aux_ax3".
First of all, you can populate Z without for loops (note that I
changed X, Y to Theta, R).
Theta, R = meshgrid(theta, r)
Z = (Theta/90.)**2 + (R-2)**2
Now, instead of aux_ax3.contour, use
CS = aux_contour(aux_ax3, Theta, R, Z,levels,colors='k')
where aux_contour is defined as
def aux_contour(aux_ax, aux_X, aux_Y, Z, *kl, **kwargs):
 ax = aux_ax._parent_axes
 shape_orig = Theta.shape
 TR = np.array([aux_X, aux_Y]).reshape((2, -1)).transpose() #
coordinates in aux_ax
 XY = aux_ax.transAux.transform(TR) # coordinates in ax
 X, Y = XY.transpose().reshape((2, shape_orig[0], shape_orig[1]))
 CS = ax.contour(X, Y, Z, *kl, **kwargs)
 return CS
And do clabel with the original axes (ax3). use_clabeltext will help
the labels aligned with contour lines.
ax3.clabel(CS,fontsize=10, use_clabeltext=True)
A complete example is attached.
Regards,
-JJ
On Fri, Sep 17, 2010 at 7:34 PM, Kenshi hibino
<hi...@ku...> wrote:
>
>
> Jae-Joon Lee wrote:
>>
>>
>> Another option is to use mpl_toolkits.axisartist (distributed with mpl
>> 1.0). However, learning curve of the axisartist is also steep. You may
>> play around with the last figure in the example below.
>>
>> http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html
>>
>>
>
> Jae-Joon,
> Thanks for the quick reply and good advice.
>
> Second option you recommended is seemed to work well.
> My code modified from example is attached.
>
> But, in semi-circle domain I can't write contour label using clabel().
> Do you know the reason why? http://old.nabble.com/file/p29737063/test2.py
> test2.py
>
> For reference my system is python(x,y) on Windows and mpl version is 1.0
>
> Thanks again.
>
> Kenshi
> --
> View this message in context: http://old.nabble.com/contour-plot-in-semi-circle-domain-tp29699332p29737063.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Matthew M. <mat...@gm...> - 2010年10月22日 11:28:32
I'm trying to get a delaunay triangulation of a set of points on the surface
of the torus. I'm using matplotlib.delaunay, but it seems to only give the
triangulation for a flat surface. Is there any way to tell it to take the
periodic boundary conditions into account, or alter the points I input such
that matplotlib.delaunay interprets them as being on the surface of the
torus.
Perhaps another choice of package might be better, but I know very little
Python. I'm really a Matlab man, and matplotlib.delaunay is very similar to
the equivalent function there. So if you know of an alternative, could you
point me to idiotproof example files?
-- 
View this message in context: http://old.nabble.com/matplotlib.delauney-with-periodic-boundary-conditions-tp30027789p30027789.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2010年10月22日 11:26:58
On Thu, Oct 21, 2010 at 4:31 AM, Gökhan Sever <gok...@gm...> wrote:
> How could I change the appearance of the legend symbol in this case?
> It auto-uses a patch object (rectangle in this case).
> I would like to get a straight line instead.
You may use proxy artists.
http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
Regards,
-JJ
From: Dmitry V. <df...@gm...> - 2010年10月22日 06:47:47
Hello,
When I plot graph with values 10^5 and more at y axis, the labels are 
too long and run out of the picture borders. So I get "600000" instead 
of "1600000" at y axis or something like this. Tried to use
====
majorFormatter = ticker.FormatStrFormatter('%e')
ax.yaxis.set_major_formatter(majorFormatter)
====
but it became even worse -- "00e+00", "00e+05", "00e+06", i.e. first 
digits run out of picture border or I see only part of digit.
Is it possible to make matplotlib automatically change picture size due 
to it's content? Or maybe there is some other way to solve my problem?
Thanks.
-- 
Best Regards,
Dmitry Vinokurov
+7 905 862 17 11
skype: d.a.vinokurov
<df...@gm...>

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