I've got a .txt file containing numbers like the following:
No. --- Amount -------- Location
1 ----- 23.5 -------- -0.0039
3 ----- 2.093 -------- 0.992
7 ----- 1.211 -------- 0.3929
5 ----- 0.898 -------- -1.8933
and so on
I've got approx. 700 numbers. Now I want to plot and visualize those numbers. To be exact: I want to show the "Amount" on the x-Axis and the "Location" on the y-Axis. The graph should resemble a sine curve. Moreover, I want to choose certain numbers. For example, only No. 1 and No. 2. That means, I need to read in the Amount and the Location of Number 1 and Number 2.
I have never worked before with Python or with Matplotlib. Since I hope that somebody could help me out or give me some hints.
So far, I've got the following code:
import matplotlib.pyplot as plt
import numpy as np
import io
numbers_file = open('numbers_file.txt').read().replace(',',' ')
numbers_data = np.loadtxt(io.StringIO(numbers_file),skiprows=1)
x = np.linspace(0, 2*np.pi, 20)
y = np.sin(x)
beta = x
plt.figure(figsize=(7,3))
plt.title('Companies amount and location')
plt.plot(x,y, label=r'sin( $\beta$ )')
plt.xlabel(r'$\beta$')
plt.ylabel('Location')
plt.legend()
plt.grid()
plt.show()
Beyond that, I want to use a specific textfile entry as a Start Point and as an End Point for my data graph. Some entries (access via 'No.' in the text file) should be visualized as maximum and as a minimum.
I would be very thankful for every help I can get because I am kinda lost on how to solve that.