Hi there
I am trying to exploit some features of R to plot some crypto data. I am trying to use some examples found at
but I am having an issue since on the Z axis i do not get any data. I have on the x,y axis time and price and I want to plot the volume on the z axis (third column of the file). At the moment I do not see the z values of the volume.
I am sending the R script:
library(tidyverse)
library(viridis)
library(rayshader)
library(ggplot2)
dec = "."
btcUSDT <- read.csv("test orderbook/data/BTC_USDT 20220720_r.txt",header=TRUE,sep=";",dec=dec,strip.white = TRUE)
head(btcUSDT)
class(btcUSDT$time)
class(btcUSDT$price)
class(btcUSDT$volume)
btcUSDT %>%
ggplot(aes(x = time, y = price) ) +
geom_tile(aes(fill = volume),size=1,color="black") +
scale_x_continuous("Time") +
scale_y_discrete("Price") +
ggtitle("USDT order book") +
labs(caption = "2022-07-23 data") +
theme(axis.text = element_text(size = 12),
title = element_text(size = 12,face="bold"),
panel.border= element_rect(size=2,color="black",fill=NA)) ->
nn_gg
plot_gg(nn_gg, multicore = TRUE, width = 6, height = 5.5, scale = 300,
background = "#afceff",shadowcolor = "#3a4f70")
And I am sending a few rows of my sample data:
head(btcUSDT)
time price volume
1 1.658332e+12 24177.8 1.533
2 1.658332e+12 24178.3 1.535
3 1.658332e+12 24179.1 3.650
4 1.658332e+12 24179.8 3.950
5 1.658332e+12 24179.9 4.241
6 1.658332e+12 24180.0 35.546
class(btcUSDT$time)
[1] "numeric"
class(btcUSDT$price)
[1] "numeric"
class(btcUSDT$volume)
[1] "numeric"
And an image result that I get
Can anyone help?
Regards
Leonardo