How to Add Minor Ticks to Auto-Scaled Axis?

I am having trouble adding minor tick marks to an auto-scaled axis on a linear plot. I hope someone can help.

I am drawing a plot where the X axis values are predictable, so I have the ability to define the desired major/minor intervals for tickmarks and gridlines. The scale of the X axis is automatically defined by matplotlib. I have manually specified the major and minor X axis tick/grid intervals using:

plt.grid(True, which='both')
XmajorLocator
XmajorFormatter
XminorLocator

My Y axis values are not predictable, so I rely on matplotlib to autoscale the Y axis, automatically defining the total range of values plotted and the major tickmark & gridline intervals. I need more gridline resolution, so I would like to be able to add minor gridlines to the automatically scaled Y axis, but I'm having trouble doing it.

At present the autoscaled Y axis is only producing major ticks and major gridlines. I'd like to add minor ticks and gridlines, but I have not been successful so far. I'm hoping that someone can point out an obvious solution that I've just overlooked. TIA.

I'm not sure exactly how you want your minor ticks, but you can try this LinearMinorLocator (which is not in the distribution yet).

If you're conversant with git you can find the branch here: https://github.com/matplotlib/matplotlib/pull/122

M

I am having trouble adding minor tick marks to an auto-scaled axis on
a linear plot. I hope someone can help.

I am drawing a plot where the X axis values are predictable, so I
have the ability to define the desired major/minor intervals for
tickmarks and gridlines. The scale of the X axis is automatically
defined by matplotlib. I have manually specified the major and minor
X axis tick/grid intervals using:

plt.grid(True, which='both') XmajorLocator XmajorFormatter
XminorLocator

My Y axis values are not predictable, so I rely on matplotlib to
autoscale the Y axis, automatically defining the total range of
values plotted and the major tickmark& gridline intervals. I need
more gridline resolution, so I would like to be able to add minor
gridlines to the automatically scaled Y axis, but I'm having trouble
doing it.

At present the autoscaled Y axis is only producing major ticks and
major gridlines. I'd like to add minor ticks and gridlines, but I
have not been successful so far. I'm hoping that someone can point
out an obvious solution that I've just overlooked. TIA.

------------------------------------------------------------------------------

EditLive Enterprise is the world's most technically advanced content

myticker.py (1.3 KB)

ยทยทยท

On 6/19/11 3:20 PM, matplotlib.coralnut@...1515... wrote:

authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________ Matplotlib-users
mailing list Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users