Colin Ross
2015-07-29 15:59:33 UTC
I am attempting to draw an arrow that begins at a specified point on a
logarithmic plot and then extends a certain distance in the -Y direction.
This part is fine, however I would like to draw multiple arrows with the
same size corresponding to different points on a plot. If I specify a
certain value (as shown in the example below), the arrow size will change
depending on where the point is on the plot, since the X and Y axis are
logarithmic.
-------------------------------------------------------------
import numpy as np
import pylab as pl
x_1 = np.arange(10)
y_1 = np.arange(10)
x_1_avg = np.sum(x_1)/len(x_1)
y_1_avg = np.sum(y_1)/len(y_1)
x_2 = 3.
y_2 = 3.
pl.plot(x_1,y_1,'k')
pl.arrow(x_1_avg,y_1_avg , 0.0, -0.5, fc='b', ec='b', head_width=0.1,
head_length=0.1)
pl.arrow(x_2,y_2, 0.0, -0.5, fc='r', ec='r', head_width=0.1, head_length=0.1
)
pl.yscale('log')
pl.xscale('log')
pl.show()
-------------------------------------------------------------
Any advice is appreciated.
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
logarithmic plot and then extends a certain distance in the -Y direction.
This part is fine, however I would like to draw multiple arrows with the
same size corresponding to different points on a plot. If I specify a
certain value (as shown in the example below), the arrow size will change
depending on where the point is on the plot, since the X and Y axis are
logarithmic.
-------------------------------------------------------------
import numpy as np
import pylab as pl
x_1 = np.arange(10)
y_1 = np.arange(10)
x_1_avg = np.sum(x_1)/len(x_1)
y_1_avg = np.sum(y_1)/len(y_1)
x_2 = 3.
y_2 = 3.
pl.plot(x_1,y_1,'k')
pl.arrow(x_1_avg,y_1_avg , 0.0, -0.5, fc='b', ec='b', head_width=0.1,
head_length=0.1)
pl.arrow(x_2,y_2, 0.0, -0.5, fc='r', ec='r', head_width=0.1, head_length=0.1
)
pl.yscale('log')
pl.xscale('log')
pl.show()
-------------------------------------------------------------
Any advice is appreciated.
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor