如何在Matplotlib中更改颜色气泡图

时间:2020-03-13 16:36:05

标签: python pandas matplotlib

我尝试绘制气泡图,但是我无法更改气泡和颜色条的颜色,知道吗?

这是我的代码:

# Libraries
import pandas as pd
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from matplotlib import pyplot as plt
import numpy as np


# Set the dimension of the figure
my_dpi=96
plt.figure(figsize=(2600/my_dpi, 1800/my_dpi), dpi=my_dpi)

# read the data (on the web)
data = pd.read_csv("dengue_1990_2019.csv", sep=";")

# Make the background map
m=Basemap(llcrnrlon=-93, llcrnrlat=3,urcrnrlon=-52,urcrnrlat=28, resolution='h')
#m.drawmapboundary(fill_color='#A6CAE0', linewidth=0)
m.fillcontinents(color='grey', alpha=0.3)
m.drawcoastlines(linewidth=0.1, color="white")
m.shadedrelief()

# Add a point per position

plt.scatter(data\['homelon'\], data\['homelat'\], data\['n'\]/5, cmap="coolwarm", alpha=0.4, edgecolors="grey", linewidth=2)

plt.colorbar(orientation='vertical',shrink = 0.5)
plt.title('Caribbean')

enter image description here

0 个答案:

没有答案