bar-chart

Bokeh Bar plot |

别说谁变了你拦得住时间么 提交于 2021-01-28 20:13:18
问题 I am trying to Create a bokeh bar chart using Python. The data2 is the values from bokeh.plotting import figure, output_file, show,hplot from bokeh.charts import Bar data2=[65.75, 48.400000000000006, 58.183333333333337, 14.516666666666666] bar = Bar(values=data2,xlabel="beef,pork,fowl,fish",ylabel="Avg consumtion", width=400) show(bar) Error TypeError: Bar() takes at least 1 argument (1 given) What am I doing wrong Here? 回答1: The bokeh.charts API (including Bar ) was deprecated and removed

Fail to add linear regression line in barplot

雨燕双飞 提交于 2021-01-28 18:30:38
问题 I have some data about the percentages of temperature for different time periods and I want to create a barplot showing those percentages and then add a linear regression line showing the trend. Although i manage to get the first graph, I fail to add a straight linear regression line Basically I try to make a barplot with these tx_1 data tx_1<-c(0.055,0.051,0.057,0.049,0.061,0.045) mypath<-file.path("C:\\tx5\\1.jpeg") jpeg(file = mypath,width = 1200, height = 600) plot.dim<-barplot(get(name),

Bar graph and geom_line in ggplot

ぐ巨炮叔叔 提交于 2021-01-28 12:24:38
问题 I am trying to draw a geom_line on a bar chart, my bars are filled by year. My code is: library(ggplot2) library(plyr) library(reshape) DF <- data.frame(DECL.INDICATORS=c("Finland", "Finland", "Germany" ,"Germany","Italy","Italy"), Year=c(2009,2010,2009,2010,2009,2010), EXPVAL=c(2136410,1462620,371845300,402397520,357341970,357341970), IMPVAL=c(-33668520,-37837140,-283300110,-306157870,-103628920,-105191850)) net <- ddply(DF, .(Year,DECL.INDICATORS), summarise, net = sum(EXPVAL + IMPVAL)) DF

Why is the value of y bar larger than the actual range of y in stacked bar plot?

这一生的挚爱 提交于 2021-01-28 11:14:24
问题 I am trying to plot the stacked bar plot for the data frame, with x equals to the year release, and y equals to count. But why the range of y in the plot is almost 1000? The largest count value should be 33. enter image description here 来源: https://stackoverflow.com/questions/64363878/why-is-the-value-of-y-bar-larger-than-the-actual-range-of-y-in-stacked-bar-plot

Combine Stacked and Grouped chart ggplot2

只愿长相守 提交于 2021-01-28 11:06:24
问题 I have this table: Number Type Correction Adjust Origin 1061 60-15 Corrected yes Small RNA-seq 204 60-15 Corrected no Small RNA-seq 0 60-15 Native yes Small RNA-seq 540 60-15 Native no Small RNA-seq 0 60-30 Corrected yes Small RNA-seq 315 60-30 Corrected no Small RNA-seq 0 60-30 Native yes Small RNA-seq 58 60-30 Native no Small RNA-seq 0 70-15 Corrected yes Small RNA-seq 200 70-15 Corrected no Small RNA-seq 0 70-15 Native yes Small RNA-seq 61 70-15 Native no Small RNA-seq 0 70-30 Corrected

Change font color on stacked bar chart

断了今生、忘了曾经 提交于 2021-01-28 07:42:49
问题 How do I change the font colors on the labels? For example, I'd like the labels for A to be white and the labels for B and C to be black. Also, I'd like to make the labels bold. Vintage <- c(201801,201801,201801,201802,201802,201802,201803,201803,201803) Grade <- c("A","B","C","A","B","C","A","B","C") OrigAmt <- c(3.5,0.884,0.606,6.31,2.31,1.12,6.80,1.90,1.05) freq <- c(70.2,17.7,12.1,64.7,23.7,11.5,69.8,19.5,10.8) dat <-as.tibble(as.data.frame(cbind(Vintage,Grade,OrigAmt,freq))) dat$OrigAmt

ggplot barplot mean values on graph

若如初见. 提交于 2021-01-28 06:11:12
问题 I want to create a barplot with 2 factors and 1 continuous variable for y. Μy code is (it is based on the build-in dataset: mtcars): data(mtcars) x=mtcars library(ggplot2) ggplot(x,aes(x=factor(carb), y=mpg, fill=factor(carb))) +geom_bar(stat="summary",fun.y="mean") +labs(title="Barplot of Average MPG per Carbon category per # of Cylinders", y="Mean MPG",x="Carbon Category") +facet_grid(.~factor(cyl)) +geom_text(aes(label=mpg),vjust=3) My goal is to have (and show) the average MPG value per

plot dataframe: overlay line and bar plot doesn't work for time series index?

大兔子大兔子 提交于 2021-01-28 05:14:16
问题 import numpy as np import pandas as pd import matplotlib.pyplot as plt # create dataframes df0 and df1: index0 = pd.date_range(start='2014-06-01 00:00:00', end='2014-06-01 00:15:00', freq='1S') data0 = np.random.rand(len(index0)) df0 = pd.DataFrame(data=data0, index=index0, columns=['DF0']) index1 = pd.date_range(start='2014-06-01 00:00:00', end='2014-06-01 00:15:00', freq='15S') data1 = np.random.rand(len(index1)) df1 = pd.DataFrame(data=data1, index=index1, columns=['DF1']) # plot df0 and

Negative values bars on the same matplotlib chart

喜欢而已 提交于 2021-01-28 04:33:20
问题 I am trying to display 3 bar charts on the same plot. There is an issue with bars that have negative values though, because they are hanging down either from the top or from nowhere. Any ideas how to make it look nicer? import pandas as pd import matplotlib.pyplot as plt x = range(6) a1 = [-1, -4, -3, -6, 2, 8] a2 = [ 4, 12, 8, 1, 10, 9] a3 = [100, 110, 120, 130, 115, 110] df = pd.DataFrame(index=x, data={'A': a1, 'B': a2, 'C': a3}) fig, ax = plt.subplots() ax2 = ax.twinx() ax3 = ax.twinx()

Ordering of faceted stacked barplot with ggplot2

a 夏天 提交于 2021-01-27 12:43:41
问题 I have a dataset like the below and am trying to get an ordered faceted stacked barplot. I have looked at some answers on SO particularly this one to come up with my plot but am not sure why this does not work on one particular bar of my stacked barplot structure(list(reg = c("J", "J", "J", "J", "J", "J", "J", "J", "KA", "KA", "KA", "KA", "KA", "KA", "KA", "KA", "KA", "KA", "RI", "RI", "RI", "RI", "SU", "SU", "SU", "SU", "SU", "SU", "SA", "SA", "SA", "SA", "SA", "SA", "SA", "SA", "SA", "SA",