0

I'm trying to plot a histogram of low mass galaxies and because these galaxies are so small the histogram reads them as 0 solar mass when that's not the case, they're just smaller than 1 solar mass. Is there a way to get those lower masses not to show as zero? I guess what I mean is if I could just zoom in on masses from 0 to 3 solar masses.

I tried to plot it as a simple histogram but the scale is uneven on the x axis and I'm not quite sure why. here's my code

plotlist = [] 
for halo in simSats:
    mvir = simSats[halo]['Mvir']
    plotlist.append(mvir)
plotlist = np.asarray(plotlist)
plt.hist(plotlist)
print(plotlist)
[1.75353080e+10 1.03454986e+10 1.17512034e+10 9.68613814e+09
 6.40655649e+09 5.04409401e+09 3.82798081e+09 5.80222974e+09
 1.04027038e+10 1.79983011e+10 1.95137540e+10 1.78910879e+10
 1.27659438e+10 1.81947913e+10 1.39142197e+10 1.13183104e+10
 1.03982277e+10 8.63489862e+09 7.42876035e+09 5.22600018e+09
 7.85432543e+09 4.75491031e+09 7.78396769e+09 9.69021839e+09
 4.93969876e+10 1.43326361e+10 1.63058245e+10 3.20865485e+09
 4.37412955e+09 1.14915472e+10 1.88181032e+10 4.67712244e+09
 1.13262254e+10 7.06200967e+09 8.49164480e+09 1.01777059e+10
 1.98494915e+10 6.07897332e+09 1.80687635e+10 4.31756164e+09
 6.01830299e+09 4.24692572e+09 6.61822346e+09 2.01933360e+10
 6.65404721e+09 4.35807966e+09 2.31729702e+10 1.79621449e+10
 4.97159178e+09 6.10014339e+09 5.74926372e+10 3.87533252e+10
 3.33590476e+09 5.43237319e+10 2.45991599e+10 1.26613191e+10
 1.09971690e+10 7.81951398e+09 1.22671623e+10]
  • 1
    Please provide real sample data to plot, along with the text (not image) of code to reproduce the problem graph. What do you want the graph to look like? What do you mean by “uneven on the x axis”? 123456 looks even to me – Mark Tolonen Oct 26 '22 at 17:53
  • Maybe you want the x-axis to be logarithmic? See e.g. https://stackoverflow.com/questions/47850202/plotting-a-histogram-on-a-log-scale-with-matplotlib – JohanC Oct 26 '22 at 18:19
  • @MarkTolonen Sorry for the confusion, what I meant by 'uneven' is that the values aren't centered right over the integers. I mainly want to plot values from 0 to 3 since that's what mass range most of the galaxies fall into – Oge Okoronkwo Oct 26 '22 at 18:22

0 Answers0