plot(x,y) Trouble?

I find this puzzling. It seems as though the x,y points in some fashion can vary.

plot(2.8,3.4) doesn't work in my program
plot([2.8],[3.4]) does work
plot((2.8,3.4)) apparently creates two points

Here's code where I have had to make x,y each a list. I've made comments about the behavior of x,y

         fig = figure()
         ax1 = fig.add_subplot(111)
         v = (0, 640, 0, 480) # min, max on x and y
         ax1.plot(xy[:,0], xy[:,1]) # draw all the lines
         title(afname)
         ylabel('vertical pixels')
         xlabel('horizontal pixels')
         # An attempt to draw an easy large circle. It worked, but zoom moves the circle. 320,235 not locked
         # If use (320,235), then get two circles.
         # ax1.plot([320],[235], marker='o', mfc='y', ms=400) # draw large circle
         ax1.plot([xy[0,0]],[xy[0,1]],'gs') # place marker at start. Had to "list-ize" array columns, but seems right
         ax1.plot([xy[npts-1,0]], [xy[npts-1,1]],'rs') # mark it is a last frame. More list-izing, but seems right
         ax1.plot([xy[k_max,0]], [xy[k_max,1]], marker='+', mec='g', ms=15) # mark maximum dist frame. Same listizing
         # Next is required for what I'm pretty sure are float64 numbers
         ax1.plot([amax_x], [amax_y], marker='o', mec='m',ms=5) # mark max amplitude.
         ax1.axis(v)
         show()

I think the zoom difficulty can be handled with patches. An area I have yet to probe.

···

--
             "There is nothing so annoying as to have two people
              talking when you're busy interrupting." -- Mark Twain

plot(2.8,3.4) doesn't work in my program
   
Why should it?
Plot takes once or two *sequences* of numbers as arguments.

plot([2.8],[3.4]) does work
   
Well yes, that is two sequences.

plot((2.8,3.4)) apparently creates two points
   
Yes, if you only provide one sequence,
it is treated as the ordinates (i.e., second coordinates),
and the abscissas are generated for you.

See the examples in the documentation:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot

Alan Isaac

···

On 2/21/2010 10:29 AM, Wayne Watson wrote:

Wayne's confusion on the admissible arguments to 'plot' led me to look
again at the documentation. I suggest adding the following as the second
sentence:

     Here x and y are sequences of numbers,
     which are the first and second coordinates
     of the points to be plotted.

Alan Isaac

···

On 2/21/2010 10:44 AM, Alan G Isaac wrote:

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot

Alan G Isaac wrote:

plot(2.8,3.4) doesn't work in my program
   
Why should it?
Plot takes once or two *sequences* of numbers as arguments.

In more recent versions than the OP has, it can also handle
plot(2.8, 3.4, 'o')

With a single point, of course, one must specify a marker, as above.

Eric

···

On 2/21/2010 10:29 AM, Wayne Watson wrote:

plot([2.8],[3.4]) does work
   
Well yes, that is two sequences.

plot((2.8,3.4)) apparently creates two points
   
Yes, if you only provide one sequence,
it is treated as the ordinates (i.e., second coordinates),
and the abscissas are generated for you.

See the examples in the documentation:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot

Alan Isaac

------------------------------------------------------------------------------
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
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Thanks. A small lesson in sequences. I'm slowly beginning to breath Python air.

···

On 2/21/2010 7:44 AM, Alan G Isaac wrote:

On 2/21/2010 10:29 AM, Wayne Watson wrote:
   

plot(2.8,3.4) doesn't work in my program

Why should it?
Plot takes once or two *sequences* of numbers as arguments.

plot([2.8],[3.4]) does work

Well yes, that is two sequences.

plot((2.8,3.4)) apparently creates two points

Yes, if you only provide one sequence,
it is treated as the ordinates (i.e., second coordinates),
and the abscissas are generated for you.

See the examples in the documentation:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot

Alan Isaac

------------------------------------------------------------------------------
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
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
             "There is nothing so annoying as to have two people
              talking when you're busy interrupting." -- Mark Twain