[Matplotlib-users] Scattered symbols data

2010-07-19 Thread Clear

Hello,

I would like to know if it is possible to display the following feature
using matplotlib. Say that you have a 2D plot(x,y) with a lot of data. You
plot the data using a 2D solid line. Would be possible to add some
circles/squared or whatever to the solid line? When I say some I mean only
scattered values, otherwise given the quantity of data you would appreciate
the symbols.

Thanks,

Clear
-- 
View this message in context: 
http://old.nabble.com/Scattered-symbols-data-tp29173029p29173029.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] radar_chart in matplotlib doc does not work

2010-07-19 Thread texas_ranger

The source code for radar_chart.py located in the Matplotlib docs at 

http://matplotlib.sourceforge.net/examples/api/radar_chart.html?highlight=radar%20chart

does not work. Seems to be problem with legend.

Can someone tell me what's wrong with the source code so I can correct my
copy?

-- 
View this message in context: 
http://old.nabble.com/radar_chart-in-matplotlib-doc-does-not-work-tp29177027p29177027.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Double y-axis with the same 0

2010-07-19 Thread Daniele Padula

 Hi everybody,
I have a problem with a plot. I attach a figure to be easily understandable.

As you can see from the figure, I have in the same area a line and a bar 
plot. The problem is that y=0 for right y axis is different with respect 
to left y axis one. I want the two y=0 to be the same.


How can i do that?

Excuse me for my bad english, I'm italian :)

Thanks in advance.
attachment: plot.png--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Scattered symbols data

2010-07-19 Thread João Luís Silva
On 07/15/2010 02:36 PM, Clear wrote:

 Hello,

 I would like to know if it is possible to display the following feature
 using matplotlib. Say that you have a 2D plot(x,y) with a lot of data. You
 plot the data using a 2D solid line. Would be possible to add some
 circles/squared or whatever to the solid line? When I say some I mean only
 scattered values, otherwise given the quantity of data you would appreciate
 the symbols.

 Thanks,

 Clear

You can specify the parameter markevery=n to the plot to just plot every 
n-th marker. For example:

import matplotlib.pyplot as plt
import numpy as np
N = 1
x = np.linspace(-10.0,10.0,N)
plt.plot(x,np.sin(x),-s,markevery=N/50)
plt.show()


Regards,
João Luís


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Display the 'full' value on y axis

2010-07-19 Thread Malte Dik
Hi,

as you can see here (lotlib.sourceforge.net/api/ticker_api.html),
you need to set your formatter to either ScalarFormatter and set it up, so no 
offset is used or FormatStrFormatter with something like %d.


Kind regards,

Malte Dik

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Scattered symbols data

2010-07-19 Thread Clear

plt.plot(x,np.sin(x),-s,markevery=N/50)

I have tried your option but a message is returned to me which says that
markevery is an unknown property. I have included exactly the code you
propose. May I guess why I am getting such error?

Clear


-- 
View this message in context: 
http://old.nabble.com/Scattered-symbols-data-tp29204418p29205124.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] radar_chart in matplotlib doc does not work

2010-07-19 Thread Benjamin Root
On Thu, Jul 15, 2010 at 2:44 PM, texas_ranger dwba...@gmail.com wrote:


 The source code for radar_chart.py located in the Matplotlib docs at


 http://matplotlib.sourceforge.net/examples/api/radar_chart.html?highlight=radar%20chart

 does not work. Seems to be problem with legend.

 Can someone tell me what's wrong with the source code so I can correct my
 copy?


The version that is in svn trunk works fine for me, and it hasn't been
changed since last year.  I wonder what the document generator is crashing
on?

Ben Root
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Scattered symbols data

2010-07-19 Thread João Luís Silva
On 07/19/2010 03:11 PM, Clear wrote:

 plt.plot(x,np.sin(x),-s,markevery=N/50)

 I have tried your option but a message is returned to me which says that
 markevery is an unknown property. I have included exactly the code you
 propose. May I guess why I am getting such error?

 Clear



Are you sure you ran the example as I sent it? markevery should be 
available since matplotlib version 0.98.5.2, released at the end of 
2008. Which mpl version and operating system are you using?

JLS


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] centering xticks in bar plot

2010-07-19 Thread Bala subramanian
Friends,

Attached a script test.py and 2 data files using with which i am trying to
make a bar plot. The output is coming nice, but the x-ticks are placed at
the left edge of the first bar. I want to make the xticks at the center
between the two bars to have a better visualization. I dnt get which
arguement i should use to get the xticks at the center of the two bars as in
the following example

http://matplotlib.sourceforge.net/examples/pylab_examples/barchart_demo.html

