[Tutor] Fwd: Re: Fwd: Re: Created map after opening file
Alan Gauld
alan.gauld at alan-g.me.uk
Fri Oct 21 13:05:58 EDT 2016
Forwarding to list
-------- Forwarded Message --------
I can now see my data.
Current view: https://s15.postimg.org/ni570gxl7/pyscreenshot2.png
Yes, you are correct on how the points are going to be plotted. My
question is, how do you plot only rows on python?
I found an example online, but the data is in columns.
(http://www.ast.uct.ac.za/~sarblyth/pythonGuide/PythonPlottingBeginnersGuide.pdf,
pg. 14).
How do I change this particular part on the example so it reads the
rows: pl.plot(data[:,0], data[:,1], ’ro’):: Or will this not work in
this case? I was thinking of making two arrays like this: x=np.array []
and y=np.array[] and the inserting the data between the brackets, but
then though wouldn't that defeat the purpose of the file?
On Thu, Oct 20, 2016 at 12:45 PM, Alan Gauld <alan.gauld at alan-g.me.uk
<mailto:alan.gauld at alan-g.me.uk>> wrote:
Resending after mail error, apologies if you get two!
-------------------------------------------
Always use Reply All (Or Reply List) to reply to the tutor list...
On 20/10/16 14:45, Betty Cruz wrote:
> I had actually attached the map and how the data looked. I guess the
> pictures didn't go through? I have added links.
>
The server often strips attachments, it's always better to
include as text or provide a link if it's big.
>
> The data looks like this:
> 10000 10000 10000 7367 7367 7367
> 10000 29410 29410 29410 29410 36101
So the points you want to plot are:
(10000,10000), (10000,294210),(10000,29410)(again?), (7367,29410)...
correct?
> https://i.stack.imgur.com/tUvBj.png
<https://i.stack.imgur.com/tUvBj.png>
>
> I have tried printing it out, but I just get this error: No such file
> or directory: 'map.dat'
Have you tried using the full path?
eg:
data = np.loadtxt(r'C:/myfolder/map.dat')
Python is looking in the current working directory
for the file and not finding it.
> I added print (data) after data = np.loadtxt('map.dat'), but that
> didn't work.
Yes, that will only work once you get the file path sorted out.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
<http://www.amazon.com/author/alan_gauld>
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
<http://www.flickr.com/photos/alangauldphotos>
_______________________________________________
Tutor maillist - Tutor at python.org <mailto:Tutor at python.org>
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
<https://mail.python.org/mailman/listinfo/tutor>
More information about the Tutor
mailing list