On 7/12/06, John Hunter <[EMAIL PROTECTED]> wrote:
I managed to accomplish what I wanted to do, using the FuncFormatter I think... Here's what I was doing. I am plotting results of graphs, graphs which have a certain number of edges. So I wanted to plot some statistic vs. number of edges. But the number of edges was not varied in a linear way but I have a list of which edges. So:
edges=[54, 76, 80, 100]
stats=[5.423, 23.226, 4.1, 6.93]
So basically I wanted t=arange(len(stats) as my x-axis but edges for the labels (but only if it lies on a major tic). So I did:
majorFormatter = ticker.FuncFormatter(lambda x, pos: labels[int(x)])
axis.xaxis.set_major_formatter(majorFormatter)
If anyone knows a better way I would love to know. I'm just learning matplotlib (I'm a former matlab user) and would love to master it.
>>>>> "David" == David Grant <[EMAIL PROTECTED]> writes:
David> Anyone know what happened to
David> matplotlib.ticker.IndexFormatter ? Is there are replacement
David> for it?
I don't know -- I don't see anything in the changelog or in the svn
log. What did it do, and what version of mpl had it? Sorry, but my
memory is failing here... I don't see any IndexFormatter as far back
as 0.83. There is an index locator however....
I managed to accomplish what I wanted to do, using the FuncFormatter I think... Here's what I was doing. I am plotting results of graphs, graphs which have a certain number of edges. So I wanted to plot some statistic vs. number of edges. But the number of edges was not varied in a linear way but I have a list of which edges. So:
edges=[54, 76, 80, 100]
stats=[5.423, 23.226, 4.1, 6.93]
So basically I wanted t=arange(len(stats) as my x-axis but edges for the labels (but only if it lies on a major tic). So I did:
majorFormatter = ticker.FuncFormatter(lambda x, pos: labels[int(x)])
axis.xaxis.set_major_formatter(majorFormatter)
If anyone knows a better way I would love to know. I'm just learning matplotlib (I'm a former matlab user) and would love to master it.
--
David Grant
Please Note my new email address: [EMAIL PROTECTED]
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users