Jump to content
We've recently updated our Privacy Statement, available here. ×
  • Spotfire® Scatter Plots: Binning and Color Scheme Example


    TIBCO Spotfire® Scatter Plot Examples

    One of the most powerful visualization in Spotfire® is the Scatterplot for it has a lot of different ways to configure it. The markers can be configured to a specific size, shape, color, and rotation and grouped together and aggregated. The x & y axes can also be configured to display categorical, numeric, and binned data. Here are a few example images.

    scatterplot_examples.jpg.ea1f88ef7d1969f7de23d91731ae35e2.jpg

    Density Plot Example

    Here is a video that shows how to configure the Scatterplot to be displayed as a Density Plot.

     

    density.png.957d4ec5a29f47b47dec016af447380d.png

    Binning to reduce markers in an Image

    Below is an example of displaying an image and binning the X & Y (based on a user's input). The binning reduces the number of markers displayed on the screen. The lower the number the faster the image gets rendered.

    The image is imported using TIBCO® Enterprise Runtime for R (TERR?) and the 'ImageR' package. (see attached dxp for script example)

     ezgif-3-2d078ffe97.gif.c71873a5eb8093aba11734ce7d233a79.gif

    Using IronPython, the example then applies a color scheme based on colors in the image data file. The IronPython script that sets the color scheme based on the column values in the data is.

    myTable = Document.Data.Tables["im"]
    myCol  = myTable.Columns["hexcolor"]
    newCol = myTable.Columns.AddCalculatedColumn("mytemp","uniqueconcatenate(["+myCol.Name+"])")
    myCnt  = newCol.GetValue(0).Value
    myArr  = myCnt.split(',')
    #print myArr[0]
    myTable.Columns.Remove(newCol)
    
    from Spotfire.Dxp.Application.Visuals import ScatterPlot
    from System.Drawing import Color, ColorTranslator
    viz = visual.As[ScatterPlot]()
    
    # Get Color Scheme
    colorRule = viz.ColorAxis.Coloring[0]
    
    # Loop through each value in column to apply it to the Color Scheme
    for i in range(len(myArr)):
        curVal = myArr[i].strip()
        colorRule[curVal] = ColorTranslator.FromHtml("#"+ curVal);
        print myArr[i],colorRule[myArr[i]]
     

     

    Attachments

     

    Attachment Size
    open_jpeg.dxp 1.87 MB

    rtaImage.jpeg

    rtaImage.png

    rtaImage.gif


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...