Jump to content

How to create a Trellis plot by Category, while showing one of the categories as a reference in every panel


Matthew Crossan

Recommended Posts

Hello Everyone,

Using some sample data as an example (See Figure Attached):

 

I have X and Y data for 5 different Products (A,B,C,D,E).

I would like to create an XY scatterplot for products (A,B,C,D)using the trellis feature. (Blue, Green, Red, Black respectively)

I would like the XY scatter data for product E (orange) to be displayed on each trellis plot so that it can be used for comparison

 

I could create 4 different plots and limit each plot to only show Plot 1 =(A & E), Plot 2 =(B & E). However I have much more than 5 products and would like to be able to do this all within a single visualization.

Is there any way to do this using the trellis feature

Many Thanks,

Matt

Link to comment
Share on other sites

I cannot think of a way of doing it with trellis. Perhaps this is a candidate for Spotfire Mods development.

Alternatively, since you have more than 5 categories, I presume you might not be able to see them all in one page even with a trellis. So you could think of using filter instead, and show a single plot with a selection of filtered Products together. You could put the filter on a text area to make it easier to spot /use.

Link to comment
Share on other sites

That is probably not possible in an easy way, without massaging the data so that there are e.g. duplicates and using filterings to include the reference points in some way... perhaps it would be possibly using multiple tables showing them in one visualization with one table having the reference values and the other table the other values.

I played around with using a Map Chart instead:

1. Use the following made-up input data (calling it Data Table):

Product;X;Y

A;2;4

A;8;3

A;4;6

B;9;2

B;1;3

B;2;8

B;3;4

C;8;7

C;7;8

C;2;3

D;5;6

D;5;8

D;7;1

D;8;3

E;3;4

E;5;6

E;6;6

E;1;4

E;8;32. Create a Map Chart, and remove all existing layers in it.

3. Add two marker layers, using the same Data table. Call one of the layers T1 and one T2.

4. Configure the T1 layer to use limiting [Product] != 'E' so that it only displays the other projects, not the reference points. Set Color by = Project.

5. Configure the T2 layer to use limiting [Product] = 'E' so that it only displays the reference points. Set Color to fixed Orange, and e.g. shape by to something other than the T1 layer, just to make things easier to see.

6. Open the map chart's general properties dialog, and go to the Trellis page (at the bottom). Select the T1 layer, and trellis by Panels, split by Product.

7. Set the Interactive layer to be T1.

Now, T2 contains the reference project points, and T1 contains the other projects.

See the screenshot.

Maybe not a fully viable solution, since the map chart's feature set is different from the scatter plot's, but perhaps it can give some inspiration at least...

Link to comment
Share on other sites

Massaging the data using a TERR Data Function could perhaps work:

1. Startwith the following made-up data set:

Product;X;Y

A;2;4

A;8;3

A;4;6

B;9;2

B;1;3

B;2;8

B;3;4

C;8;7

C;7;8

C;2;3

D;5;6

D;5;8

D;7;1

D;8;3

E;3;4

E;5;6

E;6;6

E;1;4

E;8;32. Now, we want to produce a copy of this data table, where the data for products A, B, C, and D

is included in the original form, but the data for product E should be repeated once for every value of A, B, C, and D. We also want an additional column, which is the resulting Trellis category value. I am not that good with R, so this is probably not very efficient for huge data sets and probably lacks in areas such as error handling, but it is a start:

# input should be a Table with a column called 'Product'.

 

# Let's separate the data into rows that are reference data compared to normal data.

productData

Link to comment
Share on other sites

Thank you for this comment as well. I was thinking of possible something like this but the map chart solution I think works better for my case since in reality I have 24 products and 21 million rows so it wouldn't be practical this way, but I may be able to use this solution for a different data set. Thanks!
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...