Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75962
| References | <CAPLr9LHmOgFjma_qptZwpPBwoAxXOQ==q+8=cwu19Jv2xGMd6Q@mail.gmail.com> |
|---|---|
| From | Yuanchao Xu <xuyuanchao37@gmail.com> |
| Date | 2014-08-10 03:44 +0200 |
| Subject | Fwd: How to draw a map using python |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12804.1407635124.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
To kind whom it may concern: I want to draw a map using python, not really a map with full information, just a get together of a series of small shapes to reflect land use. The data is like below 1 2 2 3 3 22 3 3 1 1 21 1 1 1 3 33 3 3 3 4 1 Each number represents one land use type. and their positions in the matrix are their coordinates. I used VBA to do that before, the whole map consists many small square shapes representing land use, but since the data was so large, it took a long time to generate the map, also delete the map. My question are : 1. I wonder in python, is there any more fast way to generate this kind of map, as a whole, not a series of shapes, i think that would be faster?? 2. I have tried using contourf, as below, but it says "out of bounds for axis 1", but actually, I printed X,Y and cordi, they have the same shape, why still out of bounds? 1. y = np.arange(0, 4 , 1) x = np.arange(0, 6 , 1) X,Y = np.meshgrid(x,y) # cordi is the matrix containing all the data# pyplot is imported before plt.contourf(X,Y, Cordi[X,Y], 8, alpha=.75, cmap='jet') 3. Some kind person has suggested me to use imshow to plot. I checked the explanation of imshow, it deals more about images not plots, and it needs a 3D array to plot, in which for each pixel it needs 3 values to show the color. I also tried, not so acceptable. The interfaces of each color are so vague, and besides, when the data is large, it just failed to present. So, if I use imshow, could I have some way to avoid those two problems? Thank you very much for answering!
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Fwd: How to draw a map using python Yuanchao Xu <xuyuanchao37@gmail.com> - 2014-08-10 03:44 +0200
csiph-web