100,000 miles of driving visualized

3 replies · 4K views · last reply
Science Advisor
Gold Member
Messages
2,412
Reaction score
5,292
I thought that I would share some interesting visualizations that I have created from some personal driving data. I've recently been introduced to the wonderful world of the D3.js Javascript library. D3 stands for Data-Driven Documents is an extremely powerful and versatile data visualization tool. I've been using it to analyze administrative data at work but I wanted to do something for fun.

Where can I get some interesting data I thought, when I remembered that I have been recording fillup data for my 2006 Prius since I bought it new in Aug. 2006. I am a few hundred miles short of 100K miles so I decided to create a web page containing some D3 charts with the data. I have put together a series of cross-filtered charts that all update based on user selections. I wanted to verify what I knew to be anecdotally true (that milage is better in the summer) and to see what other interesting facts could be found. I hope that some of you find the data interesting.

About the data:
Ever since I purchased my car, I have been recording the date, mileage, gallons, estimated MPG and occasional notes every time I fill up with gas. I fill it when it's on the last notch of the gauge (90+ % of the time), have never partially filled the tank and, except for a few rare occasions, have always stopped at whole dollar increments. The dashboard has an estimated MPG that I reset each time as well. If you want to see the code in action, the starting point for my visualizations came from the Crossfilter site.

Here is the starting data without any filters:

Dashboard of cross-filtered histograms of 231 fillups: distance per fillup (miles), month, year, estimated MPG, actual MPG, estimated vs. actual mileage (%), and a table of selected fillups with date, mileage, distance, fuel, actual MPG and estimated MPG.


As you can see from the data, I generally get around 375 - 500 miles between fillups on a 12 gallon tank and I tend to do slightly more driving in the summer. The estimated MPG that the car reports tends to be in a tighter range than the actual mileage and it has also tended to over estimate it by a few percentage points. Since I haven't normalized the data by month, the data does tend to skew (especially for August).

OK, I've got some nice charts that show some minor statistical data but now what? Well, these are cross-filtered charts which means that I can select specific sections of one chart and all of the other charts are automatically updated. Let's take a look at my anecdotal assumption about mileage being better in the summer. To do that, I'm going to select all of the actual mileage data to the right of the peak.

Dashboard of cross-filtered histograms titled "124 of 231 fillups selected": distance per fillup, month, year, estimated MPG, actual MPG with a selected range, and estimated vs. actual mileage percentage.


As I expected, the fillups with better actual mileage tend to occur in the warmer months. It also seems that the number of good mileage fillups have been going down in the last few years. Another thing that I notice is that the estimated vs. actual mileage has shifted down. It seems that the car tends to under-estimate the mileage on good MPG results. Hmmm, I wonder if that's true?

But first, I want to look at the distance traveled chart. By selecting the right side of the bell (425 miles or more), I get a much better bell centered on the summer months.

Dashboard of linked histograms of 119 of 231 fillups: distance per fillup (miles), month, year, estimated MPG, actual MPG, and estimated vs. actual mileage percent.


However, I remember that my data isn't normalized and decide to just look at the records where I traveled 500 miles or more. Now I have a more defined bell curve centered on July - half of all of the July fillups resulted in 500+ miles. But then I notice the year chart - I've only had a single 500+ mile tank in the last four years!

Dashboard of five cross-filtered histograms and one more chart: distance per fillup in miles, fillups by month, fillups by year, estimated MPG, actual MPG, and estimated vs. actual mileage percent, with 37 of 231 fillups selected.


I'm not sure what could be the cause of this but it seems clear that the car has been struggling with its MPG over the last few years.

I do know that there are clear variations between tanks because of the up and down swings from the actual MPG plot here. I plan on adding a 2 - 3 tank moving average to try to smooth it out. Still, you can see seasonal variations in the calculated MPG readings.

Line graph of monthly fuel economy in miles per gallon from about 2006 to 2015, plotted as a jagged blue line between roughly 35 and 65, with the y-axis ticks at 35 to 60 and the x-axis labelled with years 2007 to 2015.


That's where I'm at right now. I hope that you enjoyed my project. :smile:
 
  • Like
Likes   Reactions: Silicon Waffle, billy_joule and mfb
Interesting data!
Borg said:
It also seems that the number of good mileage fillups have been going down in the last few years.
I don't see a significant difference.
Borg said:
Another thing that I notice is that the estimated vs. actual mileage has shifted down. It seems that the car tends to under-estimate the mileage on good MPG results. Hmmm, I wonder if that's true?
That is an expected bias from your selection.
Think of the distribution in two dimensions: you tend to keep "good actual mileage, lower expectation" but remove "high expected mileage, lower actual value".
Borg said:
However, I remember that my data isn't normalized and decide to just look at the records where I traveled 500 miles or more. Now I have a more defined bell curve centered on July - half of all of the July fillups resulted in 500+ miles. But then I notice the year chart - I've only had a single 500+ mile tank in the last four years!
You have gotten more conservative with (not) using the remaining fuel, or distance between gas stations decreased?
Or the car got older and has a lower efficiency now, which is certainly some contribution to the effect.
 
  • Like
Likes   Reactions: Silicon Waffle and Borg
mfb said:
You have gotten more conservative with (not) using the remaining fuel, or distance between gas stations decreased?
Or the car got older and has a lower efficiency now, which is certainly some contribution to the effect.
Thanks for your comments. I haven't done much in the way of statistical analysis so I expected some wrong conclusions on my part. I do think that the car has been getting less effecient though.
 
mfb said:
You have gotten more conservative with (not) using the remaining fuel, or distance between gas stations decreased?
Or the car got older and has a lower efficiency now, which is certainly some contribution to the effect.
So... Rather than trust my assumptions, I added a fuel chart. Here's the starting chart which shows the vast majority of my fillups are between 8 - 10 gallons.

Two bar charts side by side. Left, titled Year: fillups per year from 2006 to 2015, with bars peaking near 33 in 2007 and 31 in 2009. Right, titled Fuel per fillup: histogram of fuel in gallons from 0 to 14, with the tallest bar near 8 gallons, about 95 fillups.


When I select all of the 500+ mile trips, I used between 9 - 11 gallons of fuel.

Two bar charts: left, distance traveled per fillup in miles, histogram with bars peaking near 400 miles and a shaded selection from about 500 to 700 miles; right, fuel per fillup in gallons, bars mostly between 8 and 11 gallons, peaking near 9 gallons.


The 2007 - 2012 years had most of the 500+ mile trips so, selecting them gives this result where the fillups are slightly higher than the curve shown in the first graph.

Two bar charts: left, Fillups per year from 2006 to 2015 with a selected range of 2007 to 2012; right, Fillups by Fuel (gallons) histogram from 0 to 14 gallons, peaking near 8 to 10 gallons.


However, when I look at the 2012 - 2015 data, the records show that the fillups have been mostly in the 8 gallon range.

Two bar charts side by side: left, Year vs Fillups from 2006 to 2016 with 2012 to 2015 selected; right, Fuel per fillup histogram in gallons, peaking near 8 gallons.


I guess that I've gotten more conservative with not using the remaining fuel after all!
 
  • Like
Likes   Reactions: mfb and Silicon Waffle