11
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
# See the License for the specific language governing permissions and
13
13
# 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
+
19
15
import os
20
16
21
17
@@ -34,6 +30,15 @@ def reset(self):
34
30
35
31
36
32
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
+
37
42
def __init__ (self , * args ):
38
43
self .__args__ = args
39
44
self .__plot_data__ = {}
@@ -54,10 +59,18 @@ def __plot_is_disabled__(self):
54
59
return self .__disable_plot__ == "True"
55
60
56
61
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)
61
74
'''
62
75
assert isinstance (title , basestring )
63
76
assert self .__plot_data__ .has_key (title )
@@ -66,8 +79,16 @@ def append(self, title, step, value):
66
79
data .append (step , value )
67
80
68
81
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()
71
92
'''
72
93
if self .__plot_is_disabled__ ():
73
94
return
0 commit comments