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




Showing 12 results of 12

From: starz1010101 <ama...@ya...> - 2010年11月05日 19:28:42
Fixed by switching the backend from WXAgg to MacOSX.
starz1010101 wrote:
> 
> I can't force pyplot to draw in the middle a function. For example, this
> function does not plot the sine before the user prompt, only after the
> entire function executes:
> 
> import matplotlib.pyplot as plt
> import numpy as np
> 
> def plot_now():
> plt.ion()
> plt.figure()
> x = 2*np.pi*np.linspace(0.0, 1.0, 100)
> plt.plot( x, np.sin(x) )
> plt.draw()
> plt.draw()
> q = raw_input( 'anything: ')
> 
> I'm using the enthought python distribution for mac in ipython. 
> 
> 
> 
> 
> 
-- 
View this message in context: http://old.nabble.com/Can%27t-force-draw-tp30107286p30144358.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Alan G I. <ai...@am...> - 2010年11月05日 15:41:40
On 10/25/2010 9:23 AM, Stan West wrote:
> markerline.set_zorder(stemlines[0].get_zorder() + 0.1)
Thanks.
Now I can easily get what I want.
But back to the underlying question:
do people really prefer the stems to overlay the markers?
I.e., are the ``stem`` defaults possibly incorrect?
Thanks,
Alan
From: Ryan M. <rm...@gm...> - 2010年11月05日 13:57:51
On Fri, Nov 5, 2010 at 7:12 AM, John M. Densmore (Cont, ARL/WMRD)
<joh...@us...> wrote:
> Hi All,
> I have multiple figures set up at the start of my code. through out the
> script I add data to the plots and at the end I would like to set all
> the figure parameters, like xlim, ylim, legend etc. But I can not figure
> out how to do it. Eample code
>
> fig1 = plt.figure(1)
> ax1 = fig1.add_subplot(111)
>
>
> fig2 = plt.figure(2)
> ax2 = fig2.add_subplot(111)
>
>
> fig3 = plt.figure(3)
> ax3 = fig3.add_subplot(111)
>
> ax1.plot(...)
> ax2.plot(...)
> ax3.plot(...)
>
>
> ax1.plot(...)
> ax2.plot(...)
> ax3.plot(...)
>
> # set the x and y lim <- how do I do this?
ax1.set_xlim(xmin, xmax)
ax1.set_ylim(ymin, ymax)
...
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Oz N. T. <na...@gm...> - 2010年11月05日 13:29:41
A small suggestion to the examples ...
I really like the new subplot mechanism, so I tried it:
fig, (ax1, ax2, ax3, ax4) = plt.subplots(2, 2, sharex=True, sharey=True)
And it actually gave me the following error:
Traceback (most recent call last):
 File "tes.py", line 21, in <module>
 f, (ax1, ax2, ax3, ax4) = subplots(2, 2, sharey=True)
ValueError: need more than 2 values to unpack
I got over with with a small modification:
f, ((ax1,ax2),(ax3,ax4)) = subplots(2, 2, sharey=True)
Which now worked !
Cheers,
-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen
---
Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
From: Aman T. <ama...@gm...> - 2010年11月05日 13:08:13
Hi,
The best way to do this is to use a generator:
import itertools
import matplotlib.pyplot as plt
import numpy as np
def _ncycle(iterable,n):
 """
 Method to create a generator from an iterable. It keeps the
 current position of the iterable in memory. Each time the
 next() method for the iterable is called, it will return the
 next item. If there are no more items, it will cycle to the
 first item.
 """
 for item in itertools.cycle(iterable):
 yield item
colors = _ncycle(('r','g','b','c','y','m','k'),1)
markers = _ncycle(('o','s','v'),1)
n = 20
fig = plt.figure()
ax = fig.add_subplot(111)
for i in range(n):
 x = np.arange(0,10)
 y = np.sin(x)+i-n/2
 c = colors.next()
 if c == 'r':
 marker = markers.next()
 ax.plot(x,y,c=c,marker=marker)
