【问题标题】:Plot first point in a different shape以不同的形状绘制第一个点
【发布时间】:2019-09-17 23:41:34
【问题描述】:

我正在通过以下方式进行集群可视化:

for k in range(0, n_clusters):
    x=[]
    y=[]
    for j in range(0, len(final_cluster_result[k])):
        x_res = list(final_cluster_result[k][j].longitude)
        y_res = list(final_cluster_result[k][j].latitude)
        x.append(x_res)
        y.append(y_res)
    x = [s for t in x for s in t]
    y = [s for t in y for s in t]
    plt.plot(x,y,'o',markersize=3)
#     plt.scatter(x,y)
    plt.grid()
    plt.title('Clusters',fontsize=14)
    plt.xlabel("Longitude",fontsize=15)
    plt.ylabel("Latitude",fontsize=15)

我想以不同的形状绘制集群/颜色的每个起点(以了解运动从哪里开始)

sample plot

我想要: 对于蓝色绘图,第一个点带有蓝色的黑点 对于 rescolor 绘制第一个点,带有一个带有红色的黑点 ...

【问题讨论】:

  • plt.plot(x,y,'o',markersize=3)之后做plt.plot([x[0]], [y[0]], 's', markersize=5)?
  • 我会以您想要的格式再次绘制第一个点。

标签: python pandas matplotlib


【解决方案1】:

同意@Quang-Hoang 的观点,在这里粘贴以供其他人过滤没有答案的问题:

在 plt.plot(x,y,'o',markersize=3) 之后做 plt.plot([x[0]], [y[0]], 's', markersize=5)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-23
    • 2017-12-10
    相关资源
    最近更新 更多