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



Showing 19 results of 19

From: Skipper S. <jss...@gm...> - 2011年11月08日 23:53:50
On Tue, Nov 8, 2011 at 6:13 PM, Benjamin Root <ben...@ou...> wrote:
>
> On Tue, Nov 8, 2011 at 4:55 PM, Skipper Seabold <jss...@gm...> wrote:
>>
>> Hi,
>>
>> Two related questions. Consider this plot
>>
>> -----
>>
>> import matplotlib.pyplot as plt
>> from mpl_toolkits.mplot3d import Axes3D
>>
>> fig = plt.figure()
>> ax = fig.add_subplot(111, projection='3d')
>> ax.plot([1,0,0,1],[0,1,0,0],[0,0,1,0])
>>
>> ax.set_xlim3d(0,1)
>> ax.set_ylim3d(0,1)
>> #ax.set_ylim3d(1,0)
>> ax.set_zlim3d(0,1)
>>
>> plt.show()
>>
>> -----
>>
>> I want to uncomment the line above to reverse the y axis, but as soon
>> as I do, the tick labels disappear on the y axis and the z axis tick
>> label padding changing. Is there another way to reverse the y axis, or
>> should I fix thing after the fact. If so, how can I do this? I don't
>> see a zaxis in rcParams.
>>
>
> The first would be a bug (could you please file one?). The second should
> probably be a feature request, but I wouldn't expect anything for that right
> away.
>
1. https://github.com/matplotlib/matplotlib/issues/570
2. Surely there's another workaround in the meantime? I've never
worked much with rcParams, going the long way instead, but now that
I've discovered it, it's my preferred way of doing things. Anyone have
any ideas?
Skipper
From: Benjamin R. <ben...@ou...> - 2011年11月08日 23:13:42
On Tue, Nov 8, 2011 at 4:55 PM, Skipper Seabold <jss...@gm...> wrote:
> Hi,
>
> Two related questions. Consider this plot
>
> -----
>
> import matplotlib.pyplot as plt
> from mpl_toolkits.mplot3d import Axes3D
>
> fig = plt.figure()
> ax = fig.add_subplot(111, projection='3d')
> ax.plot([1,0,0,1],[0,1,0,0],[0,0,1,0])
>
> ax.set_xlim3d(0,1)
> ax.set_ylim3d(0,1)
> #ax.set_ylim3d(1,0)
> ax.set_zlim3d(0,1)
>
> plt.show()
>
> -----
>
> I want to uncomment the line above to reverse the y axis, but as soon
> as I do, the tick labels disappear on the y axis and the z axis tick
> label padding changing. Is there another way to reverse the y axis, or
> should I fix thing after the fact. If so, how can I do this? I don't
> see a zaxis in rcParams.
>
>
The first would be a bug (could you please file one?). The second should
probably be a feature request, but I wouldn't expect anything for that
right away.
Ben Root
From: Benjamin R. <ben...@ou...> - 2011年11月08日 23:09:44
On Tue, Nov 8, 2011 at 4:50 PM, Alejandro Weinstein <
ale...@gm...> wrote:
> Hi:
>
> I am trying to use the event associated to motion_notify_event in a 3D
> plot, and I found that the event does not have the zdata property.
>
> The following code illustrate the problem:
>
> ##################################
> from mpl_toolkits.mplot3d import Axes3D
> import matplotlib.pyplot as plt
>
> def on_hover(event):
> print dir(event)
>
> fig = plt.figure()
> ax = fig.add_subplot(111, projection='3d')
> x = [1, 2, 3]
> y = [1, 5, 4]
> z = [3, 5, 6]
> ax.scatter(x, y, z)
>
> cid = fig.canvas.mpl_connect('motion_notify_event', on_hover)
>
> plt.show()
> ##################################
>
> When you move the mouse over the figure, you can see the properties of
> event:
>
> ['__doc__', '__init__', '__module__', '__str__',
> '_update_enter_leave', 'button', 'canvas', 'dblclick', 'guiEvent',
> 'inaxes', 'key', 'lastevent', 'name', 'step', 'x', 'xdata', 'y',
> 'ydata']
>
> There is xdata, ydata, but not zdata.
>
> Is zdata missing or should I be using a different event type?
>
> Alejandro.
>
>
Be careful, I don't think the xdata and ydata are in the coordinate system
that you believe they are in. Because of the way mplot3d works outside of
the proper projections transform framework, it can only guess at what the
3d coordinates are. The x/ydata are probably in the 2d axes coordinates and
not the coordinates that you are using for the 3d axes that is embedded in
the 2d axes, I can't recall for sure.
The following is the function from the Axes3D class used to report a 3d
coordinate that is displayed in the lower-right corner of the figure. You
might be able to adapt this for your use. Note that self.M is the internal
projection matrix for the Axes3D object.
 def format_coord(self, xd, yd):
 """
 Given the 2D view coordinates attempt to guess a 3D coordinate.
 Looks for the nearest edge to the point and then assumes that
 the point is at the same z location as the nearest point on the
edge.
 """
 if self.M is None:
 return ''
 if self.button_pressed in self._rotate_btn:
 return 'azimuth=%d deg, elevation=%d deg ' % (self.azim,
self.elev)
 # ignore xd and yd and display angles instead
 p = (xd, yd)
 edges = self.tunit_edges()
 #lines = [proj3d.line2d(p0,p1) for (p0,p1) in edges]
 ldists = [(proj3d.line2d_seg_dist(p0, p1, p), i) for \
 i, (p0, p1) in enumerate(edges)]
 ldists.sort()
 # nearest edge
 edgei = ldists[0][1]
 p0, p1 = edges[edgei]
 # scale the z value to match
 x0, y0, z0 = p0
 x1, y1, z1 = p1
 d0 = np.hypot(x0-xd, y0-yd)
 d1 = np.hypot(x1-xd, y1-yd)
 dt = d0+d1
 z = d1/dt * z0 + d0/dt * z1
 x, y, z = proj3d.inv_transform(xd, yd, z, self.M)
 xs = self.format_xdata(x)
 ys = self.format_ydata(y)
 zs = self.format_zdata(z)
 return 'x=%s, y=%s, z=%s' % (xs, ys, zs)
