Skip to content

Commit 4231625

Browse files
committed
Add usage comment of plot.py
1 parent 3c3df1f commit 4231625

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

python/paddle/utils/plot.py

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
''' Plot data
15-
plot data as a curve figure
16-
feed data by using append function
17-
draw the figure by using plot function
18-
'''
14+
1915
import os
2016

2117

@@ -34,6 +30,15 @@ def reset(self):
3430

3531

3632
class Ploter(object):
33+
'''
34+
Plot input data in a 2D graph
35+
36+
Args:
37+
title: assign the title of input data.
38+
step: x_axis of the data.
39+
value: y_axis of the data.
40+
'''
41+
3742
def __init__(self, *args):
3843
self.__args__ = args
3944
self.__plot_data__ = {}
@@ -54,10 +59,18 @@ def __plot_is_disabled__(self):
5459
return self.__disable_plot__ == "True"
5560

5661
def append(self, title, step, value):
57-
'''Feed data
58-
:param title: the title of the figure
59-
:param step: x_axis
60-
:param value: y_axis
62+
'''
63+
Feed data
64+
65+
Args:
66+
title: assign the group data to this subtitle.
67+
step: the x_axis of data.
68+
value: the y_axis of data.
69+
70+
Examples:
71+
.. code-block:: python
72+
plot_curve = Ploter("Curve 1","Curve 2")
73+
plot_curve.append(title="Curve 1",step=1,value=1)
6174
'''
6275
assert isinstance(title, basestring)
6376
assert self.__plot_data__.has_key(title)
@@ -66,8 +79,16 @@ def append(self, title, step, value):
6679
data.append(step, value)
6780

6881
def plot(self, path=None):
69-
'''Plot data
70-
:param path: save figure path
82+
'''
83+
Plot data in a 2D graph
84+
85+
Args:
86+
path: store the figure to this file path. Defaul None.
87+
88+
Examples:
89+
.. code-block:: python
90+
plot_curve = Ploter()
91+
plot_cure.plot()
7192
'''
7293
if self.__plot_is_disabled__():
7394
return

0 commit comments

Comments
 (0)