OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Plotting axes in matplotlib that have seemingly random values

  • Thread starter Thread starter k.dav
  • Start date Start date
K

k.dav

Guest
In astronomy, we divide the night sky up in a way that does not make sense to matplotlib. I am essentially trying to plot something where the x axis looks like this:

200 250 300 350 0 100 150 200

Each integer should be a separate tick on the x axis. I have tried:

Code:
import matplotlib as plt

RA = [10, 45, 8, 340, 255]
DEC = [10, 2, 15, 8, 20]

ticks = [200, 250, 300, 350, 0, 100, 150, 200, 249.9999999]
plt.scatter(RA, DEC)
plt.xticks(DEC, tx)

But this throws an error:

UnitsConversionError: Can only apply 'greater' function to dimensionless quantities when other argument is not a quantity (unless the later is also zero/infinity/nan

I have also tried using the plt.xlim keyword but there is not a clear way that I can see to break the limits into multiple sections. It seems to only take a high and a low number.
<p>In astronomy, we divide the night sky up in a way that does not make sense to matplotlib. I am essentially trying to plot something where the x axis looks like this:</p>
<p>200 250 300 350 0 100 150 200</p>
<p>Each integer should be a separate tick on the x axis. I have tried:</p>
<pre><code>import matplotlib as plt

RA = [10, 45, 8, 340, 255]
DEC = [10, 2, 15, 8, 20]

ticks = [200, 250, 300, 350, 0, 100, 150, 200, 249.9999999]
plt.scatter(RA, DEC)
plt.xticks(DEC, tx)
</code></pre>
<p>But this throws an error:</p>
<blockquote>
<p>UnitsConversionError: Can only apply 'greater' function to dimensionless quantities when other argument is not a quantity (unless the later is also zero/infinity/nan</p>
</blockquote>
<p>I have also tried using the <code>plt.xlim</code> keyword but there is not a clear way that I can see to break the limits into multiple sections. It seems to only take a high and a low number.</p>
 

Latest posts

Top