Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'from:addr:yahoo.co.uk': 0.04; 'interfaces': 0.04; 'represents': 0.05; 'concern:': 0.09; 'explanation': 0.09; 'imported': 0.09; 'lawrence': 0.09; 'pixel': 0.09; 'pyplot': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'whole,': 0.09; 'subject:How': 0.10; 'language.': 0.14; 'bounds': 0.16; 'color.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'shape,': 0.16; 'subject:python': 0.16; 'language': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'large,': 0.24; 'question': 0.24; 'suggested': 0.26; 'values': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'specifically': 0.29; 'array': 0.29; 'wonder': 0.29; 'checked': 0.32; 'says': 0.33; 'whom': 0.33; 'could': 0.34; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'reflect': 0.36; 'representing': 0.36; 'url:org': 0.36; 'so,': 0.37; 'two': 0.37; 'thank': 0.38; 'to:addr:python-list': 0.38; 'use.': 0.39; 'delete': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'consists': 0.60; 'color': 0.61; 'full': 0.61; 'took': 0.61; 'subject:Fwd': 0.61; 'information,': 0.61; 'show': 0.63; 'kind': 0.63; 'skip:n 10': 0.64; 'our': 0.64; 'map': 0.64; 'more': 0.64; 'deals': 0.65; 'land': 0.65; 'series': 0.66; 'positions': 0.67; 'containing': 0.69; 'present.': 0.74; 'square': 0.74; 'actually,': 0.84; 'vba': 0.84; 'problems?': 0.91; 'besides,': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Fwd: How to draw a map using python Date: Sun, 10 Aug 2014 11:13:32 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: host-78-146-2-242.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 64 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407665628 news.xs4all.nl 2936 [2001:888:2000:d::a6]:56963 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75976 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