Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- import matplotlib.pyplot as plt
- plt.rcdefaults()
- import numpy as np
- import matplotlib.pyplot as plt
- import matplotlib.path as mpath
- import matplotlib.lines as mlines
- import matplotlib.patches as mpatches
- from matplotlib.collections import PatchCollection
- satellites = {
- 'fermi':{'start':2008,
- 'end':2020,
- 'low':10e3,
- 'high':300e9},
- 'swift':{'start':2004,
- 'end':2020,
- 'low':0.2e3,
- 'high':150e3},
- 'cgro':{'start':1991,
- 'end':2000,
- 'low':20e3,
- 'high':30e9},
- 'integral':{'start':2002,
- 'end':2020,
- 'low':15e3,
- 'high':30e6},
- 'hete-2':{'start':2000,
- 'end':2008,
- 'low':0.5e3,
- 'high':400e3},
- 'gamma':{'start':1991,
- 'end':1992,
- 'low':50e6,
- 'high':6e9},
- 'ulysses':{'start':1990,
- 'end':2009,
- 'low':15e3,
- 'high':150e3},
- 'sross':{'start':1987,
- 'end':2001,
- 'low':20e3,
- 'high':3000e3},
- 'eureca':{'start':1992,
- 'end':1993,
- 'low':6e3,
- 'high':150e3},
- 'mars observer':{'start':1992,
- 'end':1993,
- 'low':0.5e6,
- 'high':2e6},
- 'wind':{'start':1994,
- 'end':2020,
- 'low':15e3,
- 'high':10e6},
- 'rxte':{'start':1995,
- 'end':2012,
- 'low':2e3,
- 'high':250e3},
- 'near':{'start':1996,
- 'end':2001,
- 'low':0.3e6,
- 'high':10e6}
- }
- patches = []
- fig, ax = plt.subplots()
- for sat_id in satellites:
- sat = satellites[sat_id]
- patches.append(mpatches.Rectangle([sat['low'],sat['start']],
- sat['high']-sat['low'],
- sat['end']-sat['start'],
- ec='none'))
- ax.text(#np.sqrt(sat['low']*sat['high']),
- sat['low']**0.7*sat['high']**0.3,
- sat['start']*0.7+sat['end']*0.3,
- sat_id)
- colors = np.linspace(0, 1, len(patches))
- collection = PatchCollection(patches, cmap=plt.cm.hsv, alpha=0.3)
- collection.set_array(np.array(colors))
- ax.add_collection(collection)
- ax.set_xscale('log')
- plt.axis('equal')
- ax.set_xlabel('Energy [eV]')
- ax.set_ylabel('Year')
- #plt.axis('off')
- plt.show()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement