I'm plotting figures for a series of data set and I want to keep the looking consistent with each other. Currently I'm using MaxNLocator and ScalarFormatter but still,

1. Is there a way to limit the minimum number of ticks for MaxNLocator? Currently, if I set nbins=5, the number of ticks varies from 2 to 5. The variation is too large for me. I tried FixedLocator but then I lost the ability to set "ylim" (or "xlim") automatically.

2. About the scientific notation of ScalarFormatter, can I fix the number of decimal places? Currently, the notation will be "2x10^-5" in some figures, while "2.50x10^-5" in other figures. I need all tick labels to have the same number of decimal places.

I've searched the online documents for hours but cann't find the answer... any ideas?

I'm plotting figures for a series of data set and I want to keep the
looking consistent with each other. Currently I'm using MaxNLocator and
ScalarFormatter but still,

1. Is there a way to limit the minimum number of ticks for MaxNLocator?
Currently, if I set nbins=5, the number of ticks varies from 2 to 5. The
variation is too large for me. I tried FixedLocator but then I lost the
ability to set "ylim" (or "xlim") automatically.

You cannot limit it directly to a given number, but you can make it stick closer to the max number by giving it more latitude in selecting what can be a tick. You do this via the "steps" kwarg.

2. About the scientific notation of ScalarFormatter, can I fix the
number of decimal places? Currently, the notation will be "2x10^-5" in
some figures, while "2.50x10^-5" in other figures. I need all tick
labels to have the same number of decimal places.

It sounds like you need to use a FormatStrFormatter instead of a ScalarFormatter.

Eric

···

On 05/04/2012 07:13 PM, stecue wrote:

I've searched the online documents for hours but cann't find the
answer... any ideas?

I've figured out that I can use LinearLocator and set ylim manually to fix the number of ticks. But I still don't know to set the display precision of the scientific notation. Currently I can only work around this by choosing proper limits and number of ticks manually. Is there anyway to fore the display precision (i.e, "3.33x10^-6" instead of "3.33333333333 x10^-6") ?

Thanks very much!

Sincerely yours
Xing

···

On 05/05/2012 01:13 AM, stecue wrote:

Hi,

I'm plotting figures for a series of data set and I want to keep the looking consistent with each other. Currently I'm using MaxNLocator and ScalarFormatter but still,

1. Is there a way to limit the minimum number of ticks for MaxNLocator? Currently, if I set nbins=5, the number of ticks varies from 2 to 5. The variation is too large for me. I tried FixedLocator but then I lost the ability to set "ylim" (or "xlim") automatically.

2. About the scientific notation of ScalarFormatter, can I fix the number of decimal places? Currently, the notation will be "2x10^-5" in some figures, while "2.50x10^-5" in other figures. I need all tick labels to have the same number of decimal places.

I've searched the online documents for hours but cann't find the answer... any ideas?