I would like to produce some plot over the frequencies. I want to have an x-axis with superscript notation like in here. In addition I need vertical lines with vertical ann
You can define the tick-marks as strings and assign those:
mport numpy as np
import matplotlib.pyplot as plt
band = np.linspace(0,10**12,100)
y = band
plt.plot(band,y)
plt.xlabel("Frequencies")
plt.vlines(10**3, min(y), max(y),colors = 'black', label = 'kilo Hz')
plt.vlines(10**6, min(y), max(y),colors = 'black', label = 'mega Hz')
string_labels = []
for i in range(0,len(y),10):
string_labels.append(r"$10^{%02d}$" % (i/10.0))
plt.xticks(np.linspace(0,10**12,10),string_labels)
plt.legend()
plt.show()
I'm just shooting in the dark, but looks like xlabel takes a variety of options:
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.xlabel
When I went to:
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.text
I noticed that there is a verticalalignment option. Maybe that's what you need?