Print date data with pcolor

I have the following data:

dates = ['1874-05-02', '1874-05-03', '1874-05-04', 
         '1874-05-05', '1874-05-06','1874-05-07']
data1 = ['-7.000', '7.000', '2.000', '11.600', '13.500', '-13.500']
data2 = ['0.000', '25.000', '0.000', '75.000', '12.000', '22.000']

and I need to draw a chart where the dates are on the x axis and data1 on the y axis. Data2 is necessary for drawing points on the chart, and they should all be in different colors, corresponding to their values. So how can I do this using pcolor or pcolormesh?

Here is a sample code that I found from http://matplotlib.org/examples/pylab_examples/pcolor_demo.html and I was wondering if I can get something like this with my data? Here is another link to demonstrate what I should do: https://dl.dropboxusercontent.com/u/47527320/diagram.jpg . Can I get a chart like this with pcolor?

import matplotlib.pyplot as plt
import numpy as np

dx, dy = 0.15, 0.05

y, x = np.mgrid[slice(-3, 3 + dy, dy),slice(-3, 3 + dx, dx)]
z = (1 - x / 2. + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2)
z = z[:-1, :-1]
z_min, z_max = -np.abs(z).max(), np.abs(z).max()



plt.subplot(2, 2, 1)
plt.pcolor(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max)
plt.title('pcolor')
plt.axis([x.min(), x.max(), y.min(), y.max()])
plt.colorbar()

plt.show()
0
1

A , .

import numpy as np
import pylab as plt
import datetime
dt = datetime.datetime

dates = [dt(1874,05,02), dt(1874,05,03), dt(1874,05,04), dt(1874,05,05), dt(1874,05,06),dt(1874,05,07)] 
data1 = [-7.000, 7.000, 2.000, 11.600, 13.500, -13.500]
data2 = [0.000, 25.000, 0.000, 75.000, 12.000, 22.000]

plt.scatter(dates, data1, c=data2, s=400)

plt.show()

enter image description here

2D- , , - , . mpl . mpl , , ( ) .

, , .

+2

All Articles