Skip to content

Commit a8df7bf

Browse files
author
meihuisu
committed
take out initial self.plot call in cvm_plot.py
1 parent 9756148 commit a8df7bf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pycvm/cvm_plot.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, title = None, xlabel = None, ylabel = None, legend = None, wi
6464
## Defines the figure and plot object to which we can add subplots.
6565

6666
self.figure = plt.figure(figsize=(width, height), dpi=100)
67-
self.plot = self.figure.add_subplot(1, 1, 1)
67+
self.plot = None
6868

6969
if ylabel != None:
7070
plt.ylabel(ylabel, fontsize=14)
@@ -79,14 +79,18 @@ def __init__(self, title = None, xlabel = None, ylabel = None, legend = None, wi
7979
plt.legend(legend, loc='lower left')
8080

8181
## Internal counter for how many subplots we have.
82-
self.subplotcounter = 1
82+
self.subplotcounter = 0
8383

8484
##
8585
# Adds a subplot to the figure and returns it.
8686
#
8787
# @return The subplot that has been added to the already generated plot.
8888
def addsubplot(self):
89-
self.subplotcounter += 1;
89+
if(self.plot == None) :
90+
self.plot = self.figure.add_subplot(1, 1, 1)
91+
self.subplotcounter = 1
92+
else:
93+
self.subplotcounter += 1;
9094
return self.plot;
9195

9296
##

0 commit comments

Comments
 (0)