Cheetah Software  1.0
plot_curve.py
Go to the documentation of this file.
1 import numpy as np
2 import matplotlib
3 matplotlib.use('TkAgg')
4 import matplotlib.pyplot as plt
5 import os
6 
7 # Plot configuration
8 PLOT_VERTICALLY = 0
9 PLOT_HORIZONTALLY = 1
10 
11 def create_figures(subfigure_width=480, subfigure_height=600, starting_figure_no=1, starting_col_index = 0, starting_row_index=0, plot_configuration=PLOT_HORIZONTALLY):
12  figure_number = starting_figure_no
13  col_index = starting_col_index
14  row_index = starting_row_index
15 
16  file_path = os.getcwd() + "/../test_data/"
17 
18  ## read files
19  curve_pos = np.genfromtxt(file_path+'curve_pos.txt', delimiter=None, dtype=(float))
20  bs_t = np.genfromtxt(file_path+'curve_time.txt', delimiter='\n', dtype=(float))
21 
22  ## plot curve_pos
23  fig = plt.figure(figure_number)
24  plt.get_current_fig_manager().window.wm_geometry(str(subfigure_width) + "x" + str(subfigure_height) + "+" + str(subfigure_width*col_index) + "+" + str(subfigure_height*row_index))
25  fig.canvas.set_window_title('curve_pos_pos_vel_acc')
26  for i in range(1):
27  ax1 = plt.subplot(1, 1, i+1)
28  plt.plot(bs_t, curve_pos[:], "b-")
29  plt.grid(True)
30  plt.xlabel('time (sec)')
31  ## increment figure number and index
32  figure_number += 1
33  if plot_configuration == PLOT_HORIZONTALLY:
34  col_index += 1
35  elif plot_configuration == PLOT_VERTICALLY:
36  row_index +=1
37 
38 if __name__ == "__main__":
40  plt.show()
def create_figures(subfigure_width=480, subfigure_height=600, starting_figure_no=1, starting_col_index=0, starting_row_index=0, plot_configuration=PLOT_HORIZONTALLY)
Definition: plot_curve.py:11