[Tutor] Issues Inserting Graphical Overlay Using Matplotlib Patches

Alan Gauld alan.gauld at yahoo.co.uk
Mon Sep 28 17:26:57 EDT 2020


On 28/09/2020 17:24, Stephen Malcolm wrote:

> I've highlighted the code (in red) 

Note that the tutor list is a plain text list so any text
attributes/colors will be lost. However....

> graph.scatter(data[:,0])data[:,1])
> graph.scatter(mean[0], mean[1])
> graph.add_patch(ellipse)
> 
> Error states:
> 
> ile "<ipython-input-21-1a9b341de4cf>", line 16
>     graph.scatter(data[:,0])data[:,1])
>                                ^
> SyntaxError: invalid syntax
> 
> Can someone please tell me where I'm going wrong?

As the error states you have a syntax error, the line
is not valid Python.
Look at the parentheses.

graph.scatter(data[:,0])data[:,1])

I'm guessing it should say:

graph.scatter(data[:,0],data[:,1])

?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list