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!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.036 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'python,': 0.02; 'interfaces': 0.04; 'represents': 0.05; 'concern:': 0.09; 'explanation': 0.09; 'imported': 0.09; 'pixel': 0.09; 'pyplot': 0.09; 'subject:using': 0.09; 'whole,': 0.09; 'subject:How': 0.10; 'bounds': 0.16; 'color.': 0.16; 'shape,': 0.16; 'skip:n 90': 0.16; 'subject:python': 0.16; 'large,': 0.24; 'question': 0.24; 'suggested': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'array': 0.29; 'wonder': 0.29; 'message- id:@mail.gmail.com': 0.30; 'checked': 0.32; 'says': 0.33; 'whom': 0.33; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'reflect': 0.36; 'representing': 0.36; 'skip:s 60': 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; '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; '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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=PHzT+zOqDdHt3YnRXYRc+8IGsIcfghwDYPt+B1TNMgI=; b=UV7o4YVQfPRGENVwUyHc+vsNhI1LrF7ejyPALpcROwAmO3AXCRGtcMRfVpmsWaQQL+ 2dUneg/KavaroAVPzUY3LnA5sUCIA4PvhnYaO8jXZsUObvej6R0E+Cy3YV7YirKA5kI4 YSwtNdOmkuvohYTuk3scIuTOUF+ZcHRCAyWjceW9Ljnl+9aKaidIMLeaAFqWDQfGF5K1 5COHpsL9VdiAgMIXrvfdnwU/EbPz+P1V0OVH5UPPLez6+DWDUvuqr2jnmdz8+vHc3S3T mNKZywl5fv377sf0JH7ziT1bwdSOeJ+9dMVaUAKIAr8gui1ueUx3lfn4qGyQ7GUn0E+G 5kDQ== X-Received: by 10.182.119.230 with SMTP id kx6mr58316obb.72.1407635116247; Sat, 09 Aug 2014 18:45:16 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Yuanchao Xu Date: Sun, 10 Aug 2014 03:44:56 +0200 Subject: Fwd: How to draw a map using python To: python-list@python.org Content-Type: multipart/alternative; boundary=001a11c30b9413d2fb05003c974e 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: 307 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407635124 news.xs4all.nl 2937 [2001:888:2000:d::a6]:37271 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75962 --001a11c30b9413d2fb05003c974e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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=EF=BC= =9F=EF=BC=9F 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 =3D np.arange(0, 4 , 1) x =3D np.arange(0, 6 , 1) X,Y =3D 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=3D.75, cmap=3D'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! --001a11c30b9413d2fb05003c974e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
To kind whom i= t may concern:

I want to draw a map using python, not re= ally 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 thi= nk that would be faster=EF=BC=9F=EF=BC=9F

2. I hav= e 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, w= hy still out of bounds?
  1. 
    y =3D np.arange(0,<=
    span style=3D"margin:0px;padding:0px;border:0px;vertical-align:baseline;bac=
    kground:transparent"> 4 , 1)
    x =3D np.arange(0, 6 , 1)
    X,Y =3D np.meshgrid(x,y)
    
    # cordi is the matrix c=
    ontaining all the data
    # pyplot is imported be=
    fore
    
    plt.contourf(X,Y, Cordi[X=
    ,Y], 8, al=
    pha=3D.75, cmap=
    =3D'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 prob= lems?


Thank you very much for answering!

--001a11c30b9413d2fb05003c974e--