I have a script that creates one or two diagrams, depending on whether a particular condition is fulfilled or not. In fact, basically, I still do the following:
import matplotlib.pyplot as plt
list1 = [1,2,3,4]
list2 = [4,3,2,1]
somecondition = True
plt.figure(1)
ax = plt.subplot(211)
ax.plot(list1)
if somecondition == True:
ax = plt.subplot(212)
ax.plot(list2)
plt.show()
This code (with relevant data, but this simple version that I made is executable anyway) generates two subheadings of the same size, one above the other. However, I would like to get the following:
- If somecondition is True , then both subheadings should appear in the figure. Therefore, I would like the second subtitle to be 1/2 less than the first;
- somecondition False, , , ( , ).
, , , 211 212 ( , , Python ). - , , , ? , , , , ? !