Jump to content
We've recently updated our Privacy Statement, available here. ×

Is there an easy way in Spotfire 12.0.0 LTS to get a different axis scale in a scatter or line plot? There's just the default "linear" and the option "logarithmic". I would like to get "normal probability scale" as in the python library mpl-probscale.


Funny Cat
Go to solution Solved by Funny Cat,

Recommended Posts

  • Solution

Thanks for the answer.

My current workaround is to plot the z-score instead and add horizontal lines for the % values I want to show.

However, the solution is not very nice, since the position of the annotation is changing depending on display resolution/chart size, so it's not obvious which line has which value (however I added the values in the tooltip, so at least you can hover over the lines to see the percentages)

2023-08-3014_18_38-TransparentBrowser.png.991a75165e936cfe7a14d9c7d92a954c.png 

For those who are interested how to do this automatically:

  • make a list of percentages you want to display e.g. in excel, and name the column percentage
  • calculate the z-score (in Excel using the function NORM.S.INV, or use the NormInv function of Spotfire) and name the column zscore
  • In the column properties, set the formatting of the column percentage to 0.### %
  • Add the following script, create the parameter vis and set it to your probability plot. Then run it:
from Spotfire.Dxp.Application.Visuals import *from System.Drawing import *from Spotfire.Dxp.Data import * #Add the parameter vis - and set the value to your probability plotvc = vis.As[VisualContent]() # remove old percentage lines (in case you have to adjust the lines more than once)for fm in vc.FittingModels: if '%' in fm.Line.DisplayName: vc.FittingModels.Remove(fm) #define data table and se the cursors to the table columnseTable=Document.Data.Tables["zscore-percentage"]cur_p = DataValueCursor.CreateFormatted(eTable.Columns["percentage"])cur_z = DataValueCursor.CreateFormatted(eTable.Columns["zscore"]) #run through table to get the values and draw the linesfor row in eTable.GetRows(cur_p, cur_z): p = cur_p.CurrentValue.replace(",",".") z = cur_z.CurrentValue.replace(",",".") #print p,z  #draw lines horizontalLine=vc.FittingModels.AddHorizontalLine(z) myLine=horizontalLine.Line myLine.LineStyle=LineStyle.Dot myLine.Width=1 myLine.IsBackground=True myLine.CustomDisplayName=p labels_tooltips=horizontalLine.Line.Details #print lt.Name,lt.DisplayName,lt.ShowInLabel,lt.ShowInTooltip for lt in labels_tooltips: if lt.Name=='Name': lt.ShowInLabel=False if lt.Name=='y': lt.ShowInTooltip=False if p in ['0.1 %', '1 %', '10 %', '50 %', '90 %', '99 %', '99.9 %']: myLine.Color=Color.Gray for lt in labels_tooltips: if lt.Name=='Name': lt.ShowInLabel=True else: myLine.Color=Color.LightGray
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...