小编sri*_*van的帖子

Python legend in 3dplot

I am plotting a 3d plot in python 2.7

When I try to plot a 3d plot with color and marker as in 2D plot() function. I come across an error.

So I tried to plot line separately and measured points with markers separately using scatter() function.

When I create legend entries my legend looks like this

在此处输入图片说明

But I don't want to have duplicate legend entries instead

  • I want my legend entries to group with colour, or
  • Is it possible …

python plot matplotlib

8
推荐指数
1
解决办法
2万
查看次数

用 Python 绘制 Networkx 图

我最近开始在 python 中使用 networkx 库来生成和可视化图表。我从一个简单的代码(由 4 个节点组成)开始,如图所示

import networkx as nx
import matplotlib.pyplot as plt
G = nx.Graph()
G.add_edges_from([(1 ,2) , (2 ,3) , (1 ,3) , (1 ,4) ])
nx.draw(G)
plt.show()
Run Code Online (Sandbox Code Playgroud)

当我连续两次运行代码时,相同代码的输出如图所示(图的方向是随机的)

图 1 图 2

是否可以生成具有相同/固定方向的图的输出?

python data-visualization graph matplotlib networkx

7
推荐指数
1
解决办法
6691
查看次数

标签 统计

matplotlib ×2

python ×2

data-visualization ×1

graph ×1

networkx ×1

plot ×1