简体   繁体   中英

QQ-plot using Plotly in Python

Is there a standard, effective way of producing a QQ-Plot using Plotly?

I would be interested in testing the normal/log-normal fit of my data.

Alright, here is how I think the state of affairs is now [ 2020 edit ]:

Say we have 500 random draws from a distribution which we think might be the lognormal distribution:

X_lognorm = np.random.lognormal(mean=0.0, sigma=1.7, size=500)

Plotting

Imports

import numpy as np
from scipy import stats
import plotly.graph_objects as go

Run plotly

qq = stats.probplot(X_lognorm, dist='lognorm', sparams=(1))
x = np.array([qq[0][0][0], qq[0][0][-1]])

fig = go.Figure()
fig.add_scatter(x=qq[0][0], y=qq[0][1], mode='markers')
fig.add_scatter(x=x, y=qq[1][1] + qq[1][0]*x, mode='lines')
fig.layout.update(showlegend=False)
fig.show()

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM