violin-plot

Violin Plot troubles in Python on log scale

眉间皱痕 提交于 2020-07-28 04:48:50
问题 My violin plots are showing weird formats when using a log scale on my plots. I've tried using matplotlib and seaborn and I get very similar results. import matplotlib.pyplot as plt import seaborn as sns data = [[1e-05, 0.00102, 0.00498, 0.09154, 0.02009, 1e-05, 0.06649, 0.42253, 0.02062, 0.10812, 0.07128, 0.03903, 0.00506, 0.13391, 0.08668, 0.04127, 0.00927, 0.00118, 0.063, 0.18392, 0.05948, 0.07774, 0.14018, 0.0133, 0.00339, 0.00271, 0.05233, 0.00054, 0.0593, 1e-05, 0.00076, 0.03409, 0

Violin plot for positive values with python

对着背影说爱祢 提交于 2020-01-24 12:29:06
问题 I find violin plots very informative and useful, I use python library 'seaborn'. However, when applied to positive values, they nearly always show negative values at the lower end. I find this really misleading, especially when working with real-life datasets. In the official documentation of seaborn https://seaborn.pydata.org/generated/seaborn.violinplot.html one can see examples with "total_bill" and "tip" which can not be negative. The violin plots show negative values, however. For

ggplot2: Violin Plot with Stat=“Identity”

扶醉桌前 提交于 2020-01-14 03:23:27
问题 I'm trying to use ggplot to create a violin plot where instead of the widths of the violins being controlled by a density function, they directly represent the count of relevant elements. I think this can be accomplished through setting geom_violin(stat="identity") , but R then complains > ggplot(allData, aes(x = tool, y = length)) + geom_violin(stat="identity") Warning: Ignoring unknown parameters: trim, scale Error in eval(substitute(list(...)), `_data`, parent.frame()) : object

Warning: converting a masked element to nan

我只是一个虾纸丫 提交于 2020-01-05 12:57:32
问题 I am a beginner, so please bear with me. I make a violin plot with "five violins" but because of some reason, the last violin is not drawn and I get the error message: /home/leo/anaconda3/lib/python3.6/site-packages/numpy/ma/core.py:4185: UserWarning: Warning: converting a masked element to nan. I don't understand why I get this message because I didn't use a mask for any array. So what does it actually mean? Also some more warnings like: Invalid value encountered in percentile I guess it is

Is it possible to annotate a seaborn violin plot with number of observations in each group?

本秂侑毒 提交于 2019-12-23 10:16:06
问题 I would like to annotate my violin plot with the number of observations in each group. So the question is essentially the same as this one, except: python instead of R, seaborn instead of ggplot, and violin plots instead of boxplots Lets take this example from Seaborn API documentation: import seaborn as sns sns.set_style("whitegrid") tips = sns.load_dataset("tips") ax = sns.violinplot(x="day", y="total_bill", data=tips) I'd like to have n=62, n=19, n=87, and n=76 on top of the violins. Is

Violin Plot with python

天涯浪子 提交于 2019-12-23 05:00:13
问题 I want to create 10 violin plots but within one diagram. I looked at many examples like this one: Violin plot matplotlib, what shows what I would like to have at the end. But I did not know how to adapt it to a real data set. They all just generate some random data which is normal distributed. I have data in form D[10,730] and if I try to adapt it from the link above with : example: axes[0].violinplot(all_data,showmeans=False,showmedians=True) my code: axes[0].violinplot(D,showmeans=False

Split violin plot with ggplot2

本小妞迷上赌 提交于 2019-12-17 02:24:33
问题 I'd like to create a split violin density plot using ggplot, like the fourth example on this page of the seaborn documentation. Here is some data: set.seed(20160229) my_data = data.frame( y=c(rnorm(1000), rnorm(1000, 0.5), rnorm(1000, 1), rnorm(1000, 1.5)), x=c(rep('a', 2000), rep('b', 2000)), m=c(rep('i', 1000), rep('j', 2000), rep('i', 1000)) ) I can plot dodged violins like this: library('ggplot2') ggplot(my_data, aes(x, y, fill=m)) + geom_violin() But it's hard to visually compare the

Violin plot not working as expected

筅森魡賤 提交于 2019-12-13 21:46:03
问题 I am trying to generate a violin plot for a given dataset. The data varies from 0 to 100. But the violin plot goes over 100 and goes below 0. How can I limit it between 0 to 100? Code Used: library(ggplot2) input_data <- read.csv("C:/Temp/Recall.csv") input_data precision_in_percentage <- input_data$ResultValue # Basic violin plot p <- ggplot(input_data, aes(x='TRAssociation', y=precision_in_percentage)) + geom_violin(trim=FALSE) + geom_violin(trim=FALSE, fill='#A4A4A4', color="darkred")+

ggplot violin plot, specify different colours by group?

巧了我就是萌 提交于 2019-12-11 08:54:32
问题 I have a matrix of 9 columns and I want to create a violin plot using ggplot2 . I would like to have different colours for groups of three columns, basically increasing order of "grayness". How can I do this? I have tried imputing lists of colours on the option "fill=" but it does not work. See my example below. At the moment, it indicates "gray80", but I want to be able to specify the colour for each violin plot, in order to be able to specify the colour for groups of 3. library(ggplot2) dat