SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Jeff P. <jef...@se...> - 2005年05月31日 16:56:30
Hello, when I use 'set_ticklabels' to set the tick labels using a string
array only the major locators are labeled. I have an array of data that
I want to plot against strings. The problem is that matplotlib plots my
data but the labels are put only on the major ticks so they do not
correspond to the proper data element. Heres an example:
I want to plot the data [1,2,3,4,5,6] against the strings
['a','b','c','d','e',f'] - there is one string per data point
Matplotlib plots the major ticks only. So if the minor ticks are spaced
1 between major ticks then matplot lib would plot my data as follows:
1,'a'
2,'minor tick'
3,'b'
4,'minor tick'
5,'c'
6,'minor tick'
so the labels do not correspond to the proper data point. How can I fix
this? Thanks
also is there a way to get the spacing of major ticks with minor ticks?
I would like to set my tick labels based on what data point is being
plotted. 
Thanks!
Jeff 
From: John H. <jdh...@ac...> - 2005年05月31日 18:18:51
>>>>> "Jeff" == Jeff Peery <jef...@se...> writes:
 Jeff> also is there a way to get the spacing of major ticks with
 Jeff> minor ticks? I would like to set my tick labels based on
 Jeff> what data point is being plotted.
Have you seen Chapter 5 of the users guide "Tick Locators and
Formatters", and the examples
 examples/major_minor_demo1.py 
 examples/major_minor_demo2.py
 examples/custom_ticker1.py 
You can extend the tick locating and formatting classes to do what you
want.
See also http://matplotlib.sf.net/matplotlib.ticker.html
Let me know if you have any more questions....
JDH
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /