mémorandum complot

échantillon parcellaire

import

import plotly
import plotly.graph_objs as go

import pandas as pd
import numpy as np

Lecture des données

df = pd.read_csv('https://raw.githubusercontent.com/jbrownlee/Datasets/master/daily-total-female-births.csv')
df['Births2'] = df['Births'] + np.random.normal(0, df['Births'].std(), [len(df)]).astype(int)
df['Births3'] = df['Births'] + np.random.normal(0, df['Births'].std() * 2, [len(df)]).astype(int)

df = df.loc[:50, :]

Liune Chart

tr1 = go.Scatter(x=df["Date"], y=df["Births"], mode="lines+markers")
layout = go.Layout(
    title="Births",
    xaxis=dict(title="date"),
    yaxis=dict(title="births")
)
plotly.offline.iplot(dict(data=[tr1], layout=layout))

image.png

Save and show fig

plotly.offline.iplot(dict(data=[tr1], layout=layout), filename='result', image="png")

Affichage de la valeur

tr1 = go.Scatter(x=df["Date"], y=df["Births"], mode="lines+markers+text", text=df["Births"], textposition="top center")
layout = go.Layout(
    title="Births",
    xaxis=dict(title="date"),
    yaxis=dict(title="births")
)
plotly.offline.iplot(dict(data=[tr1], layout=layout))

image.png

Affichage de données multiples

tr1 = go.Scatter(x=df["Date"], y=df["Births"], mode="lines+markers", name="Births")
tr2 = go.Scatter(x=df["Date"], y=df["Births2"], mode="lines+markers", name="Births2")
tr3 = go.Scatter(x=df["Date"], y=df["Births3"], mode="lines+markers", name="Births3")
layout = go.Layout(
    title="Births",
    xaxis=dict(title="date"),
    yaxis=dict(title="births")
)
plotly.offline.iplot(dict(data=[tr1, tr2, tr3], layout=layout))

image.png

scatter

tr1 = go.Scatter(x=df["Date"], y=df["Births"], mode="markers")
layout = go.Layout(
    title="Births",
    xaxis=dict(title="date"),
    yaxis=dict(title="births")
)
plotly.offline.iplot(dict(data=[tr1], layout=layout))

image.png

Histogram

tr1 = go.Histogram(x=df["Births"], xbins=dict(start=0, end=101, size=5))
layout = go.Layout(
    title="Births",
    xaxis=dict(title="birth"),
    yaxis=dict(title="count"),
    bargap=0.2
)
plotly.offline.iplot(dict(data=[tr1], layout=layout))

image.png

Affichage de données multiples

tr1 = go.Histogram(x=df["Births"], xbins=dict(start=0, end=101, size=5))
tr2 = go.Histogram(x=df["Births2"], xbins=dict(start=0, end=101, size=5))
layout = go.Layout(
    title="Births",
    xaxis=dict(title="birth"),
    yaxis=dict(title="count"),
    bargap=0.2,
    bargroupgap=0.2
)
plotly.offline.iplot(dict(data=[tr1, tr2], layout=layout))

image.png

Recommended Posts

mémorandum complot
Mémorandum Matplotlib
mémorandum Linux
Mémorandum Python
Mémorandum Django
Mémorandum de commandement
Mémorandum Python 2
Mémorandum Slackbot (1)
mémorandum de multitraitement
Mémorandum MetaTrader5
Mémorandum ShellScript
mémorandum pip
Mémorandum Python
mémorandum pydoc
mémorandum python
Mémorandum de Pandas
mémorandum python
Mémorandum DjangoGirls
Mémorandum de commandement
Mémorandum Python
mémorandum pandas
mémorandum python
Mémorandum Python
[Visualisation] J'ai essayé d'utiliser Bokeh / plotly! 【mémorandum】
Mémorandum de base Python
Mémorandum de type RAID
Mémorandum de Python Pathlib
Mémorandum de problème de sac à dos
Mémorandum de sed
Mémorandum Python (algorithme)
Mémorandum Linux [liens]
mémorandum de commande nc
Mémorandum d'apprentissage profond
mémorandum numpy 1 / np.pad
Mémorandum d'API Revit
Commande mémorandum conda
Mémorandum d'opération Pandas
Mémorandum de commande setuptools
Mémorandum Python [liens]
Mémorandum de procès tslearn
Mémorandum de base de Django
Mémorandum sur la validation