Commit 89cca011 authored by P41842 (Petz Phillip)'s avatar P41842 (Petz Phillip) 💬
Browse files

Added scratch.py

parent 7146df51
import numpy as np
import matplotlib.pyplot as plt
from matplotlib2tikz import save as tikz_save
# to move files
import shutil
def PlotWaves(Filename):
File = 'C:/Users/Phillip/Documents/mathessentials/Files/Testdata/' + Filename
data = np.genfromtxt(File, delimiter=',', skip_header=0, skip_footer=0, names=['Time', 'Sine', 'Cosine'])
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(data['Sine'], color='r', label='Sine')
ax1.plot(data['Cosine'], color='b', label='Cosine')
ax1.grid()
plt.title('Sine and Cosine')
plt.xlabel('Sample')
plt.ylabel('Amplitude')
plt.legend()
File = "Python" + Filename[:-4] + ".tex"
tikz_save(File, figureheight='\\figureheight', figurewidth='\\figurewidth')
Target = 'C:/Users/Phillip/Documents/mathessentials/Files/LaTeX/Figures/'
shutil.copy(File, Target)
plt.show()
def PlotTemperature(Filename):
File = 'C:/Users/Phillip/Documents/mathessentials/Files/Testdata/' + Filename
data = np.genfromtxt(File, delimiter=';', skip_header=12, skip_footer=0, names=['Year', 'Month', 'Day', 'Hour', 'Minute', 'Temperature'])
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(data['Temperature'], color='r', label='Temperature')
ax1.grid()
plt.title(Filename)
plt.xlabel('Sample')
plt.ylabel('Temperature')
plt.legend()
File = "Python" + Filename[:-4] + ".tex"
tikz_save(File, figureheight='\\figureheight', figurewidth='\\figurewidth')
Target = 'C:/Users/Phillip/Documents/mathessentials/Files/LaTeX/Figures/'
shutil.copy(File, Target)
plt.show()
PlotWaves('SineAndCosine.csv')
PlotTemperature('WetterHagenberg.csv')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment