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

Showing 13 results of 13

On 4/4/10 11:06 AM, Will Hewson wrote:
> Hi again Jeff et al...
>
> I've had a play around with the extra few lines of code - on paper this
> seems like it should solve the problems I'm experiencing. However, an
> error's being thrown up by the transform scalar function, as my lons and
> lats won't necessarily be increasing. The data I'm plotting is satellite
> data and so at the beginning and end of the orbit file lats go over the pole
> from 90 to -90, with a similar problem for the lons - whereby the data is
> taken across the satellite track. I've thought about sorting the data before
> passing it to transform_scalar but I'm always going to be left with the
> problem in either lats or lons.
>
> I've uploaded the file I'm currently working with this time. It's three
> columns of lons, lats and z values.
>
> Once again, many thanks for your help.
>
> Will.
>
> http://old.nabble.com/file/p28133659/test.plt test.plt
> 
Will: Is it a regular lat/lon grid or a satellite swath? If it's the 
latter, you can't use my solution.
-Jeff
Hi again Jeff et al...
I've had a play around with the extra few lines of code - on paper this
seems like it should solve the problems I'm experiencing. However, an
error's being thrown up by the transform scalar function, as my lons and
lats won't necessarily be increasing. The data I'm plotting is satellite
data and so at the beginning and end of the orbit file lats go over the pole
from 90 to -90, with a similar problem for the lons - whereby the data is
taken across the satellite track. I've thought about sorting the data before
passing it to transform_scalar but I'm always going to be left with the
problem in either lats or lons.
I've uploaded the file I'm currently working with this time. It's three
columns of lons, lats and z values.
Once again, many thanks for your help.
Will.
http://old.nabble.com/file/p28133659/test.plt test.plt 
Jeff Whitaker wrote:
> 
> On 4/2/10 6:32 AM, Will Hewson wrote:
>> This is great Jeff, thanks for the help - I'll give it a try over the
>> weekend
>> (it's bank holiday here in the UK!) and get back to you, if I'm still
>> having
>> trouble I'll stick up the plotting data too... thanks again.
>>
>> Will
>> 
> 
> Will: I forgot to mention that contourf will work on your data without 
> having to interpolate to projection coordinates.
> 
> -Jeff
>>
>>
>> Jeff Whitaker wrote:
>> 
>>> On 4/2/10 4:27 AM, Will Hewson wrote:
>>> 
>>>> Hi forum/ mailing list, When I plot in the orthographic projection I'm
>>>> getting the large artefact shown below extending away from the north
>>>> east of the globe. I'm not finding the same problem when plotting in a
>>>> full globe projection so I'm presuming the problem is with the way I'm
>>>> projecting everything rather than my data itself. I've included my
>>>> plotting code below, if anyone is able to spot some glaring omissions/
>>>> errors I'd be most grateful (I've been using python/ matplotlib for
>>>> only a couple of weeks now!).
>>>> 
>>> Will: I think what's happening is that pcolormesh is having trouble
>>> dealing with the higher curvlinear grid, which becomes nearly
>>> pathological near the horizon of the projection. If you take a look at
>>> the test.py file in the basemap examples directory, you'll see an
>>> example orthographic plot that solves this problem by first
>>> interpolating the data to a regular grid in projection coordinates (with
>>> values over the plot horizon masked). The example uses imshow, but
>>> pcolormesh works as well. A standalone version of the example using
>>> pcolormesah is attached, which uses data files in the basemap examples
>>> directory.
>>>
>>> -Jeff
>>>
>>> from mpl_toolkits.basemap import Basemap, shiftgrid
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> # read in topo data (on a regular lat/lon grid)
>>> # longitudes go from 20 to 380.
>>> topoin = np.loadtxt('etopo20data.gz')
>>> lons = np.loadtxt('etopo20lons.gz')
>>> lats = np.loadtxt('etopo20lats.gz')
>>> # shift data so lons go from -180 to 180 instead of 20 to 380.
>>> topoin,lons = shiftgrid(180.,topoin,lons,start=False)
>>> m = Basemap(projection='ortho',lon_0=-105,lat_0=40,resolution='l')
>>> # transform to nx x ny regularly spaced native projection grid
>>> nx = int((m.xmax-m.xmin)/40000.)+1; ny = int((m.ymax-m.ymin)/40000.)+1
>>> topodat,x,y =\
>>> m.transform_scalar(topoin,lons,lats,nx,ny,returnxy=True,masked=True,order=1)
>>> # create the figure.
>>> fig=plt.figure(figsize=(8,8))
>>> im = m.pcolormesh(x,y,topodat,cmap=plt.cm.jet)
>>> m.drawcoastlines()
>>> m.drawparallels(np.arange(0.,80,20.))
>>> m.drawmeridians(np.arange(10.,360.,30.))
>>> m.drawmapboundary()
>>> plt.show()
>>>
>>>
>>> 
>> 
> 
> 
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Basemap--orthographic-projection-plot-doesn%27t-respect-globe-boundary-tp28117654p28133659.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Thomas R. <tho...@gm...> - 2010年04月04日 15:55:46
Hi,
In the following script:
---
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as mpl
fig = mpl.figure()
ax = fig.add_subplot(1,1,1)
for line in ax.xaxis.get_ticklines():
 line.set_markersize(20)
 line.set_linewidth(10)
 line.set_linestyle('dashed')
fig.savefig('test.png')
---
It looks as though the set_linewidth and set_linestyle commands are silently ignored. Is this normal? I have submitted a bug report here:
https://sourceforge.net/tracker/?func=detail&aid=2981829&group_id=80706&atid=560720
Thanks,
Thomas
From: Alan G I. <ala...@gm...> - 2010年04月04日 13:38:50
On 4/4/2010 3:15 AM, Enzo Michelangeli wrote:
> ion() doesn't do what I need: it just forces a draw()
> after every pyplot command allowing animated plots. Instead, I want the program
> to draw and show a complete plot, then pause allowing me to interact with its
> window (e.g., to pan, zoom and/or save a screenshot), then, after I close that
> window, proceed to build a new, entirely different plot, show it in a new window
> and so on.
> 
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
for _ in range(3):
 data = np.random.randint(0, 9,(4,))
 fig = plt.figure()
 ax = fig.add_subplot(1,1,1)
 ax.plot(data)
 raw_input("Hit Enter to continue")
hth,
Alan Isaac
From: Václav Š. <eu...@ar...> - 2010年04月04日 12:21:36
Hi all,
I am using mathtext (via sphinx) for documenting larger physics
simulation software (https://www.yade-dem.org/sphinx/). I am converting
some docs from LaTeX, where I had defined simple macros like \def
\vec#1{\mathbf{#1}}, \curr#1{#1^{\circ}} or \let\eps\varepsilon -- to
unify notations and to make possible to change them easily globally.
Is it possible to define such _simple_ custom macros in mathtext itself?
If not, is there a simple way to monkey some internals of matplotlib in
python to have those?
I found support for \def mentioned only once, at
http://osdir.com/ml/python.matplotlib.devel/2006-08/msg00053.html,
without any continuation on the subject.
Cheers, Vaclav
From: Gary R. <gr...@bi...> - 2010年04月04日 11:03:43
Attachments: rvg.py
Hi Tymoteusz,
I think this does what you want (see attached).
I'm not sure about 3D though.
Gary R.
Tymoteusz Jankowski wrote:
> Hi!
> 
> Can anyone help me to achive this?
> I'd like to plot rgb spectrum with matplotlib.
> For example let the x axis be green element, and for example... let the y 
> axis be red element.
> Eventually i'd like to plot 3D figure with all of three elements RGB.
> Regards,
> T.
From: Claus <cla...@gm...> - 2010年04月04日 07:16:34
Hi,
I've got two questions: 
1) one is related to colorbar() on multiple subfigures (see code example below): how do I add a scatterplot if I wanted multiple subfigures? Or, what am I doing wrong in the second code example
2) in either of the examples, how can I increase the distance between the top of the plot (imshow) and the bottom of the title?
# code example 1: this works
fig = plt.figure()
plt.title('Hello')
plt.imshow(interpolValsRas, cmap=cm.jet, interpolation='nearest', origin = 'lower', extent=[5,95,5,95]) # , 
plt.scatter(measurementLoc[:,0], measurementLoc[:,1], 10, messwerte, cmap=cm.jet)
plt.colorbar();
# code example 2: this works generally, but only if the second last line is commented out
# Q: how do I add a scatterplot if I wanted multiple subfigures?
fig = plt.figure()
ax = fig.add_subplot(111)
plt.title('Hello')
ax.imshow(interpolValsRas, cmap=cm.jet, interpolation='nearest', origin = 'lower', extent=[5,95,5,95]) # , 
ax.scatter(measurementLoc[:,0], measurementLoc[:,1], 10, messwerte, cmap=cm.jet)
# plt.colorbar();
plt.show()
Thanks for your help,
Claus
From: Enzo M. <enz...@gm...> - 2010年04月04日 07:16:12
Alan G Isaac <alan.isaac@...> writes:
> 
> On 4/3/2010 11:19 PM, Enzo Michelangeli wrote:
> > multiple show() functionality is important for many users (see
> > e.g.
> >
http://www.mail-archive.com/matplotlib-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
<at> public.gmane.org/msg13099.html
> > 
> 
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ion
>From what I undrstand, ion() doesn't do what I need: it just forces a draw()
after every pyplot command allowing animated plots. Instead, I want the program
 to draw and show a complete plot, then pause allowing me to interact with its
window (e.g., to pan, zoom and/or save a screenshot), then, after I close that
window, proceed to build a new, entirely different plot, show it in a new window
and so on.
Enzo 
From: Levi K. <lev...@gm...> - 2010年04月04日 06:57:22
Can anyone else confirm this bug? It was giving me fits for a while.
I can't control the size of markers in my plots.
Here is an old post describing exactly my problem:
http://sourceforge.net/mailarchive/message.php?msg_id=972d0a0e0809232229ue9aa42eg5d791a08692f7e7b%40mail.gmail.com
I am running python 2.6.4, ipython 0.10, and matplotlib 0.99.0.
And what the heck are the line objects in the legend? Are there
separate marker objects that I am missing?
I tried messing with the legend.get_lines() objects, but these have
marker types "None". Where are the marker objects I see in my legend?
For those that also run across this problem, here is a hack I used to
overcome the problem:
----------SNIP----------
from pylab import *
x = [1,2,3]; y = [1,2,3]
plot(x,y,ls='',marker='o',ms=1,color='r')
plot(NaN,NaN,ls='',marker='o',ms=1*5,label='test',color='r')
legend()
show()
----------SNAP----------
In other words, make a plot object that has a label, with larger
markers, but no data (NaN's).
Thanks for any help,
Levi K.
The Original post (September 2008):
----------SNIP----------
Dear matplotlib users.
I'm using matplotlib 0.98.3 from the packman repository on opensuse 11.0.
I tried to adjust the 'markerscale option to enlarge a marker size in a
legend.
However, it simply did not work even in a simple code like following.
from pylab import *
x = [1,2,3]; y = [1,2,3]
plot(x,y,ls='',marker='o',ms=1,label='test')
legend(markerscale=5)
show()
I could only get a legend marker in a same size with the plot marker.
I tried to reinstall all the packages related with python, including
matplotlib,
the legend marker size, however, does not change.
Please help me here to change the legend marker size.
Thanks.
-- 
Yong-Duk Jin
----------SNAP----------
From: Tymoteusz J. <tym...@gm...> - 2010年04月04日 06:48:36
Hi!
Can anyone help me to achive this?
I'd like to plot rgb spectrum with matplotlib.
For example let the x axis be green element, and for example... let the y 
axis be red element.
Eventually i'd like to plot 3D figure with all of three elements RGB.
Regards,
T.
From: Alan G I. <ala...@gm...> - 2010年04月04日 03:52:29
On 4/3/2010 11:19 PM, Enzo Michelangeli wrote:
> multiple show() functionality is important for many users (see
> e.g.
> http://www.mail-archive.com/mat...@li.../msg13099.html
> 
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ion
hth,
Alan Isaac
From: Enzo M. <enz...@gm...> - 2010年04月04日 03:20:09
OK, I found the answer myself. It appears that multiple calls to show() are at
the moment officially unsupported, although they do work for some backends on
some platforms (see e.g.
http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show ). In particular,
I have found that: 
- With Qt4Agg they work under Windows (where Qt4Agg is the default backend, at
least in the Python(X,Y) distribution) but under Linux they result in an
"Underlying C/C++ object has been deleted" error at line 64 of backend_qt4.py
- With TkAgg they fail silently under Linux (where TkAgg is the default backend,
and under Windows they cause a "Fatal Python error: PyEval_RestoreThread: NULL
tstate" exception
- with GTKAgg, not available in my Windows installation, they work well under
Linux, apart from a deprecation warning on the use of GTK.Tooltips() instead of
the new GTK.Tooltip()
Considering that multiple show() functionality is important for many users (see
e.g.
http://www.mail-archive.com/mat...@li.../msg13099.html
) I'd like to ask the backend developers to try their best and support this
feature on as many platforms as possible.
Enzo
From: ericyosho <eri...@gm...> - 2010年04月04日 01:01:16
Year, I think we could do unsorted scatter plot as well, however I'm
still not satisfied with the book tracking routines I have to check
when doing the surface plotting.
Anyway, thanks, man. You saved a lot.
Hope this time, it CC to the mailing list as well. :-)

Showing 13 results of 13

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /