matplotlib-basemap

How can I align the y-axis (latitudes) of a map plot and a plot in python

一个人想着一个人 提交于 2019-12-24 07:10:25
问题 I'm trying plot two panels in a plot. The first one (left) is a data with latitude values in its y-axis. The second panel is a map. I wanna that the latitude values of both panels coinciding, but I don't know how get it. I have a code like this: fig_mapa= plt.figure() '''Mapa''' ax1=fig_mapa.add_subplot(122) map = Basemap(llcrnrlon=-90,llcrnrlat=-58.1,urcrnrlon=-32,urcrnrlat=12.6, resolution='f',projection='merc',lon_0=-58,lat_0=-25, ax=ax1) map.drawparallels(np.arange(-90,90.,5), labels=[0,1

How do I install extra python packages on Datalab if they are not supported by pip?

坚强是说给别人听的谎言 提交于 2019-12-24 02:00:55
问题 I tried to install basemap within Datalab using pip: %bash pip install basemap and got the error: Downloading/unpacking basemap Could not find any downloads that satisfy the requirement basemap Cleaning up... No distributions at all found for basemap Storing debug log for failure in /root/.pip/pip.log How do I install extra packages on Datalab if they are not supported by pip? 回答1: Use apt-get install. In a cell of your notebook: %bash apt-get -y update apt-get -y install python-mpltoolkits

How to display a colorbar for a Basemap

被刻印的时光 ゝ 提交于 2019-12-24 00:12:36
问题 I have a shapefile and a series like this: UF Acre 261 Alagoas 657 Amazonas 793 Amapá 162 Bahia 1867 Ceará 5657 Distrito Federal 430 Espírito Santo 1734 Goiás 4110 Maranhão 1421 Minas Gerais 11812 Mato Grosso do Sul 1006 Mato Grosso 1391 Pará 1889 Paraíba 1575 Pernambuco 4019 Piauí 1665 Paraná 3745 Rio de Janeiro 1613 Rio Grande do Norte 1998 Rondônia 3102 Roraima 237 Rio Grande do Sul 5643 Santa Catarina 5372 Sergipe 413 São Paulo 8237 Tocantins 771 Name: 0, dtype: int64 Where UF is the

Basemap Heat error / empty map

本小妞迷上赌 提交于 2019-12-23 09:33:16
问题 I am trying to plot a scattered heat map on a defined geo location. I can very well plot a normal scattered map with no background but I want to combine it with a given lat and lon. I get the following empty map . Input Input: col[2] and col[3] are the x and y co ordinates & Geo Location Lat: 19.997453 , Lon: 73.789802 000000000023 61.0 19.006113 73.009168 000000000054 65.0 19.009249 73.000342 000000000003 19.0 19.001051 73.000080 000000000012 20.0 19.009390 73.008638 000000000061 82.0 19

Python and Interactive Zoom Plot with Matplotlib

≡放荡痞女 提交于 2019-12-23 03:53:06
问题 I am using a Matplotlib plot (with Basemap) inside of a wxPython pane. I have got the plot (US map with scatter plot of cities). I am trying to do some interactive zoom capabilities (select a box on the map and "zoom" into that area only). I have managed to get the toolbar to show, but when i click on the buttons, nothing happens. Seems like the toolbar is just there for show. Any Thoughts? Here is my code: # Set up area for plotting Basemap Plot and scatter plot self.figure = Figure(None,dpi

Keeping map overlay between plots in matplotlib

自闭症网瘾萝莉.ら 提交于 2019-12-23 02:22:30
问题 I am creating a series of lat/long scatterplots on a map from basemap. I am planning on creating thousands of plot, with different lat/long data. To save time I wanted to draw the map overlay only once: map = Basemap(epsg=3395, projection='merc', lat_0=59.45, lon_0=10.5, resolution = 'h', llcrnrlon=minlong, llcrnrlat=minlat, urcrnrlon=maxlong, urcrnrlat=maxlat map.arcgisimage(service='ESRI_Imagery_World_2D', xpixels=3000, verbose=True) However, I find no way of clearing my previous

Keeping map overlay between plots in matplotlib

随声附和 提交于 2019-12-23 02:22:26
问题 I am creating a series of lat/long scatterplots on a map from basemap. I am planning on creating thousands of plot, with different lat/long data. To save time I wanted to draw the map overlay only once: map = Basemap(epsg=3395, projection='merc', lat_0=59.45, lon_0=10.5, resolution = 'h', llcrnrlon=minlong, llcrnrlat=minlat, urcrnrlon=maxlong, urcrnrlat=maxlat map.arcgisimage(service='ESRI_Imagery_World_2D', xpixels=3000, verbose=True) However, I find no way of clearing my previous

Custom markers using Python (matplotlib)

倾然丶 夕夏残阳落幕 提交于 2019-12-23 00:50:18
问题 I would like to know how I can generate the marker for the black colored line shown in this picture. (Source: NCEP & NOAA) It's the marker for a storm or hurricane in standard weather maps. I can probably generate an image file of the marker symbol. But, I am not aware of how I can tell matplotlib to use the image as a marker. 回答1: The marker looks like a 6 . If this is the case, you can use a 6 as a marker as follows: import matplotlib.pyplot as plt x = [1,2,3,4] y = [2,3,1,4] plt.scatter(x

Find a easier way to cluster 2-d scatter data into grid array data

天大地大妈咪最大 提交于 2019-12-22 13:52:18
问题 I have figured out a method to cluster disperse point data into structured 2-d array(like rasterize function ). And I hope there are some better ways to achieve that target. My work 1. Intro 1000 point data has there dimensions of properties (lon, lat, emission) whicn represent one factory located at (x,y) emit certain amount of CO2 into atmosphere grid network : predefine the 2-d array in the shape of 20x20 http://i4.tietuku.com/02fbaf32d2f09fff.png The code reproduced here: #### define the

How can I create a discrete colorbar using a colormap from mpl_toolkits.basemap.cm?

﹥>﹥吖頭↗ 提交于 2019-12-22 08:29:42
问题 When I plot the pcolormesh plot use the colormap from matplotlib.cm (like "jet" , "Set2" , etc), I can use: cMap = plt.cm.get_cmap("jet",lut=6) The colorbar shows like this: But if I want to call the colormap from the Basemap package (like GMT_drywet , GMT_no_green , etc). I can't use plt.cm,get_cmap to get these colormap and divide them. Does mpl_toolkits.basemap.cm have a similiar function like lut ? 回答1: As long as the plot you are making has discrete color values (e.g. contour or contourf