Closed AndreiKingsley closed 1 year ago
Hi! Sorry, the issue description is kinda unclear. May I clarify it? Are you talking about the plot legend that uses numbers as labels instead of formatted date/time?
Like in this example:
%use lets-plot
import java.time.Instant.parse
val instants = listOf(
"2021-01-01T00:00:00Z",
"2021-02-23T00:00:00Z",
"2021-04-03T00:00:00Z",
"2021-05-04T00:00:00Z",
"2021-10-05T00:00:00Z"
).map(::parse)
val daysData = mapOf<String, Any>(
"days" to instants,
"val" to (1..instants.size)
)
val p = letsPlot(daysData) + geomBar() { x = "days"; color = "days" }
p
Actual result:
And you expected this?
Am I correct?
Yes!
Also i want axis formatting when i use, for example, error bar: `val instants = listOf( "2021-01-01T00:00:00Z", "2021-01-01T00:04:00Z", "2021-01-01T00:00:00Z", "2021-01-01T00:00:00Z", "2021-01-01T00:00:00Z", ).map(::parse) val instants2 = listOf( "2021-01-01T00:05:00Z", "2021-01-01T00:05:00Z", "2021-01-01T00:05:00Z", "2021-01-01T00:05:00Z", "2021-01-01T00:05:00Z", ).map(::parse) val daysData = mapOf<String, Any>( "t1" to instants, "t2" to instants2, "val" to (1..instants.size) )
val p = letsPlot(daysData) + geomErrorBar(stat = Stat.identity) { x = "val"; ymin = "t1" ymax = "t2" } p` gives
but I expect y date-time formatting
Fixed in LPK v4.4.0
We can use
Instant
as the data type, but we need to addscaleDatetime()
to format the axis correctly. Why don't we do this automatically when we have Instant as a data type? Including in the case ofyMin
,middle
etc. It's also a bit strange that the public api lacks something likescaleColorDatetime
, but we can implement it with