Spotfire Features — Line Connections in Scatter Plots

  • Have you ever wanted to create a visualization that’s a mix of a line and a scatter plot as shown here?

A user contacted me a few weeks ago and asked if Spotfire could create a plot like this.  The answer is that yes, Spotfire can create this chart.  This particular visualization is not a combo chart or a line chart.  It’s a scatter plot that uses line connections for one of the variables (oil in this case).  I did run into a bit of difficulty in figuring out which column of data should be used to create the line connection, and it was tricky enough that I thought it deserved a blog post.

Here is the original data table.

Now, I knew I could use the scatter plot line connection in order to connect the scatter plot dots, and the way this feature works by having the user specify a column of data to “Draw a separate line per value in” (as shown below).

This is akin to saying “draw a line for each <x>”.  In this case, I needed a column of data where the values would be blank for the test values so that no line would appear.  Because of this requirement, I also realized that I needed to unpivot.

 

So I did just that.  I unpivoted the data so that I had a column called Produced or Test and a column called Volume.

From that point, I created a calculated column called c.Line using the following IF statement: If([Produced or Test]=”Oil”,[Time]).

With this new arrangement of data, I just setup the line connection as shown below.

And voila!

 

Spotfire can’t yet create those rounded edges, but it’s a good end result.

Guest Spotfire blogger residing in Whitefish, MT.  Working for SM Energy’s Advanced Analytics and Emerging Technology team!

9 thoughts on “Spotfire Features — Line Connections in Scatter Plots

  1. Alex Lach Reply

    Hey Julie. Have you ever tried doing this with data being plotted from related data tables?

    An example might be where monthly volumes and daily tests are in separate tables and we don’t want to combine them with transformations.

    • Julie Schellberg of Big Mountain Analytics, LLC Post authorReply

      I haven’t tried this. If that were going to work, you would also need column matches. Relations facilitate integrated filtering and marking. Column matches are what allow you to put data from different tables on the same visualization.

  2. Katya Reply

    Hi,
    I really like this solution. And it fits my needs in the report I’m working on, with the only difference, that I have more than two values in the Type column. Say I have oil, gas and coal.
    Once I add this third value, the line starts goofing up, connecting markers from two values, not one.
    If my formula for the line is: if([type] ==’oil’, [time]), it will connect gas and coal. Then I tries to do the opposite: if([type!=’oil’, [time]). This time something really weird happens: oil gets a line. But then for the each time value gas and coal will get a connecting line in between.
    How to make this example work with more than two values?

    • Julie Schellberg of Big Mountain Analytics, LLC Post authorReply

      Are you trying to create a visualization with one line and then two additional sets of data without the line?

      • Michael Reply

        I actually having the same exact problem. I have about 5-10 columns that I’m trying to trellis by due to their different scale sizes. However, it’d be great to be able to leave certain parameters as scatter and others as line-connected!

  3. Mario Reply

    Hi Katya,

    Did you solve this issue? I have the same problem (ten different ‘types’ in my column). I want to connect some types, and others don`t.

    Thanks!

  4. Pingback: How to Configure Scatter Plot Line Connections - Data Shop Talk

  5. Chris Reply

    Julie, do you have to have values 1 to 9 for the column c.Line? It would be easier if you just let c.Line=1 if [PorT]=”Oil” and c.Line= if [PorT]=”Test”. And, for that matter, does it have to be missing? Could you set it to 0 or 2, say? And then, as the other posters want, you could set different line connection and markers according to the values of this column. I am trying to overlay two series of the same color and symbol with no line, a third with different colored markers, line connected and a fourth, line connected, no markers. Spofitre makes this too difficult.

    • Julie Sebby Post authorReply

      The values don’t have to be 1 to 9. I believe I did that in case I needed to add a variable to “Order by” (what order to draw the line thru the points). It does, however, need to be null for this use case. The user I was working with only wanted one line. If there was a value in each record, it wouldn’t work correctly. Your use case is slightly different. I think Spotfire can still create the desired end result for your use case, but I’d have to tinker with it. That won’t happen in the next week with the holidays though. It does seem unnecessarily difficult.

Leave a Reply

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