bar-chart

Add vertical separator and labels to R barplot

谁说胖子不能爱 提交于 2019-12-13 16:24:17
问题 I have the following data frame from which I make a bar plot. Then, I am trying to add Group separators with vertical lines and to place labels in between these lines by creating a new x-axis: Group = c("1_1", "1_2", "1_3", "2_1", "2_2", "3_1", "3_2", "3_3", "3_4") Value = as.numeric(c("-1.23", "2.34", "0.56", "1.87", "-2.40", "5.54", "-0.98", "-2.31", "6")) data = data.frame(Group, Value) data Group Value 1_1 -1.23 1_2 2.34 1_3 0.56 2_1 1.87 2_2 -2.40 3_1 5.54 3_2 -0.98 3_3 -2.31 3_4 6.0

Bar plot with negative and positive values centered on a non-zero value

半腔热情 提交于 2019-12-13 15:41:03
问题 I am trying to create a bar graph of odds ratios. Interpretationally, they are centered around 1, not 0. Therefore, I would like to have a bar graph where values below 1 are "negative" and values above 1 are "positive" (i.e., a graph of distance from 1). Effectively, the graph should look like the following plot except that the labels on the y axis should be centered around 1, not 0. I would like to create this graph not be relabeling of the y axis, but by actually centering it around 1. Is

Pandas, Bar Chart Settings Customization

一个人想着一个人 提交于 2019-12-13 15:27:14
问题 I've read through the following pages, http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.plot.html http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.barh http://matplotlib.org/users/customizing.html http://matplotlib.org/users/configuration.html But I'm still having difficulties customizing the detailed settings of my graph. For a simple code as, #%matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt plt.style.use('ggplot') df

Stacked Bar Chart with percentage composition inside the Bar and total above the Bar in JFreeChart

笑着哭i 提交于 2019-12-13 15:26:46
问题 I am trying to create a Stacked Bar Chart. My requirement is I need percentage composition inside the bar and total count on top of the Bar. Please suggest solutions. My Requirement: Sample : http://www.jfree.org/jfreechart/api/javadoc/images/StackedBarRenderer3DSample.png I want percentage composition inside the bar and total composition on the top of the bar. 回答1: It's not clear what you are doing now, but using a StackedBarRenderer with setRenderAsPercentages(true) will display the

How to make grouped stacked bar chart in d3js?

不羁岁月 提交于 2019-12-13 14:28:28
问题 I've the following d3 chart which is both grouped and each grouped contains a stacked bar. But somehow, I feel this is not a proper way to implement and little complicated. If there was only stacked bar chart, I would have used d3.stack() . Can someone let me know is there any better way to do this? Snippet as follows: var data = [ { Category: "cat1", type1: 300, type2: 450, type3: 120 }, { Category: "cat2", type1: 400, type2: 100, type3: 200 }, { Category: "cat3", type1: 400, type2: 100,

How can i change the values to BarChart dynamically in Core-Plot iphone?

社会主义新天地 提交于 2019-12-13 12:42:02
问题 I am using Core-Plot library to draw bar chart in iPhone. I am using CPTTestApp-iPhone to my training. In my project the bar appear very good thats looks like from the sample project. But, i dont where i need to give the values to draw the bars. Then, in my actual project i need to change the bar values dynamically. How can i do this? Please help me to find out the solution. Thanks in advance. Below the sample datasource code, #pragma mark - #pragma mark Plot Data Source Methods -(NSUInteger

Bar charts connected by lines / How to connect two graphs arranged with grid.arrange in R / ggplot2

烂漫一生 提交于 2019-12-13 11:49:53
问题 At Facebook research, I found these beautiful bar charts which are connected by lines to indicate rank changes: https://research.fb.com/do-jobs-run-in-families/ I would like to create them using ggplot2. The bar-chart-part was easy: library(ggplot2) library(ggpubr) state1 <- data.frame(state=c(rep("ALABAMA",3), rep("CALIFORNIA",3)), value=c(61,94,27,10,30,77), type=rep(c("state","local","fed"),2), cumSum=c(rep(182,3), rep(117,3))) state2 <- data.frame(state=c(rep("ALABAMA",3), rep("CALIFORNIA

Adding standard deviation to barplot() in R

对着背影说爱祢 提交于 2019-12-13 10:44:16
问题 In R I have the following dataframe: Group mean sd 1 1 21.2 5.202563 2 2 28.4 6.113737 3 3 21.8 2.529822 I would like to create a barplot with the means and the standard deviations as arrows on top of the means like this example: This is the code I have so far: barCenters <- barplot(height = Ymeans12stdev$mean,main = "Average Time per Group", xlab = "Group", ylab = "Time") However, I am not succeeding in adding the standard deviation bars. Can anyone solve this ? :) 回答1: with base R, you can

MSChart axis misplaced for huge charts

别等时光非礼了梦想. 提交于 2019-12-13 10:25:20
问题 i'm currently running into issues with MSChart, esp. a BarChart. The chart is meant to be exported and saved into an image file and has a huge amount of seperate bars to be shown, resulting in a height of 38960px. The problem: It seems like the height of the axis' label is calculated percentual with a minimum of 1 (and again with a minimum of 10px afterwards). This way the label is about 390px away from the chart ... To illustrate the issue, i set AxisX.Crossing = 0, so the axis should be

Find total year spans in an array with gaps

僤鯓⒐⒋嵵緔 提交于 2019-12-13 09:09:13
问题 I need to draw a stacked bar graph for this array which should have 2 bars separated with a white-space of 2 years span (from year 1998 to 2000 ) The Problem: the first bar should be like, *1998-1997* - *2 years gap* - *2000-2008* The bars should merge shorter year-spans within like it did in taking 2000 from array0 and 2008 from array 1 Array ( [comp_name] => C++ [parent_cat_name] => Information Technology [sub_cat_name] => Programming [total_years] => 6 [last_year] => 2006 [start_year] =>