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
2
votes
1 answer

Errorbar duplicated for ggplot barplot

I'm new to ggplot and have a problem with plotting errorbars in a barplot. A minimal working example looks like this: abun_all <- data.frame("Tree.genus" = c(rep("Acer", 5), rep("Betula", 5), rep("Larix", 5), rep("Picea", 5), rep("Pinus", 5),…
L.Thoma
  • 23
  • 6
2
votes
0 answers

How to increase the plot_importance bar width in matplotlib?

I have the below bar chart generated by using plot_importance. I increase the fontsize of title, xlabel, ylabel, xticks and yticks by using below code snippet: plot_importance(clf) plt.xticks(fontsize=18) plt.yticks(fontsize=18) plt.title("Feature…
Nasir Islam Sujan
  • 362
  • 1
  • 3
  • 20
2
votes
1 answer

Center 3D bars on the given positions in matplotlib

Consider a 3D bar plot with custom grid lines: import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.ticker import MultipleLocator # This import registers the 3D projection, but is otherwise unused. from…
C. E.
  • 10,297
  • 10
  • 53
  • 77
2
votes
2 answers

bar plot with stack and beside in r

Using base R I want to create a plot like this with two groups, one beside and other on the top. Here is data and code I played with: brown <- c(5,4,3) green <- c(4,7,8) blue <- c(4,7,2) dark <- data.frame(brown=brown, green=green,…
SHRram
  • 4,127
  • 7
  • 35
  • 53
2
votes
3 answers

Groupby and plot bar graph

I want to plot a bar graph for sales over period of year. x-axis as 'year' and y-axis as sum of weekly sales per year. While plotting I am getting 'KeyError: 'year'. I guess it's because 'year' became index during group by. Below is the sample…
user1882624
  • 303
  • 2
  • 4
  • 16
2
votes
2 answers

Clustered bar chart R using 2 Numeric Variables/Metrics

I want to create a clustered Bar chart in R using 2 numeric variables, e.g: Movie Genre (X-axis) and Gross$ + Budget$ should be Y-axis It's a very straightforward chart to create in Excel. However, in R, I have put Genre in my X-axis and Gross$ in…
Ashutosh D
  • 21
  • 1
2
votes
1 answer

Adding values to bars of subplots

I have a subplot bar chart coded as: axes = df.plot.bar(yerr=df1, figsize=(10,8), legend=False, title='Bar chart',grid=1, subplots=True, layout (5,1),xticks=None) Is there an easy way to modify the code so that to see numerical values…
Ekaterina
  • 189
  • 1
  • 10
2
votes
1 answer

How to plot a dataset containing counts using ggplot and brewer package?

Following is my dataset feature_user <- data.frame (Features = c("Battery","Build_Design", "Camera","Connectivity","Delivery", "Design", "Display", "Gaming_Experience", "Performance", …
Arun Elangovan
  • 237
  • 1
  • 3
  • 16
2
votes
0 answers

How to set Google chart vertical axis increments? How can I set a max width on the grid bar?

I am using Google charts and reading about the axis customization instructions here. Here are two examples of charts that the code below is generating: Example 1: Example 2: And the code (note that the dataTableArray raw values have been taken…
aBlaze
  • 2,436
  • 2
  • 31
  • 63
2
votes
1 answer

X axis value in stackLabels Formatter in bar highchart

I want to display custom label on top of bar chart. Below is my code for stacklabel, problem here is i want category name of stack inside formatter of stacklabel, how do I access it. stackLabels: { enabled: true, …
pbhle
  • 2,856
  • 13
  • 33
  • 40
2
votes
1 answer

Dont show the sum of values in bar chart in Power BI

I have a table which has dates in Date and a number in TCount. I am creating bar chart with TCount on Y-Axis and Dates on X-Axis. Now in bar chart, Power BI is adding all the values in TCount. I have to drill down to show the breakup in terms of…
WAkram
  • 21
  • 1
  • 4
2
votes
1 answer

How to create two legend objects for a single plot instance?

I use the following example code to generate a bar plot. import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 5, 5) y = np.exp(x) w = x[1] - x[0] colors = ['blue' if idx % 2 == 0 else 'red' for idx in range(len(x))] fig, ax =…
user7345804
2
votes
0 answers

How to center xticks in pandas barplot?

I am trying to rotate the xticks labels in a pandas bar plot. My problem is that when I do so, the xticks labels are centered according to their middle, and I would like to center the otherwise (so that their top extremity is centered with the…
ysearka
  • 3,805
  • 5
  • 20
  • 41
2
votes
1 answer

Multi Column Bar chart in Pandas Python

I'm learning Pandas and need some help in improving the aesthetics of my plot. Problem I'm trying to plot a multi-column bar chart in pandas (either using Matplotlib or through Seaborn library). Two main columns in my data are Pages - main column…
Sidd_Terp
  • 59
  • 2
  • 9
2
votes
2 answers

Equivalent of secondary_y for barh in Pandas/Matplotlib?

Pandas offers a nice, simple way to plot a (vertical) bar chart on two y axes. Is there an equivalent for the horizontal bar chart? To adapt from the linked example: import matplotlib.pyplot as plt import numpy as np import pandas as pd from io…
bongbang
  • 1,610
  • 4
  • 18
  • 34