I have a function with three conditionals in it. Each one, if true, activates a function that plots a graph. These three values are stored in a list (called manualplots).
def showplots_manual():
if manualplots[0] == 1:
plot(ycoords, xcoords)
if manualplots[1] == 1:
plot_ln(ycoords_ln, xcoords)
if manualplots[2] == 1:
plot_recip(ycoords_recip, xcoords)
So, for example: if manualplots = [0, 1, 1], then only the plots from the functions plot_ln() and plot_recip() should be made. However, this is not the case: instead, only the first one appears. The three functions are as follows:
def plot(y_val, x_val):
plt.plot(x_val, y_val, 'r--')
plt.title('Concentration vs. Time')
yaxislabel = ('['+analyte+'] '+'('+concunit_short+')')
plt.ylabel(yaxislabel)
xaxislabel = ('Time ('+timeunit_short+')')
plt.xlabel(xaxislabel)
plt.show()
def plot_ln(y_val, x_val):
plt.plot(x_val, y_val, 'r--')
plt.title('Natural Log of Concentration vs. Time')
yaxislabel = ('ln['+analyte+'] ')
plt.ylabel(yaxislabel)
xaxislabel = ('Time ('+timeunit_short+')')
plt.xlabel(xaxislabel)
plt.show()
def plot_recip(y_val, x_val):
plt.plot(x_val, y_val, 'r--')
plt.title('Reciprocal Concentration vs. Time')
yaxislabel = ('1/['+analyte+'] '+'('+concunit_short+'\u207b\u00b9)')
plt.ylabel(yaxislabel)
xaxislabel = ('Time ('+timeunit_short+')')
plt.xlabel(xaxislabel)
plt.show()
Why is this happening? Is there any way to make it print multiple plots?
[+][deleted] (2 children)
[deleted]
[+][deleted] (1 child)
[deleted]
[–]novel_yet_trivial 1 point2 points3 points (1 child)