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
19
votes
4 answers

Change colours of particular bars in a bar chart

I've been creating some bar-charts and I was wondering is it possible to colour bars on a chart depending on whether they lie above or below the x-axis? For clarification, this is the type of bar-chart I mean: Ideally I would like to be able to…
George Burrows
  • 3,391
  • 9
  • 31
  • 31
19
votes
1 answer

Two chart types (bar and line) in same SSRS chart

How can SSRS 2005 represent two chart types (i.e., bar and line) on the same chart? I am trying to create a graph that looks like the professionally crafted image below: The chart would have one series represented as bar graphs and then two other…
18
votes
2 answers

Matlab - How to use strings instead of numbers in bar figure

I want to obtain a Matlab figure using the bar function but when the actual figure is plotted instead of displaying the numbers underneath each bar I want to display which represents that actual value plotted. For example I am having the vector x =…
Simon
  • 4,999
  • 21
  • 69
  • 97
18
votes
3 answers

Seaborn Catplot set values over the bars

I plotted a catplot in seaborn like this import seaborn as sns import pandas as pd data = {'year': [2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015], 'geo_name': ['Michigan',…
Sreeram TP
  • 11,346
  • 7
  • 54
  • 108
18
votes
2 answers

Is is possible to display barcharts horizontally in Flot?

Apologies, but I'm a newbie at Flot. I'd like to display my data in a horizontal bar chart rather a vertical bar chart which Flot seems to default to. Is it possible to do this in Flot, and, if so, how do I do it?
ssi_bas
  • 215
  • 2
  • 3
  • 5
18
votes
2 answers

Make seaborn show a colorbar instead of a legend when using hue in a bar plot?

Let's say I want to make a bar plot where the hue of the bars represents some continuous quantity. e.g. import seaborn as sns titanic = sns.load_dataset("titanic") g = titanic.groupby('pclass') survival_rates = g['survived'].mean() n = g.size() ax =…
Coquelicot
  • 8,775
  • 6
  • 33
  • 37
18
votes
8 answers

Changing width of bars created with catplot or barplot

I'm trying to create bar chart using seaborn.factorplot. My code looks like this: import seaborn as sns import matplotlib.pyplot as plt df = pd.read_csv('data.csv') fg = sns.factorplot(x='vesselID', y='dur_min', hue='route', size=6, aspect=2,…
kaleshanagineni
  • 325
  • 1
  • 4
  • 13
18
votes
4 answers

Width of the bar in Jfreechart

Is there a way to adjust the width of the bars in a Barchart? I create my chart with the following code. final JFreeChart chart = ChartFactory.createBarChart("Report", // chart title "Date", // domain axis label …
Harish
  • 1,617
  • 4
  • 21
  • 20
18
votes
2 answers

Using an ordinal scale ('d3.scale.ordinal') for the x-axis in a bar chart

I have a data array like this: var data = [{"Alphabet_Type":"a"}, {"Alphabet_Type":"b"}, {"Alphabet_Type":"a"}]; I am using: dc.js crossfilter.js d3.js I want to create a bar chart with: the x-axis having an alphabet name, and the y-axis…
Arun
  • 385
  • 3
  • 7
  • 16
18
votes
2 answers

Use d3 log scale instead of linear scale

I'm trying to do a chart based on http://mbostock.github.com/d3/talk/20111116/bar-hierarchy.html, the only difference being that I'd like to use a log scale for the x-axis. Here's my fiddle: http://jsfiddle.net/JhDVC/5/ As you can see, the x-axis is…
luisfarzati
  • 8,649
  • 6
  • 29
  • 27
17
votes
1 answer

Grouped barplot in R with error bars

I would like to draw a grouped barplot with error bars. Here is the kind of figure I have been able to get up to now, and this is ok for what I need: And here is my script: #create…
tlorin
  • 1,100
  • 6
  • 17
  • 30
17
votes
1 answer

Bar chart of positive and negative values

I want the negative bars to be facing downwards, and the positive upwards, with the x-axis(0-line) passing right between them. I tried this chart = fig.bar(x, negative_data, width=35, color='r') ax2 = plt.gca().twinx() ax2.bar(x, positive_data,…
Baron Yugovich
  • 3,843
  • 12
  • 48
  • 76
17
votes
1 answer

Changing a horizontal bar chart to a vertical one

I'm using the'System.Windows.Forms.DataVisualization.Charting' library for my chart and I was wondering if anyone figured out how to switch the axes to display the chart vertically Thanks.
alhazen
  • 1,907
  • 3
  • 22
  • 43
17
votes
3 answers

D3 grouped bar chart: How to rotate the text of x axis ticks?

I'm using the Grouped Bar Chart(http://bl.ocks.org/mbostock/3887051), but the text of the x-axis is very long, as shown in attached picture. How to rotate the text? Thank you.
Linlin
  • 2,127
  • 5
  • 20
  • 25
17
votes
1 answer

pandas plot dataframe barplot with colors by category

I would like to use pandas to plot a barplot with diffrent colors for category in column. Here is a simple example: (index is variable) df: value group variable a 10 1 b 9 1 c …
jonas
  • 13,559
  • 22
  • 57
  • 75