plt.show()
On Fri, Nov 5, 2010 at 8:29 AM, Neal Becker <ndb...@gm...> wrote:
> How can I automatically cycle through distinctive line markers?
>
> I want a semilog plot, composed of a number of lines. Each line should
> have
> a different color and marker.
>
> Cycling through the colors is automatic, but not the markers.
>
> BTW, shouldn't this behavior be the default? I would just like to say
> markers=True and get this behavior.
>
>
>
> ------------------------------------------------------------------------------
> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> David G. Thomson, author of the best-selling book "Blueprint to a
> Billion" shares his insights and actions to help propel your
> business during the next growth cycle. Listen Now!
> http://p.sf.net/sfu/SAP-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Aman Thakral
B.Eng & Biosci, M.Eng Design
From: John M. D. (C. ARL/WMRD) <joh...@us...> - 2010年11月05日 12:34:34
Hi All,
I have multiple figures set up at the start of my code. through out the 
script I add data to the plots and at the end I would like to set all 
the figure parameters, like xlim, ylim, legend etc. But I can not figure 
out how to do it. Eample code
fig1 = plt.figure(1)
ax1 = fig1.add_subplot(111)
fig2 = plt.figure(2)
ax2 = fig2.add_subplot(111)
fig3 = plt.figure(3)
ax3 = fig3.add_subplot(111)
ax1.plot(...)
ax2.plot(...)
ax3.plot(...)
ax1.plot(...)
ax2.plot(...)
ax3.plot(...)
# set the x and y lim <- how do I do this?
plt.show()
Thanks
From: Neal B. <ndb...@gm...> - 2010年11月05日 12:29:46
How can I automatically cycle through distinctive line markers?
I want a semilog plot, composed of a number of lines. Each line should have 
a different color and marker.
Cycling through the colors is automatic, but not the markers.
BTW, shouldn't this behavior be the default? I would just like to say
markers=True and get this behavior.
From: Scott S. <sco...@gm...> - 2010年11月05日 12:06:49
On 5 November 2010 14:05, Scott Sinclair <sco...@gm...> wrote:
> You probably want imshow, pcolor, pcolormash or matshow
I meant pcolormesh...
From: Scott S. <sco...@gm...> - 2010年11月05日 12:05:31
On 5 November 2010 13:33, Daniele Nicolodi <da...@gr...> wrote:
> I would like to plot an x, y, z table so that each region of the plot
> area defined by the coordinates (x, y) corresponds a color given by the
> value of z. I suppose this is a kind of basic functionality, but I'm
> unable to find the right function into matplotlib API.
You probably want imshow, pcolor, pcolormash or matshow
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.imshow
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.pcolor
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.pcolormesh
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.matshow
There's a basic example of using imshow here:
http://matplotlib.sourceforge.net/examples/pylab_examples/image_demo.html
Cheers,
Scott
From: John <was...@gm...> - 2010年11月05日 11:34:16
Clever folks,
Is there an algorithm, or known method to extract a subset of one grid
to match another. I have two grids, one nested, the other global. In
general they are regular lat/lon grids. Also, in general they are 0.5
degree lat/lon. However, I would like to make this as general as
possible.
What I am trying to accomplish is the following:
A) to have a function where I pass the two grids and meta data about
the grids (lon0, lat0, dx, numx, dy, numy, etc). Then, a subsection of
the global grid is returned that matches the nested grid.
B) in a more general case, I may have to define a regrid function so
that the subset of the global grid could match the nested grid.
Suggestions?
From: Daniele N. <da...@gr...> - 2010年11月05日 11:34:04
Hello, I have a really dummy question.
I would like to plot an x, y, z table so that each region of the plot
area defined by the coordinates (x, y) corresponds a color given by the
value of z. I suppose this is a kind of basic functionality, but I'm
unable to find the right function into matplotlib API.
Thank you. Cheers,
-- 
Daniele
From: Basedow S. L. <sun...@ui...> - 2010年11月05日 11:22:50
Hi!
I try to plot some interpolated data on a map and get an error saying
there are too many indices. When I use contour in matplotlib without
basemap I don't get the error. Also the map without a contour plot on it
works. Maybe some of you know what I do wrong?
Here is my code:
-------------
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.mlab import griddata
from mpl_toolkits.basemap import Basemap
 
yi = np.linspace(min(Lat),max(Lat),100)
xi = np.linspace(min(Lon),max(Lon),50)
lon,lat,var = np.array(Lon), np.array(Lat), np.array(Var)
zi = griddata(lon,lat,var,xi,yi)
map = Basemap(projection='cyl', llcrnrlat=67, urcrnrlat=73,\
 llcrnrlon=4, urcrnrlon=20, resolution='h')
 
map.drawcoastlines()
map.drawmeridians(np.arange(0,360,1))
map.drawparallels(np.arange(-90,90,1))
xlon, ylat = map(xi,yi)
cs = map.contour(xlon,ylat,zi)
plt.show()
---------------
and this is the error message:
cs = map.contour(xlon,ylat,zi)
File
"/usr/local/lib/python2.6/dist-packages/mpl_toolkits/basemap/__init__.py",
line 2820, in contour
 xx = x[x.shape[0]/2,:]
IndexError: too many indices
Any help appreciated!
Sünnje

Showing 12 results of 12

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