bar-chart

Using plotmath in ggplot2 with percent sign (%)

烂漫一生 提交于 2020-01-10 01:47:35
问题 I would like to use Greek characters, Latin characters and the percent sign in the facet labels of a ggplot2 bar chart. Greek characters can be done with 'facet_grid(.~variable, labeller=label_parsed)': a<-c("Delta~V","VarcoV","Delta~V","VarcoV") b<-c(1,2,3,4) d<-c("one","one","two","two") mydata<-data.frame(cbind(b,a,d)) ggplot(mydata,aes(x=d,y=b))+facet_grid(.~a, labeller=label_parsed)+geom_bar(stat="identity") Now I also want to add a facet label that includes % and a Latin character: a<-c

Using plotmath in ggplot2 with percent sign (%)

北慕城南 提交于 2020-01-10 01:47:35
问题 I would like to use Greek characters, Latin characters and the percent sign in the facet labels of a ggplot2 bar chart. Greek characters can be done with 'facet_grid(.~variable, labeller=label_parsed)': a<-c("Delta~V","VarcoV","Delta~V","VarcoV") b<-c(1,2,3,4) d<-c("one","one","two","two") mydata<-data.frame(cbind(b,a,d)) ggplot(mydata,aes(x=d,y=b))+facet_grid(.~a, labeller=label_parsed)+geom_bar(stat="identity") Now I also want to add a facet label that includes % and a Latin character: a<-c

find the number of every letters in a word [closed]

穿精又带淫゛_ 提交于 2020-01-07 09:58:05
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . User will enter a String, For instance if the user enters YYYCZZZZGG: Program will evaluate the frequency of characters in the string. For YYYCZZZZGG string, C is seen only for 1, G is repeated 2, Y has a

find the number of every letters in a word [closed]

不羁岁月 提交于 2020-01-07 09:57:09
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . User will enter a String, For instance if the user enters YYYCZZZZGG: Program will evaluate the frequency of characters in the string. For YYYCZZZZGG string, C is seen only for 1, G is repeated 2, Y has a

Stacked bar plot, label bars with percentage values [duplicate]

China☆狼群 提交于 2020-01-07 05:35:10
问题 This question already has answers here : R stacked percentage bar plot with percentage of binary factor and labels (with ggplot) (1 answer) geom_text position middle on a bar plot (1 answer) Closed 2 years ago . I want to plot a table as a stacked bar plot and label the bars with the percentages. Here is an example: data <- matrix(c(34, 66, 22, 78), ncol = 2) data <- as.table(data) colnames(data) <- c("shop1", "shop2") rownames(data) <- c("prod1", "prod2") library(reshape2) data_m <- melt

Assign colours to values and plot horizontal bars in R

别等时光非礼了梦想. 提交于 2020-01-06 08:14:24
问题 with a data frame of 3 columns, i would like to assign the colour "red" to values below 19.293 and "blue" to values above 19.293. dataframe123 <- data.frame(hmin1, hmin2, hmin3) The following are the values in the data frame hmin1: c(3.93999999999999, 6.13333333333333, 8.12727272727273, 9.94782608695652, 11.6166666666667, 13.152, 14.5692307692308, 15.8814814814815, 17.1, 18.2344827586207, 19.2933333333333, 20.2838709677419, 21.2125, 22.0848484848485, 22.9058823529412, 23.68, 24.4111111111111,

How to draw 100% stacked bars with mixed +ve and -ve values in matplotlib?

喜你入骨 提交于 2020-01-06 03:54:04
问题 I have some data with mixed positive and negative values that the sum of the absolute values of each variable = 100% Here are some sample data: Out01 = [79.069,-1.602,5.067,-4.241,-5.433,-4.590] Out02 = [50.348,13.944,-15.373,6.554,5.541,8.240] Out03 = [-8.053,0.819,-9.741,2.814,22.475,56.098] Out04 = [-17.350,33.710,-18.510,-0.842,3.050,26.537] Out05 = [-20.169,37.583,-20.785,-2.041,1.728,17.695] I drew them as desired in Microsoft Excel as follows by the "100% stacked columns" chart: Now I

how to reduce bar gap of stacked bar plot in ggplot2

做~自己de王妃 提交于 2020-01-05 17:57:13
问题 I would like to reduce bar gap and keep bar width of stacked bar plot. Stacked bar plot: p <- ggplot(dat, aes(x = plant, y = percentage*100, fill = group)) + geom_bar(stat = "identity", width =0.20) and then I want to change bar gaps by position=position_dodge(0.9) : p <- ggplot(dat, aes(x = plant, y = percentage*100, fill = group)) + geom_bar(stat = "identity", position=position_dodge(0.9),width =0.20) This solution can change bar gaps, but bars were unstacked. So how to change bar gap and

Matplotlib.pyplot: How to set up a second y-axis for an existing plot

廉价感情. 提交于 2020-01-05 11:05:19
问题 I have two sets of values that are linearly dependent. Therefore I just need a single graph with a second y-axis in the right scale. What is the most elegant way to do this? Making just two bar-plots gives me an overlap: import numpy as np import matplotlib.pyplot as plt x = np.arange(4) y2 = np.array([23, 32, 24, 28]) y1 = 4.2 * y2 fig = plt.figure(1, figsize=(6,6)) ax = fig.add_subplot(111) ax.bar(x, y2) ax.set_ylabel('Consumption in $m^3$') ax2 = ax.twinx() ax2.bar(x, y1, alpha=0.5) ax2

bar with asymmetric error bounds in Matlab

我的梦境 提交于 2020-01-05 09:26:33
问题 I want to draw a bar with error bounds like this http://www.mathworks.ch/matlabcentral/fileexchange/9377-barerror. There are many scripts to do this around that combine bar() and errorbar(). But all I found can only deal with symmetric errors. Can anyone show me how to add asymmetric error bounds like errorbar(X,Y,L,U) but on bar, not on curve? Thanks. 回答1: You can plot errorbars over your bar chart: data = 1:10; eH = rand(10,1); eL = rand(10,1); figure; hold all; bar(1:10, data) errorbar(1