1

I'm trying to set specific ticks on my plot, but the "default" tick label is still visible:

colnames = ['w','h']
data = pandas.read_csv("log_h.csv",names = colnames, sep='\t')
x = data.w.tolist()[:]
y = data.h.tolist()[:]
fig = plt.figure(figsize=(5,3))
plt.tick_params(axis='both', which='major', labelsize=8)
plt.plot(x,y,"r",linewidth=0.7)

plt.xscale('log')

plt.xlabel(r'$\frac{\omega}{2\pi}[Hz]$')
plt.ylabel(r"$|H(i\omega)\|_{dB}$")

plt.rc('grid', linestyle="--", color='lightgrey')

plt.grid(b=True, which='major', color='b', linestyle='--')
plt.grid(b=True, which='minor', color='r', linestyle='--')

plt.xlim(48,52)
plt.ylim(-65,5)

ax = plt.gca()
l = [48,48.5,49,49.5,50,50.5,51,51.5,52]

ax.set_xticks(l)
ax.set_xticklabels(l)
plt.grid(True)

ax.grid(True, which='both')

I get this:

enter image description here

I want to remove the big label 5x10^1. How should I do this?

[EDIT]

If I remove plt.xlim(...) it's OK, the 5x10^1 dissapears, but I don't want to plot the whole range!

Chrischpo
  • 145
  • 1
  • 11

0 Answers0