Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75976

Re: Fwd: How to draw a map using python

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Fwd: How to draw a map using python
Date 2014-08-10 11:13 +0100
References <CAPLr9LHmOgFjma_qptZwpPBwoAxXOQ==q+8=cwu19Jv2xGMd6Q@mail.gmail.com> <CAPLr9LEeMhQOyEDhB9dhY=5Oojd_gAUKGKcg4+CioJd62kkc0g@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.12812.1407665628.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 10/08/2014 02:44, Yuanchao Xu wrote:
> 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  2
> 2  3  3  1  1  2
> 1  1  1  1  3  3
> 3  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!
>

See http://matplotlib.org/ specifically 
http://matplotlib.org/basemap/users/examples.html

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Fwd: How to draw a map using python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-10 11:13 +0100

csiph-web