I'm using plotrix.twoord
to compare two plots in a single graph using this code:
library(plotrix)
mempool<-read.csv("mempool-size.csv")
mempool$date <- as.Date(mempool$date)
fees<-read.csv("transaction-fees.csv")
fees$date <- as.Date(fees$date)
twoord.plot(mempool$date,mempool$value,fees$date,fees$value,type="b",
ylab="Unconfirmed transactions (B)",rylab="Fees paid per day (BTC)",
main="Fees and mempool size since 2017",
)
This prints a graph like this:
This looks almost right but the left axis looks a bit odd. I would like it to show the unit (B) after the values - preferably with metric prefixes instead of scientific notation (20MB instead of 2e07B).
I'm not sure if plotrix.twoord provides an option like this, so I tried to use ggplot instead:
ggplot() +
geom_line(data=fees, aes(x=date, y=value), color='black') +
geom_line(data=mempool, aes(x=date, y=value), color='red')
But now the fees line is just flat because it doesn't have it's own axis.
You can find the data here if you want to try it yourself: http://www.sharecsv.com/s/07076796191d9e414e5b50840d9ed7ad/mempool-size.csv http://www.sharecsv.com/s/72a183dd3ab0df781eacbfee81999548/transaction-fees.csv