[Python] python histogram line styles

Discussão em 'Python' iniciado por Stack, Agosto 26, 2025.

  1. Stack

    Stack Membro Participativo

    I'm plotting a histogram for class and while I have all of the important things figured out, I can't seem to replicate this line style of a solid line with the points showing up on the line. It's almost a combination of dotted and solid.

    this is my code for this histogram... n,bins,patches = ax[0,0].hist(Data1,bins=100,density=True)

    x = np.arange(bins[0],bins[len(bins)-1],0.25)
    y = [normalProbabilityDensity(val,mu=xmu,sigma=xsigma) for val in x]

    ax[0,0].axis([600, 1000, 0.000, 0.010])
    ax[0,0].yaxis.set_ticks([0.000, 0.002, 0.004, 0.006, 0.008, 0.010])
    ax[0,0].set_ylabel('Relative Frequency', fontsize = 10)
    ax[0,0].plot(x,y,label="norm prob density", linestyle="dashed")
    ax[0,0].legend(loc='upper left', fontsize="8")
    ax[0,0].grid(True)


    I need the line to look like this image...[

    [​IMG]

    Continue reading...

Compartilhe esta Página