Jump to content

Overlaying Average Line on Scatter Plot


Chantz

Recommended Posts

I'm new to Spotfire, just trying it out - and working to re-create some visualizations that I currently make using Python.

Is there any way to make a scatter plot, and then overlay a calculated trend on it?   Something that looks like this.

image.thumb.png.69f1a40de8553362d3c0145c7f747c50.png

This example shows two sets of data,  but then overlaid on each dataset I have a line that is the average of the X values, binned in increments of 200 on the X values.

I've been messing with it for a while, and through the Lines and Curves interface I can easily make horizontal lines or vertical lines - but there isn't a simple y(x) function that recreates the average trend lines.

Link to comment
Share on other sites

Thanks for the example. 

hoping to have understood the need, I created a basic line from a curve Draw with the below formula :

image.thumb.png.a3c81c4c9c61e54a72e315c9e43e41d6.png 

Add any formula y(x) = a*x+b (where a and b are any numerical values), that will draw your line if you have the equation. You also have some advanced functions you can apply to x

image.thumb.png.1c4d098e6997163e17e848aac9c71698.png

 

Here is a sample output...

Edited by Olivier Keugue Tadaa
Link to comment
Share on other sites

Yes, what you've got there is about what I was able to accomplish (minus the two colors).   I figured out how to make a function to output a value of y for every x,  unfortunately I'm not trying to show the general trend of the data like with linear regression or something to find a line that best fits the point cloud.    I'm trying to show the actual average weight trend, so the plotted line would basically follow the center of the point cloud from 0 to 20000 ft.

It's a vague fit,  but is doesn't track the center of the trend.     The data doesn't follow a simple formula, so what I am doing in my Python example is binning the data into 200 ft bins, and averaging the weight for each of those bins and plotting the value at the center of the bin.

I can generate the plot I want, sort of,  in two separate scatter plots.   In the screen shot I've done it two different ways,  one using binning in the plot itself to make the trend I want (left) one using python to create a table that has the exact points I want (middle)  and then the actual scatter plot of the data over on the right side.   (This data is only looking at the orange highlighted group)

What I would like to be able to do is overlay one of the binned plots (left or middle)  on the scatter plot,  but have the points connected by a line - not plotted as scatter points - similar to the plot I showed in my first post.     I've poked around everywhere, and am inclined to believe it's just not natively supported in the spotfire scatter visualization... but I'd love to be shown otherwise. =)

image.thumb.png.b0de09e14a624fd54bd09785f8746879.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...