I’m trying to plot stock prices which are daily but not on weekends. When I run this code
using Dates, DataFrames, Plots
df = DataFrame(Date=today()+Month(-1):Day(1):today(), rtn = rand(Float64, 32))
ticks = round.(df.Date, Week(1)) |> unique
delete!(df, [10, 11, 17, 18])
println(df)
plt = Plots.plot(df.Date, df.rtn,
xlabel = "Date",
ylabel = "Cumulative Return",
xticks = (ticks, Dates.format.(ticks, "mm/dd/yy")),
xlims = Dates.value.([df.Date[1], df.Date[end]]),
xrot = 60,
color = :red,
size=(600,400)
)
display(plt)
The labels for the x axis go off the scale. Shouldn’t xlim take care of this?