ajrlewis on Nostr: My bad ... the units are different so can't plot them on the same graph in that way ...
My bad ... the units are different so can't plot them on the same graph in that way ... here's the updated code:
```python
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import requests
currency = "USD"
response = requests.get(
f"https://mempool.space/api/v1/historical-price?currency={currency}";
)
data = response.json()
df = pd.DataFrame(data["prices"])
df["time"] = pd.to_datetime(df["time"], unit="s")
fig, ax1 = plt.subplots()
ax2 = ax1.twinx()
ax1.plot(df["time"], np.log2(df[currency]), color="Black", marker="o")
ax2.plot(df["time"], np.log10(df[currency]), color="#FF9900")
ax1.set_xlabel("Date")
ax1.set_ylabel(f"Log Base 2 Historical {currency} Price", color="Black")
ax2.set_ylabel(f"Log Base 10 Historical {currency} Price", color="#FF9900")
plt.show()
```
and the corresponding figure (i.e. it's the same shape):
```python
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import requests
currency = "USD"
response = requests.get(
f"https://mempool.space/api/v1/historical-price?currency={currency}";
)
data = response.json()
df = pd.DataFrame(data["prices"])
df["time"] = pd.to_datetime(df["time"], unit="s")
fig, ax1 = plt.subplots()
ax2 = ax1.twinx()
ax1.plot(df["time"], np.log2(df[currency]), color="Black", marker="o")
ax2.plot(df["time"], np.log10(df[currency]), color="#FF9900")
ax1.set_xlabel("Date")
ax1.set_ylabel(f"Log Base 2 Historical {currency} Price", color="Black")
ax2.set_ylabel(f"Log Base 10 Historical {currency} Price", color="#FF9900")
plt.show()
```
and the corresponding figure (i.e. it's the same shape):