Subscribe Bookmark


Jun 23, 2011

Visualizing completeness of food logging data with Graph Builder

The second graph of my Discovery Summit 2014 poster summarized my meal logging habits. I made this graph while trying to identify patterns in my summary data that could alert me to days with missing or incomplete daily food logs. Initially, I created a point chart in Graph Builder to plot each day’s calories consumed vs calories burned, with the percentage of meals I had logged (out of 6 possible meals) specified as a Wrap variable.

Calories burned by calories consumed

JMP testing manager Audrey Shull and product manager Dan Valente both suggested simplifying this graph when they reviewed my poster. While it was easy for me to spot outliers, like the blue points on the left side of the top two graphs, there was too much going on to understand with a quick glance. Next, I created a simpler view of this data showing the percentage of meals logged on the X axis and calories consumed on the Y axis in a point chart.Compliance point chart2

When I met with Xan Gregg, lead developer of Graph Builder and head of the data visualization group at JMP, he thought my chart could be improved further by plotting the number of meals logged instead of the percentage and adding jittering to better display the point density. We played around with the data in Graph Builder to explore additional graph type possibilities. In the end, I preferred the look of a density plot to all others we considered. The final version I included in my poster is shown below.

Density of cals consumed and meals

As you can see in the lower left above, I have skipped only 10 days of data collection since I began using the armband and its food logging software. I estimated daily calories without logging specific food items on 34 days, which show up with a single meal logged. In reviewing days with three logged meals, I noted that they all occurred during my pregnancy on days when I had apparently decided I really didn’t want to know my daily total, and stopped tracking!

This graph illustrates clearly that I usually log four-six meals per day. When looking at this graph, I think it’s important to remember that I collected this data eating foods that I chose, not following any specific diet or meal plan. I made an effort to log before or just after meals to improve recall of items and quantities; however, I didn’t plan for a particular number of meals per day or specific macronutrient percentages. Though food labels often refer to a 2,000-calorie-per-day diet, actual individual calorie needs are affected by many factors, including gender, age and base amount of lean body mass (LBM). I used an online calculator and prior experience to estimate my calorie needs as a  5’4.5” woman who has worked out with weights since age 13, walks several times a week and has a sedentary desk job. Trial and error using my own data is the best way to fine-tune how many calories I can eat and burn to reach and maintain weight-related goals. If this data-driven approach to weight loss interests you, I'd suggest collecting your own data and using it to find the intake and activity levels that allow you to progress toward your own goals.

To reproduce my food log meal graph with your own data, open a data table containing the number of meals you logged each day and the corresponding calories consumed each day. I created a number of meals variable by recoding the Meal Log Compliance measure imported from my BodyMedia Activity Summary file and set the type of meal number variable to Numeric and modeling type to Continuous. In my case, 100% compliance corresponded to six meals logged.

To create the graph, launch Graph Builder and drag:

  • Calories consumed to the Y axis.
  • Number of meals to the X axis.
  • To complete the graph, change the element type to Contour using the icon at the top of the window, adjust your Y-axis, graph title and axis titles if desired, and add one or more annotations from the Tools menu. You can right-click on annotations to change their appearance to match your graph color theme. Stay tuned for the next post where Xan and I show how I summarized my sleep data history using Graph Builder.

    If you'd like to read more about this project, you can check out the first blog post in this series to learn more about my interest in quantified self (QS) data analysis and my JMP Discovery Summit 2014 e-poster that explored 1,316 days of activity and food log data. You can read more in blog posts detailing how I wrote JSL scripts to import Excel-formatted Activity Summary files and text formatted food log files from BodyMedia®’s Activity Manager software into JMP. A JMP add-in is available on the JMP File Exchange so that you import your own files.  You can view a copy of my e-poster on the JMP User Community. It’s free to join the community, where you can learn from JMP users all over the world!