As John mentioned, the major and minor ticks were the taller and shorter ticks, respectively. In your pasted example, you only change the minor ticks; by setting the majorLocator to same value as in the original example (i.e. 20), you only get the major tick at 0 because your data only goes to 1.5 (i.e. 20 is outside your plot range).
Also, the majorFormatter in the example is set to work with integers, but your major tick labels should be float values (since most of them are between 0 and 1). Thus, the majorFormatter code is unnecessary (commented out below).
Finally, a pet peeve: when posting example code, please make the effort to generate data for the plot so that others can easily run the code (see attached).
On Oct 7, 2010, at 3:38 PM, Waléria Antunes David wrote:
I did like the links below, but seeing as it was my chart.
My code: http://pastebin.com/KcjHAPLN
On Thu, Oct 7, 2010 at 3:08 PM, John Hunter <jdh2358@…287…> wrote:
On Thu, Oct 7, 2010 at 1:01 PM, Waléria Antunes David > > > > <waleriantunes@…287…> wrote:
I need to know how do these vertical lines on the graph. See the picture,
the lines circled.
We call these major and minor ticks. The major ticks are the taller
ones, the minor ticks are the smaller ones. Their location is
controlled by the major and minor Locator instances, and the text
printed beside them is controlled by the major and minor formatter.
To control the tick properties themselves, see the Tick section in
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
def gera_grafico(N=200, eps=1):
x = np.abs(np.random.randn(N))
y = 10np.log((30x + 1.)**(0.5)) + 34 + eps * np.random.randn(N)
yerr = eps * np.random.randn(N)
majorLocator = MultipleLocator(0.2)
majorFormatter = FormatStrFormatter(’%d’)
minorLocator = MultipleLocator(0.02)
fig, ax = plt.subplots()
plt.errorbar(x, y, yerr, fmt=‘ob’, label=‘date’)
if name == ‘main’: