|
From: Wayne W. <sie...@sb...> - 2010-02-21 15:29:41
|
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
|
|
From: Alan G I. <ala...@gm...> - 2010-02-21 15:45:30
|
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 |
|
From: Andrea G. <and...@gm...> - 2010-02-21 15:52:49
|
On 21 February 2010 15:44, 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? I believe it should. > Plot takes once or two *sequences* of numbers as arguments. I don't think it would be so complicated for the "plot" code to check for the type of the input arguments and then create a list (or a sequence) on the fly, i.e. (pseudo-code, untested): if isinstance(x, types.IntType): x = [x] The same apply for the second input. As it appears to work in tools like Matlab, I don't see why MPL should not support it. But then, I am no expert in MPL so it might be difficult to do it for other reasons. Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://xoomer.alice.it/infinity77/ http://thedoomedcity.blogspot.com/ |
|
From: Gael V. <gae...@no...> - 2010-02-21 16:27:25
|
On Sun, Feb 21, 2010 at 03:52:41PM +0000, Andrea Gavana wrote:
> On 21 February 2010 15:44, 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?
> I believe it should.
> > Plot takes once or two *sequences* of numbers as arguments.
> I don't think it would be so complicated for the "plot" code to check
> for the type of the input arguments and then create a list (or a
> sequence) on the fly, i.e. (pseudo-code, untested):
> if isinstance(x, types.IntType):
> x = [x]
Or rather:
np.atleast_1d
Gaël
|
|
From: John H. <jd...@gm...> - 2010-02-21 17:13:22
|
On Sun, Feb 21, 2010 at 9:52 AM, Andrea Gavana <and...@gm...> wrote: > On 21 February 2010 15:44, 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? > > I believe it should. It does in svn -- though it unhelpfully plots a line segment with one vertex (invisible). Eric, I think you added this support. For length one sequences, perhaps we should default to a marker? |
|
From: Alan G I. <ala...@gm...> - 2010-02-21 15:53:51
|
On 2/21/2010 10:44 AM, Alan G Isaac wrote: > http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot > 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 |
|
From: Eric F. <ef...@ha...> - 2010-02-21 18:10:27
|
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. 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 > >> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Eric F. <ef...@ha...> - 2010-02-21 18:16:36
|
John Hunter wrote: > On Sun, Feb 21, 2010 at 9:52 AM, Andrea Gavana <and...@gm...> wrote: >> On 21 February 2010 15:44, 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? >> I believe it should. > > It does in svn -- though it unhelpfully plots a line segment with one > vertex (invisible). Eric, I think you added this support. For length > one sequences, perhaps we should default to a marker? I don't think so; this strikes me as a step too far. Anyone plotting a single point should know that they need a marker, and that they have to specify which marker to use. If they don't know it, they need to learn it PDQ. There is a limit to the usefulness of trying to guess, or provide defaults, and providing a default marker for this case is beyond that limit. A reasonable argument could be made that I should not even have added the non-sequence support. Eric |
|
From: David G. <d_l...@ya...> - 2010-02-23 07:01:14
|
I've searched and searched the online docs...please help.
DG
|
|
From: Philipp B. <li...@ro...> - 2010-02-23 07:18:48
|
Hi David,
I found this one::
xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
On the page
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xticks
If I had that problem I would try to do something like that:
xvalues = linspace(0,100,1000)
xticks(xvalues, ["%.2f" % val for val in xvalues])
# or, with a lambda expression, but in #python they say
# a list comprehension is better (faster)
xticks(xvalues, map(lambda i : "%.2f" % i, xvalues))
The side effect is, of course, that the tick is not exactly at the position he
indicates. Maybe you better use "arange()" to get the right values for your
ticks, just make sure that they cover the interval your xvalues are in.
If you find a better solution, please let me know.
Best regards,
Philipp
|
|
From: Stephen G. <ste...@op...> - 2010-02-23 08:26:51
|
David Goldsmith wrote: > I've searched and searched the online docs...please help. > > DG > If I understand your question correctly you probably need to look at http://matplotlib.sourceforge.net/api/ticker_api.html#tick-formatting ax.xaxis.set_major_formatter( xmajorFormatter ) ax.xaxis.set_minor_formatter( xminorFormatter ) - Steve |
|
From: Jon M. <jon...@ya...> - 2010-02-23 10:34:13
|
Hi, I'm using the Python(x,y) distribution which comes with matplotlib for Windows. My OS is Windows XP with all updates and service packs on an AMD Athlon 2600+ PC with ATI Radeon 9600 graiphics card. Python will work fine for anything that doesn't import the pylab component (I can import matplotlib itself no problem as well as numpy etc) but if I try to import pylab I get:- "An unhandled exception occured in pythonw.exe [3976]" I've tied reinstalling Python(x,y) and even reinstalling windows then Python(x,y) but to no avail. This seems odd to me as 2 other PCs at work install Python(x,y) and run Pylab fine. Any suggestions as to what I should check to track down this error? Thanks Jon __________ Information from ESET NOD32 Antivirus, version of virus signature database 4888 (20100222) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com |
|
From: Wayne W. <sie...@sb...> - 2010-02-22 00:05:37
|
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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- "There is nothing so annoying as to have two people talking when you're busy interrupting." -- Mark Twain |