Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Incorrect histogram display

I have tried to plot two sets of data in a histogram!
the data sets looks like this:

>>> df = load_diffae()
>>> print(df.shape)
(360000, 5)
>>> dfn = load_diffne()
>>> print(dfn.shape)
(360000, 5)

Both have 360000 rows

However, if you look at the histogram, it looks like the new data set has significantly more rows (shown on the Y axis) than the old data set. What could be the reason for this?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

my code:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from Extract_elevation import *

def load_diffae():
    df = dfl
    return df 

def load_diffd():
    dfn = dfld
    return dfn 

def Plot_show_eu(df,dfd, dfn):

    x = dfe['O18ad']
    z = dfne['O18nd']
    bins = np.linspace(-50, 1, 40)
    bins = 'auto'
    plt.hist(x, bins, alpha=0.65, label='alt')
    plt.hist(z, bins, alpha=0.65, label='new')
    plt.legend(loc='upper right') 

>Solution :

The bins are chosen differently, so more values enter each bin for larger bins and the plot appears "bigger".

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading