Questions tagged [bar-chart]

A bar chart is graphical representation of data where the value is represented by the length of the bar.

Bar charts are used for marking clear data which has discrete values. Some examples of discontinuous data include 'shoe size' or 'eye color', for which a bar chart is appropriate. In contrast, some examples of continuous data would be 'height' or 'weight'. A bar chart is very useful for recording certain information whether it is continuous or not continuous data. Bar charts also look a lot like histograms. They are often mistaken for each other.

Example of a bar chart, with 'Country' as the discrete data set.

enter image description here

Source: eNotes (Bar chart)

In scientific software for statistical computing and graphics, a bar-chart can be generated by function barplot.

8160 questions
20
votes
2 answers

Google BarChart set width of bars?

I'm generating a BarChart with Google's javascript visualization libraries. I would like to make the bars in the chart to be wider than they currently are, but I can't find anything in the documentation which shows how to configure the width of the…
Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229
20
votes
1 answer

scale_fill_manual define color for NA values

I try to make a barplot with ggplot2 and am facing some issues with defining the color for NA. ggh <- ggplot(data=dat, aes(x=var1, fill=var2))+ geom_bar(position="dodge")+ scale_fill_manual( values=c("s"="steelblue", "i"="darkgoldenrod2",…
GaryDe
  • 492
  • 1
  • 5
  • 17
20
votes
2 answers

'height' must be a vector or a matrix. barplot error

I am trying to create a simple bar chart, but I keep receiving the error message 'height' must be a vector or a matrix The barplot function I have been trying is barplot(data, xlab="Percentage", ylab="Proportion") I have inputted my csv, and the…
user2941526
  • 497
  • 3
  • 6
  • 17
20
votes
2 answers

Gnuplot Histogram Cluster (Bar Chart) with One Line per Category

Histogram Cluster / Bar Chart I'm trying to generate the following histogram cluster out of this data file with gnuplot, where each category is represented in a separate line per year in the data file: # datafile year category …
fiedl
  • 5,667
  • 4
  • 44
  • 57
20
votes
2 answers

Diagonal tick labels

I am plotting a bar chart in python using matplotlib.pyplot. The chart will contain a large number of bars, and each bar has its own label. Thus, the labels overlap, and they are no more readable. I would like that the label are displayed diagonally…
Marco
  • 3,053
  • 5
  • 27
  • 29
20
votes
3 answers

Indicating the statistically significant difference in bar graph USING R

This is a repeat of a question originally asked here: Indicating the statistically significant difference in bar graph but asked for R instead of python. My question is very simple. I want to produce barplots in R, using ggplot2 if possible, with an…
Jim Bo
  • 657
  • 3
  • 9
  • 16
20
votes
2 answers

Find a WPF element inside DataTemplate in the code-behind

I have a data-template
Robert Langdon
  • 855
  • 1
  • 11
  • 27
20
votes
2 answers

D3.js Transitions

I am trying to create an animated bar graph using d3.js. I want the bars to appear one by one like this example http://nvd3.com/ghpages/multiBar.html . I was able to create a similar behavior but the motion starts from the height of the bar builds…
s_curry_s
  • 3,332
  • 9
  • 32
  • 47
19
votes
3 answers

Pandas groupby two columns and plot

I have a dataframe like this: import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline df = pd.DataFrame({'category': list('XYZXY'), 'B': range(5,10),'sex': list('mfmff')}) I want to plot count of sex male or…
BhishanPoudel
  • 15,974
  • 21
  • 108
  • 169
19
votes
2 answers

How to display percentage above grouped bar chart

The following are the pandas dataframe and the bar chart generated from it: colors_list = ['#5cb85c','#5bc0de','#d9534f'] result.plot(kind='bar',figsize=(15,4),width = 0.8,color =…
raniphore
  • 386
  • 1
  • 2
  • 9
19
votes
9 answers

How to refresh jqplot bar chart without redrawing the chart

I have a jqplot bar chart and I want the chart data to be changed when the user changes the value on a drop-down list. That works, but the problem is the bar chart redraws, one over another, each time the user changes the values. How can I update…
Umesha Gunasinghe
  • 779
  • 3
  • 13
  • 29
19
votes
2 answers

Is it possible to add hatches to each individual bar in seaborn.barplot?

ax = sns.barplot(x="size", y="algorithm", hue="ordering", data=df2, palette=sns.color_palette("cubehelix", 4)) After (or before) creating a seaborn barplot, is there a way for me to pass in hatch (fill in patterns along with the colors) values for…
kxirog
  • 392
  • 1
  • 2
  • 9
19
votes
3 answers

Plotly: Grouped Bar Chart with multiple axes

When I set barmode='group' in Layout while trace2 = Bar(...,yaxis='y2'), this leads bars to be stacked or overlayed instead of grouping them. How can I group the bars while having multiple axes? I went over these but no avail: With single Y axis…
tozCSS
  • 5,487
  • 2
  • 34
  • 31
19
votes
10 answers

Force BarChart Y axis labels to be integers?

I've created a BarChart using MPAndroidChart and I'm entering the data dynamically. This means that I need my Y axis to also be determined dynamically. All of my data is represented as integers, however the Y axis is sometimes displaying the legend…
Fozefy
  • 665
  • 2
  • 7
  • 23
19
votes
1 answer

ggplot Error: Don't know how to automatically pick scale for object of type function

I plotted a stacked bar graph in R using ggplot2 package, data<-read.table("K.txt",header=TRUE, sep="\t") > data Sample P1 P2 P3 P4 1 G1 0.02 0.01 0.03 0.95 2 G2 0.01 0.01 0.02 0.97 3 G3 0.01 0.01 0.02 0.97 4 G4 0.01 0.01…
ramesh
  • 1,187
  • 7
  • 19
  • 42