Skip to content
Snippets Groups Projects
Commit 06183301 authored by Martin Killenberg's avatar Martin Killenberg
Browse files

add pdf plotting functionality to MeasurementPlot

parent db25b205
No related branches found
Tags 00.07.00
No related merge requests found
......@@ -47,7 +47,7 @@ class MeasurementPlot:
labels = [pc.get_label() for pc in all_path_collections]
self.ax1[1].legend(all_path_collections, labels, loc='lower right')
def draw(self, data_frame, save_pdf=True):
def draw(self, data_frame, pdf_name=''):
timestamps = data_frame.TIMESTAMP
minimum, maximum = self.get_extended_min_max(timestamps)
self.ax1[0].set_xlim(minimum, maximum)
......@@ -76,13 +76,17 @@ class MeasurementPlot:
self.path_collection_equi0.set_offsets(np.c_[timestamps, data_frame.EQUILIBRIUM_INDICATOR])
self.path_collection_equi1.set_offsets(np.c_[timestamps, data_frame.EQUILIBRIUM_INDICATOR])
if not pdf_name == '':
self.fig.savefig(pdf_name)
plt.show()
if plt.isinteractive():
self.fig.canvas.draw()
self.fig.canvas.flush_events()
# add 5 % of the distance between min and max to the range
def get_extended_min_max(self, array):
@staticmethod
def get_extended_min_max(array):
distance = array.max() - array.min()
return array.min()-0.05*distance, array.max()+0.05*distance
......@@ -108,4 +112,4 @@ if __name__ == '__main__':
print('I am done. ')
plt.ioff()
m.draw(data_frame)
m.draw(data_frame, 'the.pdf')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment