On Tue, Mar 16, 2010 at 4:37 PM, Josh Hemann <jhem...@vni.com> wrote:

>
> I have an issue with showing more than 81 tick marks on an X axis and I am
> trying to determine a way around it. Background... I am plotting vectors in
> which each element represents a different variable and I really do want to
> see the labels associated with each element. The vectors may be only 8
> elements long, or as much as 110. When there are more than say 40 elements,
> I usually split the plot into two plots contained in a single figure window
> (e.g., plotting elements 0:30 in fig.add_subplot(211) and 30:60 in
> fig.add_subplot(212)).
>
> Here are a couple of examples...
>
> Only 41 variables:
> http://old.nabble.com/file/p27924845/Factor_2_TrainingProfiles.png
>
>
> 71 variables:
> http://old.nabble.com/file/p27924845/Factor_2_TrainingProfiles.jpeg
>
>
> I have a vector with a 105 elements and before I split things into three
> plots I wanted to see what cramming 53 or so variables into a single set of
> axes would look like. But, my code that works for these cases does not show
> enough tickmarks for the 105 element data.
>
> Here is an example that you can copy and paste to see for yourself.
>
> import matplotlib.pyplot as plt
> from matplotlib.ticker import MaxNLocator
> fig = plt.figure(figsize=[12,7])
> ax = fig.add_subplot(111)
> ax.plot(range(110))
> fig.canvas.draw()
> ints = range(1,111)
> ints = [str(num) for num in ints]
> ax.xaxis.set_major_locator(MaxNLocator(110))
> xtickNames = plt.setp(ax, xticklabels=ints)
> plt.setp(xtickNames, rotation=90, fontsize=7);
>
> If you play with the argument to MaxNLocator, you'll see how for smaller
> values (like 40) things work as expected (or at least how I have shown the
> code has worked for the smaller data sets).
>
> I have been poking around trying to see what options I have and have not
> found anything to get past this limit. Before I start diving into source
> code, can anyone suggest
>
> -Is there a limit?
> -Is there an obvious way to accomplish what I need?
>
> Ultimately, I may split large vectors like this into more than two plots
> but
> hitting that limit has made me want to investigate why.
>
> Thanks!
>

Oh these busy chemical compound plots :) Are those results of gas
chromatography analysis?

Something like below produces a nice fully plotted output here. Could you
give it a try?

import matplotlib.pyplot as plt
plt.plot(range(100))
locs, labels = plt.xticks(range(100), range(100))
plt.setp(labels, rotation=90, fontsize=7)
plt.show()


-- 
Gökhan
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to