Subscribe Bookmark


Jun 23, 2011

Creating graphs of muscle quality and body fat in Graph Builder

In my previous post, I shared several Graph Builder graphs of the muscle quality and body fat percentage data I’ve been getting from my Skulpt Aim. However, since the post was already long, I didn’t have a chance to include any instructions on how to recreate those graphs. In case you have similar data or want to create a similar type of graph, here’s how to do it! I have also included animated gifs that capture the main steps in the process of creating each graph. (Click the animated gifs and graphs to see them enlarged.)

Weight Graph with Annotations

This graph shows all the weight data points that I have gleaned from medical record requests, notebooks, and wireless scale data from birth through about 2014. My table includes columns with weight measurements in rows and the date of each in m/d/y format.

Weight history purple and aqua2

In Graph Builder, I used the following steps to create this graph:

  • Dragged Weight to the Y axis (I deleted the label intentionally).
  • Dragged Date to the X axis.
  • Right-clicked in the graph to choose Smoother > Change to > Line.
  • Right-clicked on the line in the legend to change the Line Color to black.
  • Unchecked the Show Legend option under the red triangle next to Graph Builder.
  • Right-clicked on the X axis and increased the axis label nesting to 3, and then turned off labels and tick marks on Level 1 and Level 2 tab (corresponding to day and month) and tick marks on Level 3 tab (year).
  • Added a Y-axis reference range by right-clicking on the Y axis to open the Axis Settings dialog, clicking the Allow Ranges checkbox, and specifying a range extending from 130-135.
  • Added text annotations by clicking on the toolbar icon, typing in my text, and right-clicking to change the background color, font color and style. I color-coded the annotation for my childhood weight range in a different color.
  • Added vertical line annotations to indicate each of the weight ranges for childhood and adult years.
  • Lifelong weight history short

    Graphs of Body Fat Percentage and Muscle Quality

    The stacked table I used to create this graph included columns for Date, % fat, MQ, Body part, and Side, with one row for each observation.

    To create this graph, I took the following steps in Graph Builder:

    • Dragged % fat to the Y axis drop zone.
    • Dragged MQ to the X axis drop zone.
    • Clicked on the smoother element icon to remove it.
    • Added a regression line by dragging that element from the Graph Builder toolbar into the graph.
    • To create the version shown below with a separate color and regression element for each body part, I dragged Body Part to the Overlay variable drop zone. You can see my steps in the animated gif below.

      fat vs MQ and overlay

      Bar Graph of Replicates by Side

      To create this graph, I started with my Skulpt Aim results table, and then created a summary table from that data by clicking Tables > Summary, choosing the Replicate column, selecting N as the Statistic, and adding Body part and Side as Group variables.

      Starting from the Summary results table, I performed the following steps:

      • Dragged N(Replicates) to the Y-axis drop zone.
      • Clicked the Bar element on the Graph Builder toolbar.
      • Changed the Summary Statistic to Sum in the Bar options on the left.
      • Dragged Body part to the X-axis drop zone.
      • Dragged Side to the Group X drop zone.
      • Bar graph of replicates by side and body part short

        Body Shape Graph of MQ and % fat

        I made my next two graphs using custom female muscle shape files I created with the free Custom Map Creator add-in. I described how I used the add-in to create these files in a previous post. By the way, I uploaded copies of my map files to the JMP user community here. Apologies to the guys -- you are going to have to create your own shape files! To make my custom map visible to JMP, I placed the shape files created by the add-in into the folder C:\Users\~myusername\AppData\Roaming\SAS\JMP\Maps.

        Comparing my shape files to the areas measured by the Aim, I noted that the Back measurement area for the Aim was in the area I call Trapezius in my shape files. I created a copy of my Body part variable in my Aim results table and named it Body shape, then changed all occurrences of Upper Back to Trapezius in that column so that the colors would show up in the correct area of my body map. I did wish that I had done a better job with my Trapezius shape.

        Then, I performed the following steps:

        • Dragged in MQ as a color variable.
        • Right-clicked on the axis and chose gradient.
        • In the Gradient Settings dialog, clicked the Discrete Colors checkbox and clicked on the Color Theme bar to choose Muted Yellow to Red as the Current Theme.
        • Right-clicked on the X and Y axis to open the Axis Settings dialog and uncheck the boxes for tick marks and labels.
        • I performed the same set of steps for my % fat graph which appeared below the MQ one, except that I also clicked the Reverse Color checkbox so that lower body fat areas would show up colored red rather than yellow. As you’ll recall, MQ and % fat are inversely related, and the Skulpt app also uses color gradients that color high MQ and low % fat similarly.

          Body map by MQ

          Graphing My Measurement Variability

          My final graph required calculations of daily Standard Deviation by body part and side for both MQ and % fat. I initially used Summary to calculate these statistics, dragging the SD columns from the linked Summary table into my main table. While this is a handy shortcut for a one-time calculation, I preferred for the calculation to happen automatically when I added new data to the table rather than repeating the Summary step each day.

          Thanks to a suggestion from Xan Gregg, I decided to use a Column Standard Deviation formula column and specify my Body Part/Side concatenated variable and Date as the two optional By Vars in the formula. This gave me values for SD(MQ) and SD(% fat) for each body part, side and day.

          Formula SD MQ

          To create a graph of these values, I performed the following steps:

          • Dragged SD[MQ] to the Y axis drop zone, unchecked the Jitter option, and chose Mean as my Summary Statistic.
          • Dragged SD[% fat] to the Y axis drop zone below MQ (in a separate section of the graph), unchecked Jitter, and chose Mean as my Summary Statistic.
          • Added Body part as an Overlay variable.
          • Added smoothers to both graphs by dragging that element in from the Graph Builder toolbar.
          • Dragged Month, then Day to the X axis to create a nested axis layout.
          • Added Side as a Group X variable.
          • Added a Local Data Filter from the toolbar icon, choosing a subset of Body parts (Abs, Bicep, Tricep, Quadricep, and 4 site average) and the Right Side in the filter.
          • Reducing my measurement variability short

            I also made some final adjustments to ranges and decimals in the Axis Setting dialog, added shaded axis reference ranges between 0 and 1, and increased the Graph Spacing by right-clicking on the division between the graph sections and changing the number to 5.

            I’ll be giving a talk on using my custom body map file with my workout data at JMP Discovery Summit in San Diego next week. I hope to see you there! If you won’t be in San Diego, you can see my previous blog posts on creating custom maps and workout data visualization in my Fitness and Food series on the JMP Blog.

            Community Member

            James Peluso wrote:


            As a 32-year SAS user and a 20-year JMP user, I really love your articles!

            Keep up the GREAT work!!


            Shannon Conners wrote:

            Thanks, James! I appreciate the positive feedback. I enjoy writing on these topics and showing off what JMP can do!

            Community Member

            Mike Simmons wrote:

            This is great work. I've also been passionate about my long term fitness and health. Your interview on the Quantified Self podcast was very inspiring and provided some great ideas on how to be meticulous and disciplined about data collection!

            Thanks for sharing.