Set values for time axis
See original GitHub issueI’m unclear as to how I might set the values for a time axis. I’m using Axis
as follows…
Axis(title=my_title, values=my_values)
…and have tried setting my_values
to a list of ISO formatted strings, datetime
objects, datetime64
objects (np) and a DatetimeIndex
object (pd). In each case, the stacktrace indicates that a float
is required.
Thanks for any help in advance. I appreciate that this is less an issue and more a request for assistance, but there isn’t an Altair discussion forum.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
The time (vertical) axis is showing random seconds vs
Answer: · Click anywhere in the vertical axis to select it. Right-click and select Format Axis. · In the Axis Options: Minimum: Select...
Read more >Setting Time Axis Values in Excel
For instance, I used 3 hours as the major division on the graph you are looking at and 1 hour for the minor...
Read more >Time Axis - FusionCharts
Set the column name which you want to represent on the time axis as the value of the plot property. In this case,...
Read more >Display or change dates on a category axis - Microsoft Support
In the chart, right-click the category axis, and then click Format Axis. · In the Format Axis pane, select the Axis Options tab....
Read more >Display Data on a Time-Scale Axis - Windows Forms
To create a scatter chart with time values on the x-axis, use the Series collection with one or more NumericTimeSeries. The X-axis labels...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This reminds me that we should support our DateTime Definition object (that we introduced for temporal filter) for axis/legend’s
values
as well (https://github.com/vega/vega-lite/issues/1516). So this will be reasonable to use when people use Vega-Lite from JSON.That said, I think from Altair’s perspective, I think automatically date conversion to timestamp would be better. 😃
Possibly because the timestamp is UTC but our label displays local time.
We’ll have to work on support for UTC (https://github.com/vega/vega-lite/issues/446).
cc: @domoritz
Hello everyone,
Thank you all for your time. It’s reassuring to find such a committed bunch of core developers!
I followed @jakevdp and passed timestamps to
Axis
. Rather than hard-coding dates, I usedpd.date_range
as follows:The curious can find the associated notebook here. (It’s a quick exploration of bike usage in Bath, UK, which I prepared for an upcoming hack day.)