I hope this helps!
Ben Root
From: Skipper S. <jss...@gm...> - 2011年11月08日 22:56:13
Hi,
Two related questions. Consider this plot
-----
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot([1,0,0,1],[0,1,0,0],[0,0,1,0])
ax.set_xlim3d(0,1)
ax.set_ylim3d(0,1)
#ax.set_ylim3d(1,0)
ax.set_zlim3d(0,1)
plt.show()
-----
I want to uncomment the line above to reverse the y axis, but as soon
as I do, the tick labels disappear on the y axis and the z axis tick
label padding changing. Is there another way to reverse the y axis, or
should I fix thing after the fact. If so, how can I do this? I don't
see a zaxis in rcParams.
Thanks,
Skipper
From: Alejandro W. <ale...@gm...> - 2011年11月08日 22:50:50
Hi:
I am trying to use the event associated to motion_notify_event in a 3D
plot, and I found that the event does not have the zdata property.
The following code illustrate the problem:
##################################
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
def on_hover(event):
 print dir(event)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = [1, 2, 3]
y = [1, 5, 4]
z = [3, 5, 6]
ax.scatter(x, y, z)
cid = fig.canvas.mpl_connect('motion_notify_event', on_hover)
plt.show()
##################################
When you move the mouse over the figure, you can see the properties of event:
['__doc__', '__init__', '__module__', '__str__',
'_update_enter_leave', 'button', 'canvas', 'dblclick', 'guiEvent',
'inaxes', 'key', 'lastevent', 'name', 'step', 'x', 'xdata', 'y',
'ydata']
There is xdata, ydata, but not zdata.
Is zdata missing or should I be using a different event type?
Alejandro.
From: klo uo <kl...@gm...> - 2011年11月08日 20:31:58
OK, soon I found out that m.xmax... are dependant on projection, and I
wasn't using Lambert projection
For default projection result are degrees and this way meters it sems
On Tue, Nov 8, 2011 at 9:13 PM, klo uo <kl...@gm...> wrote:
> from http://matplotlib.github.com/basemap/users/examples.html:
>
> ----------------------------------------
> from mpl_toolkits.basemap import Basemap, shiftgrid, cm
> import numpy as np
> import matplotlib.pyplot as plt
> from netCDF4 import Dataset
>
> # read in etopo5 topography/bathymetry.
> etopodata =\
> Dataset('http://ferret.pmel.noaa.gov/thredds/dodsC/data/PMEL/etopo5.nc')
> topoin = etopodata.variables['ROSE'][:]
> lons = etopodata.variables['ETOPO05_X'][:]
> lats = etopodata.variables['ETOPO05_Y'][:]
> # shift data so lons go from -180 to 180 instead of 20 to 380.
> topoin,lons = shiftgrid(180.,topoin,lons,start=False)
>
> # plot topography/bathymetry as an image.
>
> # create the figure and axes instances.
> fig = plt.figure()
> ax = fig.add_axes([0.1,0.1,0.8,0.8])
> # setup of basemap ('lcc' = lambert conformal conic).
> # use major and minor sphere radii from WGS84 ellipsoid.
> m =
> Basemap(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\
> rsphere=(6378137.00,6356752.3142),\
> resolution='l',area_thresh=1000.,projection='lcc',\
> lat_1=50.,lon_0=-107.,ax=ax)
> # transform to nx x ny regularly spaced 5km native projection grid
> nx = int((m.xmax-m.xmin)/5000.)+1; ny = int((m.ymax-m.ymin)/5000.)+1
> topodat = m.transform_scalar(topoin,lons,lats,nx,ny)
> ...
> ----------------------------------------
>
> Line (last but one):
> nx = int((m.xmax-m.xmin)/5000.)+1; ny = int((m.ymax-m.ymin)/5000.)+1
>
> (m.xmax-m.xmin) and (m.ymax-m.ymin) are very small compared to their
> divider 5000, so nx and ny are always 1
>
> Provided link for "etopo5.nc" is desperately slow (~20 Kb/s) so I can't
> test the code, but I tried with other dataset (ETOPO2) and I can't get what
> "topodat" varable should be. It's not clear to me from provided
> documentation.
>
> Thanks in advance for any help
>
From: klo uo <kl...@gm...> - 2011年11月08日 20:13:24
from http://matplotlib.github.com/basemap/users/examples.html:
----------------------------------------
from mpl_toolkits.basemap import Basemap, shiftgrid, cm
import numpy as np
import matplotlib.pyplot as plt
from netCDF4 import Dataset
# read in etopo5 topography/bathymetry.
etopodata =\
Dataset('http://ferret.pmel.noaa.gov/thredds/dodsC/data/PMEL/etopo5.nc')
topoin = etopodata.variables['ROSE'][:]
lons = etopodata.variables['ETOPO05_X'][:]
lats = etopodata.variables['ETOPO05_Y'][:]
# shift data so lons go from -180 to 180 instead of 20 to 380.
topoin,lons = shiftgrid(180.,topoin,lons,start=False)
# plot topography/bathymetry as an image.
# create the figure and axes instances.
fig = plt.figure()
ax = fig.add_axes([0.1,0.1,0.8,0.8])
# setup of basemap ('lcc' = lambert conformal conic).
# use major and minor sphere radii from WGS84 ellipsoid.
m =
Basemap(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\
 rsphere=(6378137.00,6356752.3142),\
 resolution='l',area_thresh=1000.,projection='lcc',\
 lat_1=50.,lon_0=-107.,ax=ax)
# transform to nx x ny regularly spaced 5km native projection grid
nx = int((m.xmax-m.xmin)/5000.)+1; ny = int((m.ymax-m.ymin)/5000.)+1
topodat = m.transform_scalar(topoin,lons,lats,nx,ny)
...
----------------------------------------
Line (last but one):
nx = int((m.xmax-m.xmin)/5000.)+1; ny = int((m.ymax-m.ymin)/5000.)+1
(m.xmax-m.xmin) and (m.ymax-m.ymin) are very small compared to their
divider 5000, so nx and ny are always 1
Provided link for "etopo5.nc" is desperately slow (~20 Kb/s) so I can't
test the code, but I tried with other dataset (ETOPO2) and I can't get what
"topodat" varable should be. It's not clear to me from provided
documentation.
Thanks in advance for any help
From: Benjamin R. <ben...@ou...> - 2011年11月08日 17:38:52
On Tue, Nov 8, 2011 at 11:18 AM, Andres Ordonez <
and...@gm...> wrote:
> I'm not sure this is the right place to report this, so if it isn't
> please redirect it to the right place and let me know where the right
> place is.
>
>
>
> The anim.py link
>
> http://matplotlib.sourceforge.net/examples/anim.py
>
> located at
>
> http://www.scipy.org/Cookbook/Matplotlib/Animations
>
> doesn't work.
>
>
That would be a problem with the scipy's website as that example no longer
exists.
Ben Root
From: Bedartha G. <go...@pi...> - 2011年11月08日 17:34:39
Hi,
I have recently installed Python 32/64bit from Python.org and then I proceeded to install bumpy, scipy, matplotlib and igraph on it. But the Matplotlib does not show the plots even if it opens a Figure window. Here is a summary of what I had done in my installation:
-----
I first did a "clean install" by following the instructions at (with an idea to reinstall Matplotlib and see if the rror repeats):
http://matplotlib.sourceforge.net/faq/installing_faq.html#clean-install
-----
So now my python does not have matplotlib:
Bedarthas-MacBook-Air:~ bedartha$ cd ~/Desktop/
Bedarthas-MacBook-Air:Desktop bedartha$ python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: No module named matplotlib
>>> 
Bedarthas-MacBook-Air:Desktop bedartha$
-----
Then I downloaded (again) the DMG file at: 
http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/matplotlib-1.1.0-py2.7-python.org-macosx10.3.dmg/download
-----
and installed Matplotlib (which seems to go through fine). But after that:
Bedarthas-MacBook-Air:~ bedartha$ cd ~/Desktop/
Bedarthas-MacBook-Air:Desktop bedartha$ python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib as mpl
>>> from pylab import *
>>> plot([1,2,3])
[<matplotlib.lines.Line2D object at 0x2f87fb0>]
>>> show()
Exception in Tkinter callback
Traceback (most recent call last):
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__
 return self.func(*args)
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 236, in resize
 self.show()
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 240, in draw
 tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit
 tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
TclError
>>> 
Bedarthas-MacBook-Air:Desktop bedartha$
-----
Here is the essential info about my machine and my Python and Matplotlib versions:
Bedarthas-MacBook-Air:~ bedartha$ uname -a
Darwin Bedarthas-MacBook-Air.local 11.0.1 Darwin Kernel Version 11.0.1: Wed Jun 29 19:53:22 PDT 2011; root:xnu-1699232~1/RELEASE_X86_64 x86_64
-----
Bedarthas-MacBook-Air:Desktop bedartha$ python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib as mpl
>>> mpl.__version__
'1.1.0'
>>> 
Bedarthas-MacBook-Air:Desktop bedartha$
-----
I also have the following alias (in ~/.bash_profile) for my Python2.7 (to deal with some issues in igraph):
alias python="arch -i386 python"
-----
Can anyone please help me out?
Best regards,
and apologies for the lengthy post,
Bedartha
From: Andres O. <and...@gm...> - 2011年11月08日 17:19:09
I'm not sure this is the right place to report this, so if it isn't
please redirect it to the right place and let me know where the right
place is.
The anim.py link
http://matplotlib.sourceforge.net/examples/anim.py
located at
http://www.scipy.org/Cookbook/Matplotlib/Animations
doesn't work.
From: Blake, J. <Jam...@nu...> - 2011年11月08日 17:00:34
Ben,
Adjusting mew sorted it out. Somewhere along the line, I'd changed lines.markeredgewidth in my matplotlibrc to 0, so it wasn't drawing the lines.
Now I know the caps are drawn as a dashed marker, it meant that the lines around it weren't being drawn (or rather they were, but with zero width). With mew>0, if I change capsize, the width of the cap now adjusts accordingly.
Many thanks.
James
________________________________________
From: ben...@gm... [mailto:ben...@gm...] On Behalf Of Benjamin Root
Sent: 08 November 2011 16:41
To: Blake, James
Cc: mat...@li...
Subject: Re: [Matplotlib-users] capsize on errorbars
On Tue, Nov 8, 2011 at 9:57 AM, Blake, James <Jam...@nu...> wrote:
Dear MPL gurus,
I've probably failed to RTFM properly.
I'm trying to produce error bars with horizontal lines at the top of the
vertical error bars to cap them. I've tried adjusting capsize on both
plt.bar and plt.errorbar, but have not had any success. I think I had
this working previously with 1.0.1, but can't remember for definite.
Matplotlib: 1.1.0
Python version: 2.7.2
IPython: 0.11
Windows XP 32 bit
Many thanks for any pointers, and apologies if I have missed an obvious
setting.
James
=== begin example code ===
import matplotlib.pyplot as plt
import numpy as np
plt.ion()
X = np.array([.5,1.5,2.5,3.5])
Y = np.array([1,2,3,4])
dY = np.array([.1,.2,.3,.4])
f = plt.figure()
ax = f.add_subplot(111)
A = plt.bar(X, Y, yerr=dY, ecolor='red', capsize=10)
A[0].set_facecolor('black')
A[1].set_facecolor('gray')
A[2].set_facecolor('black')
A[3].set_facecolor('gray')
ax.set_xlim([0.,4.8])
plt.show()
Are you trying to widen the cap, or make it thicker? I forget which does which, but in my plots, I use "capsize" for one of them and "mew" (markeredgewidth) for the other. If I remember correctly, the errorbar caps are actually a dash marker turned on its side. If that is the case, then adjusting "mew" would adjust the thickness.
Ben Root
******************************************************************************************************************** 
This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.
Thank you for your co-operation.
******************************************************************************************************************** 
This email has been processed by SmoothZap - www.smoothwall.net
From: Benjamin R. <ben...@ou...> - 2011年11月08日 16:41:31
On Tue, Nov 8, 2011 at 9:57 AM, Blake, James <Jam...@nu...>wrote:
> Dear MPL gurus,
>
> I've probably failed to RTFM properly.
>
> I'm trying to produce error bars with horizontal lines at the top of the
> vertical error bars to cap them. I've tried adjusting capsize on both
> plt.bar and plt.errorbar, but have not had any success. I think I had
> this working previously with 1.0.1, but can't remember for definite.
>
> Matplotlib: 1.1.0
> Python version: 2.7.2
> IPython: 0.11
> Windows XP 32 bit
>
> Many thanks for any pointers, and apologies if I have missed an obvious
> setting.
>
> James
>
>
>
> === begin example code ===
> import matplotlib.pyplot as plt
> import numpy as np
> plt.ion()
> X = np.array([.5,1.5,2.5,3.5])
> Y = np.array([1,2,3,4])
> dY = np.array([.1,.2,.3,.4])
> f = plt.figure()
> ax = f.add_subplot(111)
> A = plt.bar(X, Y, yerr=dY, ecolor='red', capsize=10)
> A[0].set_facecolor('black')
> A[1].set_facecolor('gray')
> A[2].set_facecolor('black')
> A[3].set_facecolor('gray')
> ax.set_xlim([0.,4.8])
> plt.show()
>
Are you trying to widen the cap, or make it thicker? I forget which does
which, but in my plots, I use "capsize" for one of them and "mew"
(markeredgewidth) for the other. If I remember correctly, the errorbar
caps are actually a dash marker turned on its side. If that is the case,
then adjusting "mew" would adjust the thickness.
Ben Root
From: Blake, J. <Jam...@nu...> - 2011年11月08日 16:12:59
Dear MPL gurus,
I've probably failed to RTFM properly. 
I'm trying to produce error bars with horizontal lines at the top of the
vertical error bars to cap them. I've tried adjusting capsize on both
plt.bar and plt.errorbar, but have not had any success. I think I had
this working previously with 1.0.1, but can't remember for definite.
Matplotlib: 1.1.0
Python version: 2.7.2
IPython: 0.11
Windows XP 32 bit
Many thanks for any pointers, and apologies if I have missed an obvious
setting.
James
=== begin example code ===
import matplotlib.pyplot as plt
import numpy as np
plt.ion()
X = np.array([.5,1.5,2.5,3.5])
Y = np.array([1,2,3,4])
dY = np.array([.1,.2,.3,.4])
f = plt.figure()
ax = f.add_subplot(111)
A = plt.bar(X, Y, yerr=dY, ecolor='red', capsize=10)
A[0].set_facecolor('black')
A[1].set_facecolor('gray')
A[2].set_facecolor('black')
A[3].set_facecolor('gray')
ax.set_xlim([0.,4.8])
plt.show()
******************************************************************************************************************** 
This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.
Thank you for your co-operation.
******************************************************************************************************************** 
This email has been processed by SmoothZap - www.smoothwall.net
From: Michael D. <md...@st...> - 2011年11月08日 15:42:33
For speed in the Agg backend the markers are drawn once and then copied 
as rasters to all of their positions. This implies that the markers end 
up pixel aligned, which is the source of the error you're seeing. This 
does not happen in the vector backends.
If you want to not get this behavior, you can use scatter() instead of 
plot().
Mike
On 11/07/2011 04:00 PM, Anton Daitche wrote:
> Hi,
>
> As I remember from an earlier discussion on this, it's assumed that
> these small deviations are tolerable in the agg renderer. This makes
> the interactive backends more responsive at expenses of accuracy.
>
>
> Do you remember the name of the thread? I would like to understand the 
> details on this.
> I also would like to find out if i can force the renderer to do exact 
> drawing (at some computational cost).
>
> I can see the same deviations using the tkagg backend with mpl 1.1.0
> but if I save as pdf using the save button I get an accurate rendering
> (see attachment).
>
>
> I can verify this. Thanks for pointing this out.
>
> With best regards
> Anton
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save 700ドル by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Michael D. <md...@st...> - 2011年11月08日 13:36:04
Unfortunately, the matplotlib mathtext renderer does not support 
\begin{array} (or any of the \begin{}/\end{} tags for that matter). 
You'll probably want to experiment with one of the other math plugins 
for sphinx described here:
http://sphinx.pocoo.org/ext/math.html
Mike
On 11/08/2011 05:54 AM, info wrote:
> Hi,
> first of all, thanks for matplotlib!
> Then, the question. After reading this
> http://matplotlib.sourceforge.net/sampledoc/extensions.html
> I've tried to use something like:
>
> .. math::
>
> \left| \begin{array}{cc} x_{11} & x_{12} \\ x_{21} & x_{22} 
> \end{array} \right|
>
>
> but it doesn't work.
> Can you help me?
>
> Thanks,
> Manuel
>
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save 700ドル by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Yoshi R. <yo...@ro...> - 2011年11月08日 11:54:49
+----------------------------- Yoshi Rokuko -----------+
> this works in principle, but however i can't increase
> the size of the grid.
> 
> even if i try something like:
> 
> fig = plt.figure(1, (15,18))
> fig.subplots_adjust(left=0.01, bottom=0.01,
> right=0.99, top=0.99)
> grid = AxesGrid(fig, 132,
> nrows_ncols = (2, 2),
> axes_pad = 0.1,
> cbar_location = "top",
> cbar_mode="single",
> )
> i get a small grid in the center with lots of white
> space around.
here is an example of what i mean:
 http://rokuko.net/to-small.png
