boxplot

How to plot weighted means on a boxplot?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 23:33:03
问题 After searching for a solution and fiddling, I am reaching out for help in my attempt to display weighted means on a boxplot (I have tried to cross-post this to the ggplot2 mailing list as well). I provide a toy example below. #data value <- c(5, 7, 8, 6, 7, 9, 10, 6, 7, 10) category <- c("one", "one", "one", "two", "two", "two", "three", "three", "three","three") weight <- c(1, 1.2, 2, 3, 2.2, 2.5, 1.8, 1.9, 2.2, 1.5) df <- data.frame(value, category, weight) #unweighted means by category

Customize colors for boxplot with highcharter

怎甘沉沦 提交于 2019-12-10 23:32:00
问题 I have boxplots on highcharter and I would like to customize both the Fill color Border color Here is my code df = data.frame(cbind(categ = rep(c('a','b','c','d')),value = rnorm(1000))) hcboxplot(var = df$categ, x = as.numeric(df$value)) %>% hc_chart(type = "column") %>% hc_colors(c("#203d7d","#a0a0ed","#203d7e","#a0a0ad")) The hc_colors works only if I put var2 instead of var but then the box plot are shrunken... 回答1: I made a couple functions to do some stuff with highcharts and boxplots.

Plot empty groups in boxplot

混江龙づ霸主 提交于 2019-12-10 22:41:31
问题 I want to plot a lot of boxplots in on particular style to compare them. But when a group is empty the group "isnt ploted". lets say I have a dataframe: a b 1 1 5 2 1 4 3 1 6 4 1 4 5 2 9 6 2 8 7 2 9 8 3 NaN 9 3 NaN 10 3 NaN 11 4 2 12 4 8 and I use boxplot to plot it: boxplot(b ~ a , df) than I get the plot without group 3 (wich I cant show because I did not have "10 reputation") I found some solutions for removing empty groups via google but my problem is the other way around. And I found the

Seaborn boxplot with 2 y-axes

大憨熊 提交于 2019-12-10 19:47:53
问题 How can I create a seaborn boxplot with 2 y-axes? I need this because of different scales. My current code will overwrite the first box in the boxplot, eg. it is populated by 2 first data item from first ax and first item from second ax. import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt matplotlib.style.use('ggplot') import seaborn as sns df = pd.DataFrame({'A': pd.Series(np.random.uniform(0,1,size=10)), 'B': pd.Series(np.random.uniform(10,20,size=10)),

R aggregate gives differently structured results using subsets from the same data

元气小坏坏 提交于 2019-12-10 19:10:33
问题 I'm making diurnal cycles of windspeed based on a dataframe (ball) of several year's hourly data. I want to plot them by season, so I subset out the dates I need and join them like this: b8 = subset(ball, as.Date(date)>="2008-09-01 00:00:00, GMT" & as.Date(date)<= "2008-11-30 23:00:00, GMT" ) b9 = subset(ball, as.Date(date)>="2009-09-01 00:00:00, GMT" & as.Date(date)<= "2009-11-30 23:00:00, GMT" ) b10 = subset(ball, as.Date(date)>="2010-09-01 00:00:00, GMT" & as.Date(date)<= "2010-11-30 23:00

pandas box plot for multiple column

好久不见. 提交于 2019-12-10 15:34:04
问题 My data frames (pandas's structure) looks like above Now I want to make boxplot for each feature on separate canvas. The separation condition is the first column. I have similar plot for histogram (code below) but I can't make working version for the boxplot. hist_params = {'normed': True, 'bins': 60, 'alpha': 0.4} # create the figure fig = plt.figure(figsize=(16, 25)) for n, feature in enumerate(features): # add sub plot on our figure ax = fig.add_subplot(features.shape[1] // 5 + 1, 6, n + 1

Sort ggplot boxplots by median with facets

心不动则不痛 提交于 2019-12-10 14:18:45
问题 I'm trying to get ggplot to order my boxplots based on median value after splittin the data into several different facets. This is part of a larger Shiny app I've written. Under default parameters, I can generate three faceted boxplots that order correctly: boxData <- structure(list(Classification = structure(c(4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,

Set y-axis scale for pandas Dataframe Boxplot(), 3 Deviations?

怎甘沉沦 提交于 2019-12-10 14:11:33
问题 I'm trying to make a single boxplot chart area per month with different boxplots grouped by (and labeled) by industry and then have the Y-axis use a scale I dictate. In a perfect world this would be dynamic and I could set the axis to be a certain number of standard deviations from the overall mean. I could live with another type of dynamically setting the y axis but I would want it to be standard on all the 'monthly' grouped boxplots created. I don't know what the best way to handle this is

multiple boxplots grouped by two conditions

ぐ巨炮叔叔 提交于 2019-12-10 13:56:52
问题 I am having real trouble in making mutliple boxplots in single plot... I have five variables three are numeric and two are Factor. I want boxplot for all three numerical variables but grouped by the two Factor variable... The plot shoud have two groups each for Low and High with three boxes for MM, ND and BB. legends should contain the abbrevations for MM, ND and BB. Group Class Sal Wal Daa MM Low 21 34 4 ND Low 23 65 3 BB High 21 34 2 MM High 25 23 4 MM High 23 23 5 MM High 13 54 6 MM High

ggplot2 add text on top of boxplots

荒凉一梦 提交于 2019-12-10 13:56:26
问题 I have a data that I'm plotting on ggplot2 as boxplots which look like > head(varf) sID variable value 1 SP_SA036,SA040 CM0001 0.492537313 2 SP_SA036,SA040 CM0001 0.479564033 3 SP_SA036,SA040 CM0001 0.559139785 4 SP_SA036,SA040 CM0001 0.526806527 5 SP_SA036,SA040 CM0001 0.009049774 6 SP_SA036,SA040 CM0001 0.451612903 The variable column contains 16 different IDs (from CM0001 to CM0016) I have a dataframe with annotation category annotation CM001 HG4450 CM002 HG3288 .. CM016 MM8998 I would