Jump to content

Barplot show label from lternate column


Renger

Recommended Posts

Posted (edited)

I need to be able to show a plot like shown here based on the table (numbers are not exact, don't worry about that). Externally, a Tukey HSD is done resulting in the shown table. If you're not familiar with the test, overlap of a character in the column 'Group' means that statistics does not show a difference between the groups. So, sample s1 results can not be distinguished from other samples except for samples s2 and s5.

Now the question: does anyone know how to create a plot like this where I can place the value in column 'Group' on top of a bar? I could so far not find a solution.

The current solution I'm using is by adding this information on the x-axis adding NEST [DataTable].[Group] to the custom expression

exampleplot.png

Edited by Renger
forgot 'not' in 'If you're familiar with...'
Link to comment
Share on other sites

Posted (edited)

Dear Renger

 

On a standard bar chart, the  labels are usually the values calculated on the  Y-Axis (usually numerical and not categorical)

As you pointed out, you can display the groups on the X-Axis as per the below image 

image.thumb.png.b5d2d860bd79a59e554f54d894e5db06.png

or maybe a scatter plot like this one ?

image.thumb.png.09f4badccc3ad85733c0e596c8cdd678.png

 

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

Thanks for posting these solutions. However, the user is likely to look at the top of the bars to find out whether the groups are overlapping or not. Having to look at the x-axis does not help for user experience I'm afraid. The other solution with a scatter plot makes it already a bit easier but it does not comply with the kind of plots that people are accustomed to. 

I've tried for a couple of hours now to find options using Iron Python but as you also indicate I think, the labels are using the same expression as the expression for the y-axis. I can change the expression for the y-axes using bar_chart.YAxis.Expression = [new expression] where bar_chart is an object of type 'Spotfire.BarChart'. However, there is not something yet to place an alternative value on top of the bars. I would think that the location of such a label should be determined by the value of the bar (so, y axes value) but the value (number or string) to be rendered would then be a different column. In my case, the bars represent just one row each and there would be a 1-1 match. In other cases, one would need to aggregated the label but I could handle that by stating concat(group). Because there is just one group, it would result in the concatenation of my single string.

As far as I can figure out now (after digging into Iron Python a bit on this), there is currently no solution to my problem in Spotfire :-(

Still hoping for someone to tell me that I'm wrong :-)

Link to comment
Share on other sites

Posted (edited)

That is a great Idea Renger. Please vote for it here

A work around is to use a line connection by [sample] on your scatter plot. I've added a row for each row with a value of -1 and set the axis scale from 0 to automatic to hide the connecting markers  . For the labels I used the [group] column

image.thumb.png.d0f0de1a7c16085cb6dd391ec28d257a.png

If you don't want to change the axis scale range from 0 to auto and you want to avoid seeing double labels for the connecting markers, you can use something like  "If([Value]>0,[Group])" expression to only shows top labels.

If any of these out of the box solutions do not fit for purpose, you can always explore  creating or modifying custom visualization (Visualization Mods). Are you aware of this? Remember that Spotfire is a platform and it has different ways to extend it (check the Visualization mods section here). For simple charts, you can also render visuals on text areas

Edited by Jose Leviaguirre
  • Like 1
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...