Hello All!

I searched for my problem and while I found similar questions this seemed to
be a unique problem.

I am creating an image that is six vertically stacked subplots and I want
only the axis of the bottom subplot to be labelled. However, as you can see
from the image I attached it's picking the wrong subplot to label. It's as
if the program is not understanding that there is one more plot. If I just
plot five plots than everything works. I'm not sure what is going wrong with
me code. It would be extremely helpful if someone could take a look.

xlabel = ["",5000,5500,6000,6500,7000,""]
plt.figure()

night = (glob.glob('*_sci.txt'))
for i in range(0,len(night)):
        # Read in data for each night
        wave = np.loadtxt(night[i], usecols=[0])
        flux = np.loadtxt(night[i], usecols=[1])
        # Create subplots
        temp = 610 +i  
        spect = plt.subplot(temp,sharex=True)
        # Draw plot
        plt.plot(wave, flux, color="green")
        plt.subplots_adjust(hspace = 0.001)
        spect.set_autoscaley_on(False)  
        pylab.ylim([0,0.5e-13])
        # Make y tick makers 
        temp = tic.MaxNLocator(3)
        plt.gca().yaxis.set_major_locator(tic.MaxNLocator(prune='lower'))
        plt.gca().yaxis.set_major_locator(tic.MaxNLocator(prune='upper'))
        spect.yaxis.set_major_locator(temp)
        # Get rid of redundant x tick labels
        if i < len(night)-1:
                plt.setp(spect.get_xticklabels(), visible=False)


spect.set_xticklabels(xlabel, minor=False)
plt.xlabel("Observed Wavelength $(\AA)$",fontsize=16)


<http://matplotlib.1069221.n5.nabble.com/file/n40916/Example.png> 



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Trouble-with-x-axis-labeling-tp40916.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to