I am trying to plot regional map with rivers and lakes contours using Cartopy. This draws a non-existent part of the river inside the lake. See the picture bellow:
The code is as follows:
import cartopy.crs as ccrsimport cartopy.feature as cfeature
import matplotlib as mpl
import matplotlib.pyplot as plt
llcrnrlon = 102.37615967
llcrnrlat = 47.20949936
urcrnrlon = 110.55716705
urcrnrlat = 55.39049911
proj = ccrs.PlateCarree()
# Create a figure and axis object
fig, ax = plt.subplots(figsize=(10, 10), subplot_kw=dict(projection=proj))
# Set the plot extent
ax.set_extent([llcrnrlon, urcrnrlon, llcrnrlat, urcrnrlat])
# Add map features
ax.add_feature(cfeature.LAKES,edgecolor='black',facecolor=cfeature.COLORS['water'])
ax.add_feature(cfeature.RIVERS,edgecolor='blue')
# Add the latitude and longitude grid
gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
linewidth=1, color='gray', alpha=0.5, linestyle='--')
gl.top_labels = False
gl.right_labels = False
gl.xlabel_style = {'size': 12, 'color': 'black'}
gl.ylabel_style = {'size': 12, 'color': 'black'}
# Show the plot
plt.show()
Is there any way to remove this line?
I've already tried using the rendering order with zorder, but it didn't yield any results.
I am trying to plot regional map with rivers and lakes contours using Cartopy. This draws a non-existent part of the river inside the lake. See the picture bellow:
The code is as follows:
import cartopy.crs as ccrsimport cartopy.feature as cfeature
import matplotlib as mpl
import matplotlib.pyplot as plt
llcrnrlon = 102.37615967
llcrnrlat = 47.20949936
urcrnrlon = 110.55716705
urcrnrlat = 55.39049911
proj = ccrs.PlateCarree()
# Create a figure and axis object
fig, ax = plt.subplots(figsize=(10, 10), subplot_kw=dict(projection=proj))
# Set the plot extent
ax.set_extent([llcrnrlon, urcrnrlon, llcrnrlat, urcrnrlat])
# Add map features
ax.add_feature(cfeature.LAKES,edgecolor='black',facecolor=cfeature.COLORS['water'])
ax.add_feature(cfeature.RIVERS,edgecolor='blue')
# Add the latitude and longitude grid
gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
linewidth=1, color='gray', alpha=0.5, linestyle='--')
gl.top_labels = False
gl.right_labels = False
gl.xlabel_style = {'size': 12, 'color': 'black'}
gl.ylabel_style = {'size': 12, 'color': 'black'}
# Show the plot
plt.show()
Is there any way to remove this line?
I've already tried using the rendering order with zorder, but it didn't yield any results.
You can "paint over" this river part by flipping the order of rivers and lakes:
# Add map features
ax.add_feature(cfeature.RIVERS, edgecolor='blue')
ax.add_feature(cfeature.LAKES, edgecolor='black', facecolor=cfeature.COLORS['water'])