here is the code:
DateTick = x[1]:Dates.Month(6):x[end]
DateTick2 = Dates.format.(DateTick,"Y-m")
p1 = scatter(x, y1, xticks = (DateTick, DateTick2),
title = "Money supply", xrotation=-45, legend = :topleft)
I want the x value of 2002-7 ( and others ) to display correctly when hovering on those points
empet
November 3, 2022, 9:32am
2
Could you please mention how is recorded date in your CSV file I suppose you are reading the get df[!, :date]?
Take a look here https://plotly.com/julia/time-series/ how the tickformat is set for date.
Stephen
November 3, 2022, 11:22am
3
this is reading from csv file,
`money = CSV.read(“货币供应量.csv”,DataFrame)
x = money.日期
`
empet
November 3, 2022, 4:18pm
4
I created such a csv file with date containing only year and month, but the date is automatically read in the form yy-mm-01. (CSV v0.10.4, DataFrames v1.3.4).
But I succeeded to get displayed your format, on hover, using customdata
and hovertemplate
:
fig= Plot(scatter(x=df[!, :date], y= df[!, :GOOG], mode="markers", marker_size=16,
customdata=df[:, :date],
hovertemplate="(%{customdata|%Y-%m}, %{y})<extra></extra>"),
Layout(width=600, height=350))
Stephen
November 4, 2022, 11:48am
5
ha, I see, your code works, Thank you !
Should I use PlotlyJS instead of using Plots
, plotlyjs()
as backend ? when I use plotlyjs()
backend it shows as this
BTW, what is the difference of
using Plots
plotlyjs()
and
using PlotlyJS
?
when using plotlyjs as backend, should I must use specific syntax and format of PlotlyJS
rather than general syntax of Plots
?
empet
November 4, 2022, 12:02pm
6
Plots.jl and PlotlyJS.jl are two different plotting packages, with distinct functions and plot layouts. But Plots can use plotlyjs() as backend.