Thanks for your help, I simplified what I was doing and so changed the data,
which is my fault. Here is some data of similar size to the data I am
plotting:
data1 = np.array([22000, 25000, 27000, 32000, 25000])
data2 = np.array([14000000, 22000000, 3500000, 3000000, 2700000])

When I try to run this with the above code I get a very strange graph and
these errors:


> In [16]: run t.py
> Warning: overflow encountered in long_scalars
> Warning: overflow encountered in long_scalars
> Warning: overflow encountered in long_scalars
> Warning: overflow encountered in long_scalars
> Warning: invalid value encountered in sqrt
>

So then tried the same method using the annotation as suggested (code below)
which worked perfectly.

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.ticker import FuncFormatter

labels=('91','92','93','94','95')

data1 = np.array([22000, 25000, 27000, 32000, 25000])
data2 = np.array([14000000, 22000000, 3500000, 3000000, 2700000])

fig = plt.figure()
ax = fig.add_subplot(111)
# the next line is only use to set the proper lims,
p = ax.plot(data1, data2, 'bo', linestyle='-', markersize=3, alpha=0)
for x,y,dx,dy in zip(data1[:-1], data2[:-1], data1[1:], data2[1:]):
   ax.annotate('', xy=(dx,dy),  xycoords='data',
                xytext=(x,y), textcoords='data',
                arrowprops=dict(arrowstyle="->"))

ax.set_xlim(21000,33000)

for i, label in enumerate(labels):
   x_loc = data1[i]
   y_loc = data2[i]
   txt = ax.annotate(label, xy=(x_loc, y_loc), size=8,
       xytext=(-10, 10), textcoords='offset points',
       arrowprops=None)

plt.show()

Just in case someone else has a similar problem.

Thanks
Catherine
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to