Business Intelligence Tools / Data Science & Analytics

Normal Distribution Curve on a Visualization

I received an interesting request from a user that deserves sharing.  The user requested a visualization showing the curve of a normal distribution of data points.  Now, just to be clear, a visualization that shows the distribution of data points is a histogram, which looks like this:

Histogram

histogram

The histogram might vary a little bit if you change the number of bins being used, but it always has the continuous value along the X-axis and the (Row Count) on the Y-Axis.  However, the user didn’t want to see the bars of the histogram, just a curve that represented the histogram, which would look like this:

Normal Distribution Curve

curve only

This type of visualization is simple and easy to create in Spotfire using the following steps.

Creating the Visualization

  1. Add a bar chart
  2. Configure the X-Axis with the continuous value and the Y-Axis with (Row Count)
  3. On the X-Axis, click the down arrow on the axis selector and make sure the “Auto-Bin” box is checked.
  4. If needed, right click on the axis selector and choose “Number of Bins” to set the desired number of bins.
  5. In the legend, click on the color circle and color the bars the same color as the background (probably white).
  6. Go to Properties > Lines & Curves > Add > Gaussian Curve fit

BAM!  Done!  The Gaussian Curve fit is the normal distribution and represents the histogram as a curve.  If you combine the curve and the histogram, it looks like this:

curve and histogram

 

In the end, Spotfire had the functionality to quickly and easily meet the user’s needs!

7 thoughts on “Normal Distribution Curve on a Visualization

  1. diy resin system Reply

    Hi! Quick question that’s totally off topic. Do you know how to make your site mobile friendly?
    My blog looks weird when viewing from my iphone4.
    I’m trying to find a theme or plugin that might be able
    to correct this problem. If you have any suggestions,
    please share. Thank you!

  2. jimbo_spotfire Reply

    That’s cool but I’d check the terminology – that curve is fitted but it’s not a normal distribution since it’s skewed – normal distributions take a bell shape because their tails are symmetrical.

  3. Adriana Reply

    Hi,
    How did you made the visual that doenst havee the bars of the histogram, just the curve that represented the histogram? (the second image)

    Thanks!

    • Adriana Reply

      Just to add a bit more.. what I want to do is compare several populations on the same plot, but if I use color by, and then set everything to white, I will lose also the curves. Trellis will not work because we want to curves to be one of top of the other.. any ideas?

      • Jason May Reply

        Hi Adriana,

        Julie’s post was a pretty ingenuitive hack, but it wasn’t necessarily the intended Spotfire usage. You’re right, if you turn all of the categories to white, Spotfire forces the curves to white also.

        How about another hack? In lines and curves, you can select Label and Tooltip (make sure you have first selected your created Gaussian Curve) > Check the box for Label under Curve expression with values.

        Once you hit ok, you will then see the expression for each curve on the chart. You can then plug those expressions in as individual calculated columns for each population. Use the x side of the equals side in the expression, exclude the y.
        Replace X in the expression with your x axis column name (category column from the bar chart).

        You can then put each of those calculated columns on the y axis of a line chart and select (Column Names) in Line by. Choose your X axis column (category column from before) and make sure it is not binned by right clicking on the label on the x-axis and right clicking and deselecting Auto Binning.

        Let me know how it goes! I’m interested to see how it works out.

        Jason May

Leave a Reply

Your email address will not be published. Required fields are marked *