小编Clo*_*Cho的帖子

为什么许多例子在Matplotlib/pyplot/python中使用"fig,ax = plt.subplots()"

我正在学习matplotlib通过学习示例来学习,并且在创建单个绘图之前,许多示例似乎包括如下所示的行...

fig, ax = plt.subplots()
Run Code Online (Sandbox Code Playgroud)

这里有些例子...

我看到这个函数用了很多,尽管这个例子只是试图创建一个图表.还有其他一些优势吗?官方演示subplots()也用于f, ax = subplots创建单个图表时,它之后只引用了ax.这是他们使用的代码.

# Just a figure and one subplot
f, ax = plt.subplots()
ax.plot(x, y)
ax.set_title('Simple plot')
Run Code Online (Sandbox Code Playgroud)

python plot visualization matplotlib

217
推荐指数
5
解决办法
14万
查看次数

Finding ONLY Unique Coordinates in List

I have a list of coordinates like

list_cor = 
    [[4190091.4195999987, 7410226.618699998], 
    [4190033.2124999985, 7410220.0823], 
    [4190033.2124999985, 7410220.0823], 
    [4190035.7005000003, 7410208.670500003], 
    [4190033.2124999985, 7410220.0823], 
    [4190022.768599998, 7410217.844300002]]
Run Code Online (Sandbox Code Playgroud)

I need to get only these values:

[[4190091.4195999987, 7410226.618699998], 
[4190035.7005000003, 7410208.670500003], 
[4190022.768599998, 7410217.844300002]]
Run Code Online (Sandbox Code Playgroud)

Tried numpy.unique() but it adds this item [4190033.2124999985, 7410220.0823], which I don't need.

python numpy list unique

5
推荐指数
2
解决办法
2214
查看次数

标签 统计

python ×2

list ×1

matplotlib ×1

numpy ×1

plot ×1

unique ×1

visualization ×1