matplotlib-basemap

How to remove/omit smaller contour lines using matplotlib

不问归期 提交于 2019-11-26 21:40:04
问题 I am trying to plot contour lines of pressure level. I am using a netCDF file which contain the higher resolution data (ranges from 3 km to 27 km). Due to higher resolution data set, I get lot of pressure values which are not required to be plotted (rather I don't mind omitting certain contour line of insignificant values). I have written some plotting script based on the examples given in this link http://matplotlib.org/basemap/users/examples.html. After plotting the image looks like this

Matplotlib: draw a selection area in the shape of a rectangle with the mouse

此生再无相见时 提交于 2019-11-26 20:03:23
问题 I want to be able to draw a selection area on a matplotlib plot with a mouse event. I didn't find information on how to do it with python. In the end, I want to be able to draw a region of interest with my mouse on a map created with matplotlib basemap and retrieve the corner coordinates. Anyone has an idea, example, references? Thanks, Greg class Annotate(object): def __init__(self): self.ax = plt.gca() self.rect = Rectangle((0,0), 1, 1, facecolor='None', edgecolor='green') self.x0 = None

How to show shapefile label in python basemap legend?

有些话、适合烂在心里 提交于 2019-11-26 16:38:26
问题 The python Basemap has two contents plotted in it: A multiline shapefile (IL_State_ln) and a scatterplot of some random points within the basemap extent. My interest is in generating a legend that gives information about both shapefile and the scatter points. For now, I am only able to include the points in the legend and not the shapefile. Checking the Basemap API documentation does not provide any information, as the function readshapefile() does not seem to have any label argument. Could

Fill countries in python basemap

自闭症网瘾萝莉.ら 提交于 2019-11-26 09:29:10
问题 Hi I am trying to plot a map using pythons basemap with some countries filled in a certain colour. Is there a quick and easy solution out there?? 回答1: As has already been said by @unutbu, Thomas' post here is exactly what you are after. Should you want to do this with Cartopy, the corresponding code (in v0.7) can be adapted from http://scitools.org.uk/cartopy/docs/latest/tutorials/using_the_shapereader.html slightly: import cartopy.crs as ccrs import matplotlib.pyplot as plt import cartopy.io

Plot only on continent in matplotlib

只谈情不闲聊 提交于 2019-11-26 06:46:14
问题 I am drawing a map using basemap from matplotlib. The data are spreaded all over the world, but I just want to retain all the data on the continent and drop those on the ocean. Is there a way that I can filter the data, or is there a way to draw the ocean again to cover the data? 回答1: There's method in matplotlib.basemap: is_land(xpt, ypt) It returns True if the given x,y point (in projection coordinates) is over land, False otherwise. The definition of land is based upon the GSHHS coastline