bar-chart

Stacked bar plot in R with ratio line overplot

假如想象 提交于 2020-02-08 02:54:48
问题 I have data with one observation per row: rm(list = ls(all = TRUE)) mydf <- data.frame(kind = sample(c("good", "bad"), 100, replace = TRUE), var1 = sample(c("yes", "no", "yes"), 100, replace = TRUE), var2 = sample(c("yes", "no"), 100, replace = TRUE), var3 = sample(c( "yes", "no"), 100, replace = TRUE), var4 = sample(c( "yes", "no", "yes", "no", "NA"), 100, replace = TRUE), var5 = sample(c( "yes", "no", "yes", "no", "NA"), 100, replace = TRUE), var6 = sample(c( "yes", "no", "yes", "no", "NA")

Stacked barchart

别说谁变了你拦得住时间么 提交于 2020-02-07 03:40:42
问题 I'm having a really hard time trying to figure out how to make a stacked bar chart in R. First of all, the data I'm working with is from the VCD package data("Arthritis", package = "vcd") Now, I only want to graph the columns Improved and Treatment , displaying two bars which are the two results of the Treatment column (Treated, Placebo) and have the results of the Improved column stacked on top of each other. I tried some commands but it kept giving me an error saying: 'height' must be a

Growing/Animated bar plot with ceiling value as y-value

无人久伴 提交于 2020-01-30 11:53:06
问题 I am looking to develop an animated/growing bar plot.The plot basically contains of 6 rectangular bars and each bar has a particular value. The problem I'm facing is that the plot is growing up to the maximum value on Y-axis instead it should stop at the bar's corresponding value. The code I have tried makes the bars animate up to the maximum value on Y-Axis.I have found some information from Growing matplotlib bar charts import numpy as np import matplotlib.pyplot as plt from matplotlib

Matlab: Graphing Multiple Vertical Bar Plots

让人想犯罪 __ 提交于 2020-01-30 11:05:29
问题 In my plot, I'm trying to display the average delay time from 6 airports for each of the 5 dates. Here is the code I have so far: F = dataset('xlsfile','Lab2_Delta'); DATES = {'11/26/2013','11/27/2013','11/28/20113','11/29/2013','11/30/2013'}; ORIGINS = {'CVG','ORD','ATL','LAX','MIA','DFW'}; for Index = 1:6 for Index2 = 1:5 Origin_Index = find(strcmp(F.Origin,ORIGINS(Index))); Date_Index = find(strcmp(F.Date,DATES(Index2))); Temps(Index2,Index) = mean(F.Delay(Date_Index)); end end bar(1:5

Matlab: Graphing Multiple Vertical Bar Plots

守給你的承諾、 提交于 2020-01-30 11:04:13
问题 In my plot, I'm trying to display the average delay time from 6 airports for each of the 5 dates. Here is the code I have so far: F = dataset('xlsfile','Lab2_Delta'); DATES = {'11/26/2013','11/27/2013','11/28/20113','11/29/2013','11/30/2013'}; ORIGINS = {'CVG','ORD','ATL','LAX','MIA','DFW'}; for Index = 1:6 for Index2 = 1:5 Origin_Index = find(strcmp(F.Origin,ORIGINS(Index))); Date_Index = find(strcmp(F.Date,DATES(Index2))); Temps(Index2,Index) = mean(F.Delay(Date_Index)); end end bar(1:5

Add ticks without labels on the top of a bar plot in ggplot2

送分小仙女□ 提交于 2020-01-29 09:44:09
问题 As the title says, I would like to add ticks to the TOP part of the bar plot in ggplot2. The output would look something like this: (hiding the actual plot due to confidential information). Is there a function in ggplot2 that does this? 回答1: I have adapted Baptiste's solution at link Display y-axis for each subplot when faceting. Idea (i think) is to extract the x-axis grob and add it to the top of the plot. library(ggplot2) library(gtable) # plot p1 <- ggplot(mtcars, aes(factor(cyl))) + geom

Grouping bar3 plots like bar

霸气de小男生 提交于 2020-01-25 07:06:30
问题 I'm wondering if it is possible to get the same grouping behavior of bar plots into bar3 . For example, if you plot bar(rand(3)); you get 3 bars for each point; bar groups the different y values for each x . Now I would like to do the same with a 3D data. That is that I have several slices of 2D data that I want to visualize as groups of bars. Then, if my data is data = rand(3,3,2); I would like to see data(1,1,:) as a group of bars, and data(1,2,:) as another group and so on. Is it possible?

Grouping bar3 plots like bar

白昼怎懂夜的黑 提交于 2020-01-25 07:05:34
问题 I'm wondering if it is possible to get the same grouping behavior of bar plots into bar3 . For example, if you plot bar(rand(3)); you get 3 bars for each point; bar groups the different y values for each x . Now I would like to do the same with a 3D data. That is that I have several slices of 2D data that I want to visualize as groups of bars. Then, if my data is data = rand(3,3,2); I would like to see data(1,1,:) as a group of bars, and data(1,2,:) as another group and so on. Is it possible?

How to create Double bar diagram using fpdf php?

非 Y 不嫁゛ 提交于 2020-01-24 12:28:26
问题 I'm using FPDF in my php project. I would like to have PDF version Double bar diagram like above image in my project. There's a way that FPDF can create Pie chart and Bar diagram in http://www.fpdf.org/en/script/script28.php. But it's not double bar diagram like what I want to get. Anyone have an idea how to create Double bar diagram using FPDF in PHP? Many Thanks !!! 回答1: Probably you mean "COLUMN CHARTS" It seems that there is no method to create column charts, so I tried to adapt the

Add group mean line to barplot with ggplot2

醉酒当歌 提交于 2020-01-24 05:42:26
问题 I generate a barplot with geom_col() with two classes separated by color. Then I try to add a mean line for each class. Here is what I'd like to get: But with the code below the mean line is for each bar independently what I put to group argument. Here is a reproducible example: library(tidyverse) df = data.frame( x = 1:10, y = runif(10), class = sample(c("a","b"),10, replace=T) %>% factor() ) %>% mutate(x = factor(x, levels=x[order(class, -y)])) ggplot(df, aes(x, y, fill=class)) + geom_col()