<div dir="ltr"><div>Hi Eric,</div><div><br></div><div>Thank you very much for that, it worked.</div><div><br></div><div>Thank you Paul as well for your input.</div><div><br></div><div><br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><font size="2"><span style="font-family:arial,sans-serif"><i>Ramiro Caisse Saide</i></span></font></div><div><font size="2"><span style="font-family:arial,sans-serif"><i>MPhil Research Student</i></span></font></div><div><div><font size="2"><span style="font-family:arial,sans-serif">Department of Physics</span></font></div><div><font size="2"><span style="font-family:arial,sans-serif">University of Mauritius</span></font></div><font size="2"><span style="font-family:arial,sans-serif">Contact Number: +258 845672884<br></span></font></div><div><font size="2"><span style="font-family:arial,sans-serif">Email: <a href="mailto:ramiro.saide@umail.uom.mu" target="_blank">ramiro.saide@umail.uom.mu</a><br></span></font></div><div dir="ltr"><div><span><span><p style="margin-bottom:0in;line-height:100%"><br></p></span></span></div><div>


        
        
        
        </div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Paul Barrett <<a href="mailto:pebarrett@gmail.com">pebarrett@gmail.com</a>> escreveu no dia sexta, 23/04/2021 à(s) 15:39:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Check out the 'xticks' method, i.e., plt.xticks([x_values], [x_labels])<div><br></div><div><a href="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.xticks.html" target="_blank">https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.xticks.html</a><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 23, 2021 at 5:45 AM Miro Saide <<a href="mailto:mirosaide@gmail.com" target="_blank">mirosaide@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello all,</div><div><br></div><div>I am using the following code to plot the rise and set of a particular star from a selected location on earth:</div><div><br></div><div>import numpy as np<br>import matplotlib.pyplot as plt<br>from astropy.visualization import astropy_mpl_style, quantity_support<br>plt.style.use(astropy_mpl_style)<br>quantity_support()<br>import astropy.units as u<br>from astropy.time import Time<br>from astropy.coordinates import SkyCoord, EarthLocation, AltAz<br>from astroplan import download_IERS_A<br>download_IERS_A<br>from astroplan import Observer, FixedTarget<br><br>#Latitude and LOngitude of some cities<br>cities = [[-25.9553,32.5892],[-25.7069,28.2294],[-15.4166,28.2833],[-22.95764,18.49041],[-13.254308,34.301525]]<br>cities = np.array(cities)<br><br>time = Time("2000-11-12 11:00:00",format='iso')<br><br>#Star target<br>target = SkyCoord.from_name("Barnard's star")<br><br><br>#Calculation of the rise and set time <br>Location = Observer(latitude=cities[:,0]*u.deg, longitude=cities[:,1]*u.deg)<br>star_rise_time = Location.target_rise_time(time, target, which='next')<br>star_set_time = Location.target_set_time(time, target, which='next')<br><br>#Get the time in iso format<br>rise_1 = star_rise_time.iso<br>set_1 = star_set_time.iso<br><br><br>#Random values<br>Random_valeus = [1600,2118,3000,2750,3500]<br><br><br>#Plot the time against random values<br><br>plt.plot(rise_1,Random_valeus, marker ='o',label = 'rise')<br>plt.plot(set_1,Random_valeus, marker ='o',label = 'set')<br>plt.xlabel('Time [Hours]')<br>plt.ylabel('Random_valeus')<br>plt.show()</div><div><br></div><div>When I run this the time axis in the plot gets messy the values overlap and can't clearly see what is what.</div><div><br></div><div>I wonder if there's is a way to plot this with hours only, neglecting the year, month, day, minutes, and seconds?</div><div><br></div><div>Thanks in advance.<br></div><div><br></div><div><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><font size="2"><span style="font-family:arial,sans-serif"><i>Ramiro Caisse Saide</i></span></font></div><div><font size="2"><span style="font-family:arial,sans-serif"><i>MPhil Research Student</i></span></font></div><div><div><font size="2"><span style="font-family:arial,sans-serif">Department of Physics</span></font></div><div><font size="2"><span style="font-family:arial,sans-serif">University of Mauritius</span></font></div><font size="2"><span style="font-family:arial,sans-serif">Contact Number: +258 845672884<br></span></font></div><div><font size="2"><span style="font-family:arial,sans-serif">Email: <a href="mailto:ramiro.saide@umail.uom.mu" target="_blank">ramiro.saide@umail.uom.mu</a><br></span></font></div><div dir="ltr"><div><span><span><p style="margin-bottom:0in;line-height:100%"><br></p></span></span></div><div>


        
        
        
        </div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
AstroPy mailing list<br>
<a href="mailto:AstroPy@python.org" target="_blank">AstroPy@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/astropy" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/astropy</a><br>
</blockquote></div>
_______________________________________________<br>
AstroPy mailing list<br>
<a href="mailto:AstroPy@python.org" target="_blank">AstroPy@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/astropy" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/astropy</a><br>
</blockquote></div>