How to add a Jitter to a chart (a Scatter plot in my example)

Hi,

I have a number of risks which are each ranked on a scale of 1 to 4 on 'Likelihood of occurring' and 'Impact of Occurrence'. When plotting the individual risks on a scatter plot, because of the relatively few scoring options, I have many points sitting on top of each other. I'm relatively new to Domo and wondering if anyone ever implemented a jitter factor in charts to overlapping points which would create clusters of similarly rated points?

Thanks in advance for any ideas and assistance.

Best Answer

  • GrantSmith
    GrantSmith Indiana 🟀
    Accepted Answer

    Hi @user076872

    You could utilize a beast mode with the RAND function to add your own jitter for the categorization. For Example:

    `Rank` + (RAND() * 0.5 - 0.25)
    

    You could then use that for your scale instead of just the straight 1-4 values. The downside is that you can't use the categorization of the string values in your graph.


    It'll get you something that looks like:


    The jitter distance is the 0.5 and it's then subtracting half of that value to center your jitter around the category value (essentially it makes the jitter be +/- 0.25 around your category value). The example picture above is using the day of the week number for the categorization.

Answers

  • MikeRoberts
    MikeRoberts UK βšͺ️

    Thanks for this @GrantSmith. A neat solution :-)

    Some slightly strange behavior though...

    Here's the formulas used in Beast mode...

    and here they are when put into an ETL. Suggests that in Beast Mode the the rand() function is runfor the row rather than for the row and function.

    But I've got the result I need, so all good.

    Thanks!

  • GrantSmith
    GrantSmith Indiana 🟀

    @user076872

    Beast Modes evaluate on a row by row basis so because your Y and X axis metrics appear to be the same you get the lines. Glad you figured it out!

  • MikeRoberts
    MikeRoberts UK βšͺ️

    Thanks @GrantSmith. I get that Beast mode runs per a row... but odd that the running of the rand() function would return the same result every time it's used on the same row? That's not quite the point of a rand()? Anyways, doing it another way so no biggie. All good learnings for me. Thanks!

  • jaeW_at_Onyx
    jaeW_at_Onyx Budapest / Portland, OR 🟀

    @MikeRoberts and @GrantSmith it makes sense that rand() would be consistent in Analyzer.


    you're sending a query to a database that was designed to process multiple billions of rows of data at a time. can you imagine if you asked the query to process each row and generate a new rand() value? oof.


    what you might consider doing is generating a dataset with two columns, row_id and rand() (using ETL) then JOIN it to your transactional data that has a row_id()


    by materializing your dataset, you can recreate SEED'ing by guaranteeing that you can reproduce the results regardless of how many times your ETL runs.

  • MikeRoberts
    MikeRoberts UK βšͺ️

    Thanks @jaeW_at_Onyx.

Sign In or Register to comment.