best regards, yoshi
PS
done with:
fig = plt.figure(1, (15,25))
fig.subplots_adjust(left=0.1, bottom=0.1,
 right=.9, top=.9)
grid = AxesGrid(fig, 132,
 nrows_ncols = (3, 2),
 axes_pad = 0.1,
 cbar_location = "top",
 cbar_mode="single",
 )
for ax in grid:
 <...>
grid.cbar_axes[0].colorbar(im)
plt.savefig('to-small.png')
From: info <in...@ma...> - 2011年11月08日 11:21:24
Hi,
first of all, thanks for matplotlib!Then, the question. After reading this
 
http://matplotlib.sourceforge.net/sampledoc/extensions.html
 
I've tried to use something like: 
.. math::  \left| \begin{array}{cc} x_{11} & x_{12} \\ x_{21} & x_{22} \end{array} \right|but it doesn't work. 
Can you help me?Thanks,
 
Manuel 
 
 
From: Mads I. <mad...@gm...> - 2011年11月08日 10:49:27
Hi,
Thanks to the help from Christoph, I have been able to build 
matplotlib-1.1.0 on both Win XP-32 and 64.
I have noticed though, that quite a few warnings are produced when the 
source is compiled. Is this something that the core developers would 
like to fix, or is it a 'don't care' thing? If the info is useful, I'd 
be happy to post it somewhere.
Best regards,
Mads
-- 
+-----------------------------------------------------+
| Mads Ipsen |
+----------------------+------------------------------+
| Gåsebæksvej 7, 4. tv | |
| DK-2500 Valby | phone: +45-29716388 |
| Denmark | email: mad...@gm... |
+----------------------+------------------------------+
From: Yoshi R. <yo...@ro...> - 2011年11月08日 09:37:25
+-------------------------- Benjamin Root -----------+
> Why not something like this:
> 
> fig = plt.figure()
> grid = AxesGrid(...)
> bm = Basemap(...)
> for ax in grid :
> x, y = bm(lon, lat)
> ax.scatter(x, y, vmin=globalmin, vmax=globalmax)
> 
> I do variations of this all the time.
Thanks for the tip, this is not going to work because
Basemap() draws a map onto i want to plot, however you
pointed me in the right direction - Basemap() has an
ax=... option:
fig = plt.figure()
grid = AxesGrid(...)
for ax in grid:
 bm = Basemap(..., ax=ax)
 bm.draw...
 x, y = bm(lon, lat)
 im = ax.scatter(x, y, vmin=...)
grid.cbar_axes[0].colorbar(im)
this works in principle, but however i can't increase
the size of the grid.
even if i try something like:
fig = plt.figure(1, (15,18))
fig.subplots_adjust(left=0.01, bottom=0.01,
 right=0.99, top=0.99)
grid = AxesGrid(fig, 132,
 nrows_ncols = (2, 2),
 axes_pad = 0.1,
 cbar_location = "top",
 cbar_mode="single",
 )
i get a small grid in the center with lots of white
space around.
someone knows about that?
Best regards, yoshi

Showing 19 results of 19

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