Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import datapane as dp
import numpy as np
import pandas as pd
df = pd.read_csv('../data/sha256_leading_zero_time_to_solve.csv')
df['Time'] = pd.to_timedelta(df['Time']) / np.timedelta64(1, 'm')
fig = make_subplots(specs=[[{"secondary_y": True}]])
# Add traces
fig.add_trace(
go.Scatter(
x=df['Number of Leading Zeros'],
y=df['Attempts'], name="number of attempts",
hovertemplate = "Leading Zeros: %{x}<br />Attempts: %{y}",
),
secondary_y=False
)
fig.add_trace(
go.Scatter(
x=df['Number of Leading Zeros'],
y=df['Time'], name="time to solve",
hovertemplate = "Leading Zeros: %{x}<br />Time (min): %{y}",
),
secondary_y=True
)
# Add figure title
fig.update_layout(
title_text="Number of Attempts & Time to Solve<br />By # of Leading Zeros"
)
# Set x-axis title
fig.update_xaxes(title_text="# of Leading Zeros")
#fig.update_layout(yaxis2 = dict(range=[0, 7],))
# # Set y-axes titles
fig.update_yaxes(title_text="# Attempts", secondary_y=False)
fig.update_yaxes(title_text="Time to Solve (minutes)", secondary_y=True)
report = dp.Report(dp.Plot(fig) ) #Create a report
report.upload(
name='SHA256 Leading Zeros Difficulty',
open=True,
description="a dual axis line chart showing the amount of time compared to the number of attempts it takes to solve a SHA256 hash with a certain number of leading zeros.",
visibility='PUBLIC'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment