question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`violin` trace: why an area is calculated if all values are 0?

See original GitHub issue

Please see my question in stackoverflow

I have an array of values from 0-10 with and 20 groups in each. For some groups or categories all values are 0. When I use violin plot, there is an area calculated which is below 0, but I want to get thedifferent that I got from Seurat package VlnPlot. Is there a way to overcome that problem? Here is a part of java script code:

var my_violin = [];
var vln_layout = {};
var my_violin =[
{
    type:"violin",
    x:xvalues,
    y:my_categories,
    points:"all",
    pointpos:0,
    color:"black",
    width:0.75,
    marker:{color:"black",size:4},
    jitter:1,
    span:0,
    transforms:[
    {
        type:"groupby",
        groups:my_categories,
        styles:my_styles
    }
    ]
}
]

var vln_layout = {title: "my title",    xaxis:{showline: false,showgrid: false,zeroline: false,
    categoryorder: 'category ascending'}, yaxis: {showline: false,showgrid: false,zeroline:false},
    showlegend:true,legend:{traceorder:'normal',categoryorder:"ascending"}};

Plotly.newPlot('myDiv2', my_violin, vln_layout, {showSendToCloud: false});

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
alexcjohnsoncommented, Mar 11, 2019

I don’t think we can do that, whatever size we choose someone will come up with a data set that has a natural size smaller than that. It has to actually have zero size, even if that means a special case with its own drawing code.

1reaction
antoinergcommented, Mar 11, 2019

Trying to plot datasets [0,0,0,0] (left) and [0,0,0,1] (right) with violins:

Thanks @micosacak for reporting this issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

plotly.js: why an area is calculated if all values are 0?
I have an array of values from 0-10 with and 20 groups in each. For some groups or categories all values are 0....
Read more >
JavaScript Figure Reference: violin Traces - Plotly
Sets the width of the violin in data coordinates. If "0" (default value) the width is automatically selected based on the positions of...
Read more >
Violin plot — geom_violin • ggplot2
If "count", areas are scaled proportionally to the number of observations. If "width", all violins have the same maximum width. If FALSE ,...
Read more >
A Complete Guide to Violin Plots | Tutorial by Chartio
Violin plots are used to compare the distribution of data between groups. ... In a KDE, each data point contributes a small area...
Read more >
Hypothetical Outcome Plots Outperform Error Bars and Violin ...
The width of the colored area at each level shows how many vials of sea ... all such values are rounded up to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found