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!


 


-----
Josh Hemann
Statistical Advisor 
http://www.vni.com/ Visual Numerics 
jhem...@vni.com | P 720.407.4214 | F 720.407.4199 

-- 
View this message in context: 
http://old.nabble.com/Is-there-a-maximum-number-of-x-tickmarks--tp27924845p27924845.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Download Intel® 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