matplotlib-basemap

`map.scatter` on basemap not displaying markers

江枫思渺然 提交于 2019-12-01 18:56:33
I have a map of Germany, and the coords of a few cities. plot displays the dots properly. I would like to use scatter instead, in order to be able to color the markets with respect to an other variable and then display a colorbar . The code runs in the console, but the dots are not visualized when I replace map.plot with map.scatter . from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np plt.figure(1) map = Basemap(projection='merc', resolution='l', llcrnrlat=44.0, llcrnrlon=5.0, urcrnrlat=57.0, urcrnrlon=17) map.drawcoastlines() map.drawcountries() map

Python basemap in google colaboratory

徘徊边缘 提交于 2019-12-01 18:29:07
问题 I used to use the following commands to install libgeos and basemap in google colaboratory and it worked perfectly until last week. !apt-get -qq install libgeos-dev !pip install -qq https://github.com/matplotlib/basemap/archive/master.zip from mpl_toolkits.basemap import Basemap, cm The error shows --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-3-f27b0fbc3a52> in <module>() ----> 1 from mpl_toolkits

Python basemap in google colaboratory

十年热恋 提交于 2019-12-01 18:09:15
I used to use the following commands to install libgeos and basemap in google colaboratory and it worked perfectly until last week. !apt-get -qq install libgeos-dev !pip install -qq https://github.com/matplotlib/basemap/archive/master.zip from mpl_toolkits.basemap import Basemap, cm The error shows --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-3-f27b0fbc3a52> in <module>() ----> 1 from mpl_toolkits.basemap import Basemap, cm 2 from matplotlib.patches import Polygon /usr/local/lib/python3.6/dist

Orthographic projection Python

為{幸葍}努か 提交于 2019-12-01 14:42:54
I use orthographic projection to plot maps. I use this programm: from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt import os, sys from sys import argv import pylab from mpl_toolkits.basemap import Basemap, shiftgrid from matplotlib import mpl from matplotlib import rcParams import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.patches as patches import matplotlib.path as path import matplotlib.dates as dt from numpy import linalg import netCDF4 import time import datetime as d import sys import math from mpl_toolkits.axes

Basemap Shapefile visualizing

∥☆過路亽.° 提交于 2019-12-01 12:50:03
After creating some maps with Basemap I got enthusiastic. I want to integrate shapefile information, let's say a polygon, but there are some problems. I downloaded the boarders of bavarian villages here: https://www.arcgis.com/home/item.html?id=b752861d1a08489b9a40337668d4367e Now I want to integrate a polygon for, let's say, Regensburg. I am able to fetch the information with this code, but I have a few problems #!/usr/bin/env python from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import shapefile map = Basemap(projection='merc', resolution='l', area_thresh=0.01,

Basemap Shapefile visualizing

浪子不回头ぞ 提交于 2019-12-01 12:03:35
问题 After creating some maps with Basemap I got enthusiastic. I want to integrate shapefile information, let's say a polygon, but there are some problems. I downloaded the boarders of bavarian villages here: https://www.arcgis.com/home/item.html?id=b752861d1a08489b9a40337668d4367e Now I want to integrate a polygon for, let's say, Regensburg. I am able to fetch the information with this code, but I have a few problems #!/usr/bin/env python from mpl_toolkits.basemap import Basemap import matplotlib

How to plot an irregular spaced RGB image using python and basemap?

感情迁移 提交于 2019-12-01 08:01:27
Given that I have three matrices which describe the data that I want to plot: lons - 2D matrix with [n_lons,n_lats] lats - 2D matrix with [n_lons,n_lats] dataRGB - 3D matrix with [n_lons,n_lats,3] what is the preferred way to plot such data using python and basemap. For pseudo-color data this is quite simple using the pcolormesh method: data - 2D matrix with [n_lons,n_lats] m = Basemap(...) m.pcolormesh(lons,lats,data,latlon=True) From reading the documentation, it seems to me that the imshow command should be used in this case, but for this method regularly gridded data is needed and I would

How to plot an irregular spaced RGB image using python and basemap?

假如想象 提交于 2019-12-01 06:40:40
问题 Given that I have three matrices which describe the data that I want to plot: lons - 2D matrix with [n_lons,n_lats] lats - 2D matrix with [n_lons,n_lats] dataRGB - 3D matrix with [n_lons,n_lats,3] what is the preferred way to plot such data using python and basemap. For pseudo-color data this is quite simple using the pcolormesh method: data - 2D matrix with [n_lons,n_lats] m = Basemap(...) m.pcolormesh(lons,lats,data,latlon=True) From reading the documentation, it seems to me that the imshow

How to create a reusable basemap

徘徊边缘 提交于 2019-11-30 21:46:13
In continuation to my previous question: How to superimpose figures in matplotlib i would like to know how can one create a reusable basemap object. My problem is that a basemap is not a pyplot object, so the solution i received works well on figures / axes but not on basemap objects. I tried to look around and find a solution, but couldn't find any, just discussions. Shai Efrati Thanks to @JoeKington here and @EdSmith at How to superimpose figures in matplotlib , i was able to understand how to achieve what i wanted: reuse basemap objects and pass them around. I made it this way: Created a

plot gebco data in python basemap

我的未来我决定 提交于 2019-11-30 16:40:20
I have downloaded some gebco bathymetry data as a netCDF file. I would like to plot it with python-basemap. I have tried, import netCDF4 from mpl_toolkits.basemap import Basemap # Load data dataset = netCDF4.Dataset('/home/david/Desktop/GEBCO/gebco_08_-30_45_5_65.nc') # Extract variables x = dataset.variables['x_range'] y = dataset.variables['y_range'] spacing = dataset.variables['spacing'] # Data limits nx = (x[-1]-x[0])/spacing[0] # num pts in x-dir ny = (y[-1]-y[0])/spacing[1] # num pts in y-dir # Reshape data zz = dataset.variables['z'] Z = zz[:].reshape(ny, nx) # setup basemap. m =