0

I have data stored in python dictionary (for every country there is list of values):

{'BE': ['259.1587', '252.2124', '248.4519', '247.5489', '247.9576', '250.0425', '182.5851', '180.1105', '179.6083', '178.5209', '176.7081', '174.8502'], 'FR': ['103.3834', '101.1851', '98.2804', '95.9919', '94.3940', '92.9902', '91.4351', '90.3078', '89.3786', '88.5690', '88.3090', '88.8994'], 'BG': ['63.9277', '69.9601', '65.4384', '64.1908', '64.5276', '67.7657', '66.8916', '67.0778', '67.617', '68.2783', '65.4651', '62.7898'], 'DK': ['75.7358', '75.2223', '73.7547', '71.2911', '67.4805', '65.3390', '62.9360', '61.3575', '58.4678', '57.7756', '57.0328', ':'], 'HR': ['102.1641', '102.6400', '100.4574', '95.4924', '94.1970', '94.4324', '93.0424', '96.3094', '94.9562', '94.6190', '97.0368', '104.6504'], 'DE': ['107.4606', '107.4609', '105.7275', '106.5801', '106.7862', '107.0506', '108.4679', '110.0985', '112.6987', '114.7489', '117.9135', '120.6868'], 'HU': ['98.5704', '42.3163', '40.8225', '40.0413', '39.1802', '39.3375', '38.2867', '33.5230', '31.8583', '32.7758', '32.9499', '33.1136']}

I would like to plot all the data from key values in one figure such as there will be one line for each country. Any idea?

Thanks! Klara

1 Answers1

0

Apart from the dodgy : in the DK data, if your dictionary is c:

import pylab
for cc, vals in c.items():
    pylab.plot([float(x) for x in vals], label=cc)
pylab.legend()
pylab.show()

Note this assumes you have matplotlib / pylab installed.

xnx
  • 24,509
  • 11
  • 70
  • 109