I mentioned the details of what I am trying to plot. My main question has been posted in the last para.
I tried to plot a graph showing time on the x-axis and value on the y-axis. I have six columns in my text file where time is in the 3rd column and value (height or elevation in cm) is in the last column.
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv('Area(4).txt',delimiter='\t')
print(df.columns)
The file consists of elevations recorded for a month and it includes some unnecessary/missing values which I have filtered below. I want to plot the recordings between 26-30 April. So I did the following
df.iloc[[600]]
df.iloc[[695]]
df16=df.iloc[601:696,:] # this takes the values between 26-29 April
print(df16)
df17=df16[df16.Value!=9999] #filtering of values I don't need
print(df17)
After doing all this, the output I require later looks like this:
No Date Time Rand Col Value
601 2762 26 4 1991 1:00 231 2 335
603 2764 26 4 1991 3:00 231 4 255
606 2767 26 4 1991 6:00 231 7 185
608 2769 26 4 1991 8:00 231 9 135
609 2770 26 4 1991 9:00 231 10 117
610 2771 26 4 1991 10:00 231 11 125
612 2773 26 4 1991 12:00 232 1 301
613 2774 26 4 1991 13:00 232 2 350
614 2775 26 4 1991 14:00 232 3 370
616 2777 26 4 1991 16:00 232 5 275
618 2779 26 4 1991 18:00 232 7 200
620 2781 26 4 1991 20:00 232 9 140
621 2782 26 4 1991 21:00 232 10 115
622 2783 26 4 1991 22:00 232 11 125
624 2785 27 4 1991 0:00 233 1 315
625 2786 27 4 1991 1:00 233 2 377
627 2788 27 4 1991 3:00 233 4 285
630 2791 27 4 1991 6:00 233 7 210
632 2793 27 4 1991 8:00 233 9 155
633 2794 27 4 1991 9:00 233 10 130
634 2795 27 4 1991 10:00 233 11 113
636 2797 27 4 1991 12:00 234 1 285
638 2799 27 4 1991 14:00 234 3 390
640 2801 27 4 1991 16:00 234 5 325
642 2803 27 4 1991 18:00 234 7 225
644 2805 27 4 1991 20:00 234 9 161
646 2807 27 4 1991 22:00 234 11 115
647 2808 27 4 1991 23:00 234 12 131
648 2809 28 4 1991 0:00 235 1 275
649 2810 28 4 1991 1:00 235 2 390
650 2811 28 4 1991 2:00 235 3 370
651 2812 28 4 1991 3:00 235 4 335
654 2815 28 4 1991 6:00 235 7 255
656 2817 28 4 1991 8:00 235 9 175
658 2819 28 4 1991 10:00 235 11 121
659 2820 28 4 1991 11:00 235 12 125
660 2821 28 4 1991 12:00 236 1 330
662 2823 28 4 1991 14:00 236 3 425
663 2824 28 4 1991 15:00 236 4 422
664 2825 28 4 1991 16:00 236 5 375
666 2827 28 4 1991 18:00 236 7 255
668 2829 28 4 1991 20:00 236 9 175
670 2831 28 4 1991 22:00 236 11 118
671 2832 28 4 1991 23:00 236 12 107
672 2833 29 4 1991 0:00 237 1 245
673 2834 29 4 1991 1:00 237 2 380
674 2835 29 4 1991 2:00 237 3 415
675 2836 29 4 1991 3:00 237 4 375
678 2839 29 4 1991 6:00 237 7 265
680 2841 29 4 1991 8:00 237 9 190
682 2843 29 4 1991 10:00 237 11 122
683 2844 29 4 1991 11:00 237 12 105
684 2845 29 4 1991 12:00 238 1 180
686 2847 29 4 1991 14:00 238 3 415
687 2848 29 4 1991 15:00 238 4 460
688 2849 29 4 1991 16:00 238 5 425
But when I tried to plot a graph with 'Time' on the x-axis and 'Value/Elevation (cm)' on the y-axis, I don't get a plot at all. The way I tried to plot is probably too simple or wrong but how I can get the plot? I also want the graph to show that the x-coordinates increment by 6 hours and the y-coordinates to be spaced by 2m.
df17.plot(kind='scatter', x='Time', y='Value')
plt.show()