>From the docstring for readshapefile:

A tuple (num_shapes, type, min, max) containing shape file info
    is returned.
    num_shapes is the number of shapes, type is the type code (one of
    the SHPT* constants defined in the shapelib module, see
    http://shapelib.maptools.org/shp_api.html) and min and
    max are 4-element lists with the minimum and maximum values of the
    vertices. If ``drawbounds=True`` a
    matplotlib.patches.LineCollection object is appended to the tuple.

So, you are trying to add the tuple result rather than the line collection
that you have. That said, because readshapefile draws to an axes anyway, it
should already be adding the collection to the axes anyway. Try printing
out the type of the last element of the returned tuple. It should say that
it is a Line3DCollection type, because the Axes3D object should be
converting collections upon being added internally.

I should also note that at this time, mplot3d only supports linear
projections (I am currently working on a fix to support non-linear
projections, but it is still limited to rectilinear coordinates). Also, I
have never actually tried mashing together basemap and mplot3d, so if this
works, let me know!

Cheers!
Ben Root


On Thu, Jul 17, 2014 at 8:22 AM, <clau...@br.ibm.com> wrote:

> Dear colleagues,
>
> Wonder if there is a solution for prejecting a basemap, in my task, its a
> river shapefile, onto a 3D surface plot using Matplotlib.
>
> I've tried to use the Axes3D.ax.add_collection3d(rivers) method but my
> test did throw an error message like this.
>
> # tentatively add basemap to 3D
> m =
> Basemap(llcrnrlon=llclon,llcrnrlat=llclat,urcrnrlon=urclon,urcrnrlat=urclat,
> resolution ='l',area_thresh=1000.)
> river4 =
> m.readshapefile('../maps/KEN_water_lines_dcw','rivers4',drawbounds=True,color='SlateBlue',
> linewidth=1)
> ax.add_collection3d(river4)
>
> Error thrown at the add_collection3d is:   AttributeError: 'tuple' object
> has no attribute 'set_label'.
>
> Any hints or references to a similar example code are welcome.
>
> Regards,
> Claude
>
>
>
>
>
>
>
>
> * Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortolândia
> / SP - Brazil phone:    +55 13 9 9760 0453 <%2B55%2013%209%209760%200453>
> cell:         +55 13 9 8117 3316 <%2B55%2013%209%208117%203316> e-mail:
>  clau...@br.ibm.com <clau...@br.ibm.com> *
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to