Thanks,
Bala
#!/usr/bin/env python   
import matplotlib.pyplot as plt
import numpy as np
from sys import argv
# user input section, input file and bound range
data1=np.loadtxt('T1.sasa',usecols=(1,))
data2=np.loadtxt('T2.sasa',usecols=(1,))

tot1=np.sum(data1); tot2=np.sum(data2)
ind=np.arange(1,len(data1)+1)
width=0.5
new1=(data1/tot1)*100
new2=(data1/tot2)*100

# figure creation
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('SASA')
R1=ax.bar(ind,new1,width,color='black')
R2=ax.bar(ind+width,new2,width,color='red')

ax.set_xlim([1,40])
ax.set_xticks(ind)


plt.show()






T1.sasa
Description: Binary data


T2.sasa
Description: Binary data
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with twinx and autofmt_xdate

2010-07-19 Thread Benjamin Root
On Wed, Jul 14, 2010 at 4:54 AM, Robert Hancock r...@agelada.co.uk wrote:

 Hi

 I am trying to use autofmt_xdate() on graphs with more than 1 y-axis. But
 it
 seems that even calling twinx() causes errors. On python 2.5 matplotlib
 0.98
 a call to twinx() seems to switch off the functioning of autofmt_xdate()
 (and the labels are horizontal and mashed up). On python 2.6 and matplotlib
 1.0.0 it causes a ValueError.

 The following script illustrates the issue (in real life I obviously want
 to
 do things with ax2, but it seems that even creating it causes problems). Is
 there a simple working example of rotated data formats and twinx()?

 robert

 import datetime
 import matplotlib
 matplotlib.use('Agg')
 import matplotlib.pyplot as plt

 date=[datetime.datetime(2010,1,1), datetime.datetime(2010,12,1)]
 data=[1,2]

 fig = plt.figure()
 ax = fig.add_subplot(111)
 # uncommenting the following line will lead to the problems
 # ax2=ax.twinx()
 ax.plot(date, data)

 fig.autofmt_xdate(rotation=90)

 fig.savefig(test3.png, dpi=400)



For further information, here is the Value Error on matplotlib 1.0
(replacing the savefig with a show):

Traceback (most recent call last):
  File
/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_gtk.py,
line 389, in expose_event
self._render_figure(self._pixmap, w, h)
  File
/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_gtkagg.py,
line 75, in _render_figure
FigureCanvasAgg.draw(self)
  File
/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_agg.py,
line 394, in draw
self.figure.draw(self.renderer)
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/artist.py,
line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/figure.py,
line 798, in draw
func(*args)
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/artist.py,
line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/axes.py,
line 1934, in draw
a.draw(renderer)
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/artist.py,
line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/axis.py,
line 971, in draw
tick_tups = [ t for t in self.iter_ticks()]
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/axis.py,
line 904, in iter_ticks
majorLocs = self.major.locator()
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/dates.py,
line 743, in __call__
self.refresh()
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/dates.py,
line 752, in refresh
dmin, dmax = self.viewlim_to_dt()
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/dates.py,
line 524, in viewlim_to_dt
return num2date(vmin, self.tz), num2date(vmax, self.tz)
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/dates.py,
line 289, in num2date
if not cbook.iterable(x): return _from_ordinalf(x, tz)
  File /home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/dates.py,
line 203, in _from_ordinalf
dt = datetime.datetime.fromordinal(ix)
ValueError: ordinal must be = 1

Ben Root
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Scattered symbols data

2010-07-19 Thread Clear

My MPL version is '0.98.5.2' and my OS is Ubuntu 9.04. I tried again but it
is still giving me that error. Weird.



João Luís Silva-2 wrote:
 
 On 07/19/2010 03:11 PM, Clear wrote:

 plt.plot(x,np.sin(x),-s,markevery=N/50)

 I have tried your option but a message is returned to me which says that
 markevery is an unknown property. I have included exactly the code you
 propose. May I guess why I am getting such error?

 Clear


 
 Are you sure you ran the example as I sent it? markevery should be 
 available since matplotlib version 0.98.5.2, released at the end of 
 2008. Which mpl version and operating system are you using?
 
 JLS
 
 
 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 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/Scattered-symbols-data-tp29204418p29205784.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] centering xticks in bar plot

2010-07-19 Thread Benjamin Root
On Mon, Jul 19, 2010 at 9:55 AM, Bala subramanian bala.biophys...@gmail.com
 wrote:

 Friends,

 Attached a script test.py and 2 data files using with which i am trying to
 make a bar plot. The output is coming nice, but the x-ticks are placed at
 the left edge of the first bar. I want to make the xticks at the center
 between the two bars to have a better visualization. I dnt get which
 arguement i should use to get the xticks at the center of the two bars as in
 the following example


 http://matplotlib.sourceforge.net/examples/pylab_examples/barchart_demo.html

 Thanks,
 Bala


Bala,

There are two issues with your current code.  First, you are setting the x
limits of your plot to [1, 40], which causes the last red bar to be clipped
out.  You should set it to [1, 40 + width].  Second, the set_xticks() needs
to be shifted by width.  However, doing so will change the values. So, it
seems that if you change

ax.set_xticks(ind)

to

plt.xticks(ind + width, ind)

The ticks will be placed at the positions 'ind + width', but with the values
'ind'.  I hope this helps.

Ben Root
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Axes3D and tricontours.

2010-07-19 Thread Daniel Welling
Greetings, MPL Users.

I have been experimenting with Axes3D with the hopes that I could create
some 3d lines and then project some contours on different planes in the 3D
axes object, much like the contour3d_demo3.py example (but with lines
instead of the 3d wireframe.)  The catch, however, is creating the contour
objects using tricontour instead of a regular contour.  Being that I
typically use irregular grids for my research, the triangulate module has
been a tremendous feature, but it doesn't seem to work with Axes3D objects.

For example, this quick script:
import matplotlib.pyplot as plt
#import matplotlib.tri as tri
import numpy as np
from numpy.random import uniform, seed
from mpl_toolkits.mplot3d import Axes3D

seed(0)
npts = 200
ngridx = 100
ngridy = 200
x = uniform(-2,2,npts)
y = uniform(-2,2,npts)
z = x*np.exp(-x**2-y**2)

# tricontour.
fig = plt.figure()
ax = Axes3D(fig)
ax.tricontour(x, y, z, 15, zdir=x, offset=-2)

plt.show()

creates a huge traceback, listed below.
Is it possible to combine tricontour with Axes3D?  It would appear that they
are just incompatible, but perhaps there is a way to force it to work?
Thanks for your help.

tricont3d.py in module()
 20 ax.tricontour(x, y, z, 15, zdir=x, offset=-2)
 21
--- 22 plt.show()
 23
 24

python2.6/site-packages/matplotlib/backends/backend_qt4.pyc in show()
 69 figManager =  Gcf.get_active()
 70 if figManager != None:
--- 71 figManager.canvas.draw()
 72
 73 if _create_qApp.qAppCreatedHere:

python2.6/site-packages/matplotlib/backends/backend_qt4agg.pyc in draw(self)
128 if DEBUG: print FigureCanvasQtAgg.draw, self
129 self.replot = True
-- 130 FigureCanvasAgg.draw(self)
131 self.update()
132
site-packages/matplotlib/backends/backend_agg.pyc in draw(self)
392
393 self.renderer = self.get_renderer()
-- 394 self.figure.draw(self.renderer)
395
396 def get_renderer(self):

python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist,
renderer, *args, **kwargs)
 53 def draw_wrapper(artist, renderer, *args, **kwargs):
 54 before(artist, renderer)
--- 55 draw(artist, renderer, *args, **kwargs)
 56 after(artist, renderer)
 57

python2.6/site-packages/matplotlib/figure.pyc in draw(self, renderer)
796 dsu.sort(key=itemgetter(0))
797 for zorder, func, args in dsu:
-- 798 func(*args)
799
800 renderer.close_group('figure')

python2.6/site-packages/mpl_toolkits/mplot3d/axes3d.pyc in draw(self,
renderer)
152 # Calculate projection of collections and zorder them

153 zlist = [(col.do_3d_projection(renderer), col) \
-- 154  for col in self.collections]
155 zlist.sort()
156 zlist.reverse()

AttributeError: 'LineCollection' object has no attribute 'do_3d_projection'
WARNING: Failure executing file: tricont3d.py
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Installation problem

2010-07-19 Thread Stavros Macrakis
I loaded matplotlib following the instructions in
http://matplotlib.sourceforge.net/users/shell.html, including setting up the
matplotlibrc file.  But the xlabel command hangs.

In detail:

bash-3.2$ python -i
Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)]
on win32
Type help, copyright, credits or license for more information.
 import pylab
 from pylab import *
 plot([1,2,1])
--displays
plot
[matplotlib.lines.Line2D object at 0x019DE430]
 xlabel('hi mom')
--hangs
forever---

I am running Python 2.6.1 in an Emacs shell buffer; the Python is running on
Cygwin on Windows XP.  I am not using ipython.

What am I doing wrong?

Thanks,

-s
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users