I am using matplotlib, I have to make a figure with a second x-axis (above the figure), that worked for me with the following code. But when I want to title the figure, it overlays with the name of the top axis. Does anyone know how to solve this in this code? (I have searched for solutions on the web but since I am new to python I do not know how to implement them)
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = fig.add_subplot(111)
plt.title('Linea H2')
ax1.plot(radioarc, mcv1,'ko')
ax1.set_xlim(-1.65, 1.65)
ax1.set_xlabel("Radius[arcsec]")
ax1.set_ylabel("Velcidad Radial[km/s]")
plt.errorbar(radioarc, mcv1, yerr=sdv1, fmt='None', ecolor='k')
ax2 = ax1.twiny()
ax2.set_xlabel("Radius[pc]")
ax2.set_xlim(-1.65, 1.65)
ax2.set_xticks([-1.48, -1, -0.5, 0,0.5, 1, 1.48])
ax2.set_xticklabels(['-90','-60', '-30', '0', '30', '60', '90'])
plt.show()