-
Notifications
You must be signed in to change notification settings - Fork 36
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
How to plot TimeSeries? #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Try using scale_x_datetime. At the moment this is the only way to plot time series. The input series can contain millis since Unix epoch. Also accepted Date, Instant and ZonedDateTime from java.time but these values will be converted to millis since Unix epoch. LocalDate, LocalTime and LocalDateTime are not supported. When formatting date-time labels Lets-plot assumes UTC time-zone. |
Thanks @alshan that works great! Another question:
|
Glad it worked for you. Regarding the other questions: To add a title use the ggtitle function. The background gridlines are not there yet but you can generate and style a set of horizontal/vertical lines using geom_hline and geom_vline functions. We don't have the zoom/pan kind of interactivity. The closest thing could be using the xlim or ylim parameters in coord_xxx function (coord_cartesian for example). Perhaps, if ipywidgets are available, a slider can be used to set these values but nobody ever tried this :). |
Thanks! great work team! |
Yes for gridlines, panning/zooming not in the nearest future) |
Thanks again! |
Thanks for the feedback! You can try the plotly.kt - not quite sure but it might have panning/zooming. |
There is a new demo in 1.3.0 with time series on X-axis: https://nbviewer.jupyter.org/github/JetBrains/lets-plot-kotlin/blob/master/docs/examples/jupyter-notebooks/formatting_axes_etc.ipynb |
@wangtieqiao fun hlines(range: IntProgression): Feature {
val horizontalLine: (Int) -> Feature = { yIntercept: Int ->
geom_hline(
yintercept = yIntercept,
alpha = 0.1,
color = GENERAL_MUTED_COLOR,
size = 0.02,
)
}
var horizontalLines: Feature = horizontalLine(range.first)
for (yIntercept: Int in range.first + range.step until range.last step range.step) {
horizontalLines += horizontalLine(yIntercept)
}
return horizontalLines
} It can be used like this: ggplot(dataFrame) + hlines(-110 until 110 step 5) Cheers 😊 |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Is there any example notebook to show how to plot timeseries data with time in X-axis?
X-axis data could be any of the Datetime classes like
LocalDate, LocalDateTime or ZonedDateTime
etcThe text was updated successfully, but these errors were encountered: