小编Bri*_*ndt的帖子

使用matplotlib fill_between填充两条极坐标曲线

我有一种感觉,我会被拍打在这一个我的额头,但我试图填补共同内部的两个极功能r = 4 sin(2?)r = 2.看来我正好与我想要的相反.有任何想法吗?

import numpy as np
import matplotlib.pyplot as plt

theta = np.arange(0, 2, 1./180)*np.pi
r = abs(4*np.sin(2*theta))
r2 = 2 + 0*theta

plt.polar(theta, r, lw=3)
plt.polar(theta, r2, lw=3)
plt.fill_between(theta, r, r2, alpha=0.2)
plt.show()
Run Code Online (Sandbox Code Playgroud)

极地情节

python matplotlib

6
推荐指数
1
解决办法
2153
查看次数

一组Python引用的双引号?

在审查edX.org上的在线CS188.1x类中使用的一些代码(由教师编写的代码)时,我注意到重复使用一组双引号(如可能在str附近使用)用作注释.

我之前没有见过这个,也没有在PEP8中提到过我能找到的,但它看起来确实很好.任何人都可以开导我吗?

这是一个例子:

class SomeClass():
    """
    Some docstring info, using standard 'triple double quotes'
    """
    def  __init__(self):
        "This is the comment style to which I'm referring."
        some.code = foo      # Here's a normal inline comment

    def bar(self, item):
        "Here is another example of the comment style"
       return wtf
Run Code Online (Sandbox Code Playgroud)

python comments coding-style

4
推荐指数
1
解决办法
1568
查看次数

标签 统计

python ×2

coding-style ×1

comments ×1

matplotlib ×1