The last candle on the chart is displayed at a smaller distance than all the others
Here is the example code
set.seed(3)
library(xts)
tm <- Sys.time()+1:5000
p1 <- rnorm(5000) |> cumsum() |> xts(tm) |> to.minutes(name = NULL)
library(plotly)
df1 <- data.frame(Date=index(p1),coredata(p1))
fig <- df1 %>%
plot_ly(x = ~Date, type="candlestick",
open = ~Open, close = ~Close,
high = ~High, low = ~Low,
line = list(width = 1),
increasing = list(line = list(color = '#17BECF')),
decreasing = list(line = list(color = '#7F7F6F'))) %>%
layout(title = "Basic Candlestick Chart",
xaxis = list(rangeslider = list(visible = F),showgrid = FALSE),
yaxis = list(showgrid = FALSE),
margin = list(l = 40, r = 0, b = 10, t = 10),
dragmode = "pan",
plot_bgcolor = 'black',
paper_bgcolor = '#000011',
font = list(color = 'gray'), # цвет текста
images = list(
list(
source = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/R_logo.svg/1200px-R_logo.svg.png",
x = 0, y = 1,
sizex = 1, sizey = 1,
xref = "paper", yref = "paper",
opacity = 0.1,
layer = "below"
)
))
fig