Python Forum
matplotlib : Raster Plot
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
matplotlib : Raster Plot
#2
#!/usr/bin/python3
import operator
import matplotlib
import matplotlib.pyplot as plt

f = open('input.txt')
lines = f.readlines()
dict = {}
cnt = 1
for l in lines:
    ind = l[0]+l[2]+l[4]
    if ind not in dict:
        dict[ind] = cnt
        cnt = cnt + 1
sorted_dict = sorted(dict.items(), key=operator.itemgetter(1))
for t in sorted_dict:
    print(t)

plt.plot(*zip(*sorted_dict))
plt.show()
Reply


Messages In This Thread
matplotlib : Raster Plot - by adithyakrish - Apr-24-2017, 10:46 AM
RE: matplotlib : Raster Plot - by heiner55 - May-28-2019, 05:04 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to customize x axis in matplotlib.pyplot for a scatter plot? wlsa 9 8,295 Nov-10-2018, 01:32 AM
Last Post: wlsa
  How to plot date series in matplotlib? StrybolData 2 8,393 Jan-25-2018, 07:13 PM
Last Post: StrybolData

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020