[Matplotlib-users] plot rgb spectrum

2010-04-04 Thread Tymoteusz Jankowski
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.

--
Download Intel#174; 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] legend markerscale does not work

2010-04-04 Thread Levi Kilcher
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--

--
Download Intel#174; 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Closing a pyplot window under MSWindows and under Linux

2010-04-04 Thread Enzo Michelangeli
Alan G Isaac alan.is...@... 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 


--
Download Intel#174; 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbar() and plt.title()

2010-04-04 Thread Claus
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


--
Download Intel#174; 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot rgb spectrum

2010-04-04 Thread Gary Ruben

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.


import matplotlib.pyplot as plt
import numpy as np

a = np.outer(np.arange(0,256), np.ones(256,dtype=np.uint8))
rgb = np.zeros((256,256,3), dtype=np.uint8)
rgb[:,:,0] = a
rgb[:,:,1] = a.T
plt.imshow(rgb, origin='lower', interpolation='nearest')
plt.show()--
Download Intel#174; 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] \def in mathtext

2010-04-04 Thread Václav Šmilauer
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


--
Download Intel#174; 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap/ orthographic projection plot doesn't respect globe boundary

2010-04-04 Thread Will Hewson

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)/4.)+1; ny = int((m.ymax-m.ymin)/4.)+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#174; 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
 Matplotlib-users@lists.sourceforge.net
 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.


--
Download Intel#174; 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users