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
31
votes
3 answers

JFreeChart BarChart -> NO gradient

my bar chart is always drawn with a gradient color by default. I just want a simple color without any styled effects. Can anyone help ? Code: final JFreeChart chart = ChartFactory.createBarChart( "", // chart title xLabel,…
shorty
  • 489
  • 2
  • 6
  • 12
31
votes
3 answers

R barplot Y-axis scale too short

I'm trying to generate a barplot, but the y-axis scale is too short. Here's my code: barplot(as.matrix(dat), log="y", ylim=c(10000,100000000), beside=TRUE, ylab = "Number of reads", col = c("gray","black","white")) It leaves the room for…
jayemee
  • 363
  • 1
  • 3
  • 9
30
votes
1 answer

Annoying white space in bar chart (matplotlib, Python)

It's probably a trivial question, but I am trying to plot a bar chart with matplotlib and with rotated text on the x axis. The code I'm using is shown below: fig = plt.figure() x_labels_list = [] for i in range(0, pow(2, N)): …
user2983638
  • 903
  • 1
  • 13
  • 20
29
votes
1 answer

how to put exact number of decimal places on label ggplot bar chart

How can I specify the exact number of decimal places on ggplot bar chart labels? The data: strefa <- c(1:13) a <- c(3.453782,3.295082,3.137755,3.333333,3.500000,3.351351,3.458824,3.318681,3.694175,3.241379,3.138298,3.309524,3.380000) srednie…
Maciej B.
  • 373
  • 1
  • 4
  • 13
29
votes
4 answers

How to set a different color to the largest bar in a seaborn barplot

I'm trying to create a barplot where all bars smaller than the largest are some bland color and the largest bar is a more vibrant color. A good example is darkhorse analytic's pie chart gif where they break down a pie chart and end with a more clear…
pmdaly
  • 1,142
  • 2
  • 21
  • 35
29
votes
2 answers

Spacing between bars in matplotlib hist() with thousands of bins

I'm making histograms using matplotlib's hist() function or bar(), and I want to use >10,000 bins (one bin to represent the counts at each coordinate of a large entity). Is there any way to create more whitespace between the vertical bars when I…
whymca
  • 291
  • 1
  • 3
  • 3
29
votes
2 answers

change color of only one bar in ggplot

I want to color only one bar in ggplot. This is my data frame: area <- c("Północ", "Południe", "Wschód", "Zachód") sale <- c(16.5, 13.5, 14, 13) df.sale <- data.frame(area, sale) colnames(df.sale) <- c("Obszar sprzedaży", "Liczba sprzedanych…
jjankowiak
  • 3,010
  • 6
  • 28
  • 45
28
votes
3 answers

How to set Dataframe Column value as X-axis labels

Say I have data in following format: Region Men Women City1 10 5 City2 50 89 When I load it in Dataframe and plot graph, it shows index as X-axis labels instead of Region name. How do I get names on X-axis? So far I tried: import…
Volatil3
  • 14,253
  • 38
  • 134
  • 263
27
votes
1 answer

How can I display text over columns in a bar chart in matplotlib?

I have a bar chart and I want over each column to display some text,how can I do that ?
IordanouGiannis
  • 4,149
  • 16
  • 65
  • 99
27
votes
7 answers

How to change colours for Angular-Chart.js

I use Angular-Chart.js (the AngularJS Chart.js version) to create a bar chart. The Chart is working with the options except for the colours. Even if I set them it is indicated in the documentation, they stay grey.
Lucien Dubois
  • 1,590
  • 5
  • 28
  • 53
26
votes
3 answers

Customizing the order of legends in plotly

I am trying to customize the order of legends while plotting stacked bar plots in plotly,python. data = [ go.Bar( y=df['sid'], # assign x as the dataframe column 'x' x=df['A'], orientation='h', …
Natasha
  • 1,111
  • 5
  • 28
  • 66
26
votes
3 answers

Pandas bar plot with binned range

Is there a way to create a bar plot from continuous data binned into predefined intervals? For example, In[1]: df Out[1]: 0 0.729630 1 0.699620 2 0.710526 3 0.000000 4 0.831325 5 0.945312 6 0.665428 7 …
Arnold Klein
  • 2,956
  • 10
  • 31
  • 60
25
votes
3 answers

How to plot a very simple bar chart (Python, Matplotlib) using input *.txt file?

I use Python 2.7 and matplotlib. I have a *.txt data file : 0 14-11-2003 1 15-03-1999 12 04-12-2012 33 09-05-2007 44 16-08-1998 55 25-07-2001 76 31-12-2011 87 25-06-1993 118 16-02-1995 119 10-02-1981 145 03-05-2014 first column of my file (numbers)…
mazix
  • 2,540
  • 8
  • 39
  • 56
24
votes
2 answers

Controlling bars width in matplotlib with per-month data

When I plot data sampled per month with bars, their width is very thin. If I set X axis minor locator to DayLocator(), I can see the bars width is adjusted to 1 day, but I would like them to fill a whole month. I tried to set the minor ticks locator…
Luper Rouch
  • 9,304
  • 7
  • 42
  • 56
24
votes
2 answers

Combining Bar and Line chart (double axis) in ggplot2

I have double-y-axis chart made in Excel. In Excel it requires only basic skills. What I'd like to do is to replicate this chart using the ggplot2 library in R. I have already done this, but I need to plot Response on 2nd-y-axis. I enclose…
AK47
  • 1,318
  • 4
  • 17
  • 30