FAQ Database Discussion Community

## geom_bar from min to max data value

r,plot,ggplot2,bar-chart,geom-bar
I am not sure if geom_bar is able (probably I'm not) to create the plot I need with geom_bar. I want a bar plot but not starting from 0, I have a minimum and maximum value that are to be the start and end points of each bar. Desired output...

## normalized bar heights in ggplot

r,ggplot2,bar-chart
I am trying to compare two sets of count data with ggplot. The datasets are of different lengths and I am having trouble figuring out how to normalize the bar heights to the number of rows in each dataset. Please see the code examples below: Example dataset set.seed(47) BG.restricted.hs =...

## How to create graph in c#.net

c#,bar-chart
ChartArea ChartArea1 = new ChartArea(); Legend Legend1 = new Legend(); Series Series1 = new Series(); dynamic Chart1 = new Chart(); this.Controls.Add(Chart1); ChartArea1.Name = "ChartArea1"; Chart1.ChartAreas.Add(ChartArea1); Legend1.Name = "Legend1"; Chart1.Legends.Add(Legend1); Chart1.Location = new System.Drawing.Point(210, 241); Chart1.Name = "Chart1"; Series1.ChartArea = "ChartArea1"; Series1.Legend = "Legend1"; Series1.Name = "Series1"; Chart1.Series.Add(Series1); Chart1.Size = new...

## names on the x-axis of barplot in R?

r,bar-chart
I am plotting barplot in r. my data: ,Up,Down Floor-1,690,1511 Maxim,1354,2515 Hosiptal,1358,2649 Bank,459,589 Air-port,1359,2097 Bus-stand,1234,1928 Taxi-Stand,213,138 Railway-station,557,610 The barplot of the script is at https://www.dropbox.com/s/77iswweabw0790d/q.png?dl=0 As I don't have enough reputation; I can't post the image ... :) my script is : d <- read.csv("file.csv") barplot(t(as.matrix(d[, 2:3])),beside=TRUE,legend = c("Up","Down"), ylab...

## D3: Is there a name for this type of chart and code example?

d3.js,bar-chart
I've seen this kind of bar chart in a couple of places. This is from LinkedIn. The page is rather complicated. When you click on a bar, it recalculates and reorders the bars in the other columns. Here, San Fran is clicked. Is there an example of something like this...

## Bar Plot x-axis order in R ggvis

r,bar-chart,ggvis
I am experimenting to use ggvis for my daily report. One issue I came across is that for a dataset that I intended to plot x-axis as in the data order. However, the actual plot shows up in the alphabet order. Is there any hidden parameters to change x-axis order...

## How can I create hierarchical bar chart in d3.js

javascript,d3.js,bar-chart,hierarchy,hierarchical
I wanted to use the Sortable Bar Chart of Mike Bostock without it's transition property and sort the bars according to their lenght but I couldn't. I want the bars just like this. without interactivity. <!DOCTYPE html> <meta charset="utf-8"> <body> <style> body { font: 10px sans-serif; } .bar rect {...

## Plot bars starting from x axis not equal to 0 and extend to both sides

r,plot,bar-chart
Suppose my data values are x <- c(30,50,70,120,150) I want them in horizontal format (horiz=T). Now My y axis position is in x=100 and I want bars to start from x=100, not from 0, and it should extend to left and right sides What to do? x=c(30,50,70,120,150) barplot(x,horiz=T) axis(2,pos=100) but...

## ggplot2: side by side barplot with one bar stacked and the other not

r,ggplot2,bar-chart
I am trying to create a barplot where for each category, two bars are plotted (side by side): one is for the "total", the other is stacked by subgroups. For example, in the following data frame, 'names' will be shown on x-axis. For each category in 'names', one bar will...

## Bars in geom_bar have unwanted different widths when using facet_wrap

r,ggplot2,bar-chart,geom-bar
I can'd find a solution for the following problem(s). I would appreciate some help a lot! The following code produces bar charts using facet. However, due to "extra space" ggplot2 has in some groups it makes the bars much wider, even if I specify a width of 0.1 or similar....

## Refresh Chart Without Redraw it

c#,winforms,charts,bar-chart
I want to create a bar graph, like it scans something. In addition I want to change the color of the bar according to the x-axis interval at that time. So far, I can managed the scanning function but when I try to change the colour of the bar, the...

## Grouped Barplot with three measures

r,excel,ggplot2,bar-chart
I am trying to reproduce the following graph in R which is generated via Excel. The CSV file has following content: > myd type am tae tac 1 kA 81.73212 73.07151 26.92849 2 kI 78.87324 84.50704 15.49296 3 kL 82.52184 69.91262 30.08738 4 kS 82.67147 69.31411 30.68589 5 sA 81.67176...

## R barplot with very long names

r,ggplot2,label,bar-chart
I want to produce a barplot of 10 items stored in a data frame: df <- structure(list(v = structure(c(0.133177575198731, 0.048416489312887, 0.0323328322269662, 0.0257842168974815, 0.0207946396185765, 0.0157952295839215, 0.015414483430714, 0.0138292246981344, 0.0136598827935515, 0.0132108536143025 ), .Dim = 10L, .Dimnames = structure(list(c("HIPERTENSION ESENCIAL (PRIMARIA)", "RINOFARINGITIS AGUDA", "DIARREA Y GASTROENTERITIS DE PRESUNTO ORIGEN INFECCIOSO", "LUMBAGO NO ESPECIFICADO", "INFECCION...

## R: Barplot, add value directly next to bar and a description in a separate column [closed]

r,bar-chart
How can I achieve somethign like this in R:

## how to control the extent of multi-barplot on the X-axis with GNUPLOT

gnuplot,bar-chart
I am trying to make a multi-barplot as in the attached image, but the counting on the X-axis must start from 44 up to 127 not from 1 up to 84 as it is now. Can anyone please indicate how to do that? set ylabel "Sec. Struct. Probability" offset -1...

javascript,php,jquery,foreach,bar-chart

## How to make a grade bar chart in java

java,bar-chart,stddraw
This is my homework problem, but i cant seem to get it straight. This program prompts the user to enter the number of students and then prompts the user to enter a grade percentage (0-100) for each student. Only thing i can't get right is that I cant draw the...

## ggvis side-by-side barchart grouped by second variable

r,bar-chart,ggvis
I am in process of migrating from Excel to ggvis for data analysis. For a typical grouped bar chart with two variables, however I have difficulty to plot bar chart side-by-side instead of stacked. The following data has four steps A, B, C, D with "ratio" data from two features...

## Flot Bar Chart design

javascript,design,bar-chart,flot
I've made this bar chart http://imageshack.com/a/img901/7186/cnOfhh.png, and the code for it is: //compute & mark average color for (var i = 0; i < zdata.length; i++) { if (zdata[i].TargetTime == null) zdata[i].TargetTime = 0; if (zdata[i].TimePlayed == null) zdata[i].TimePlayed = 0; if (zdata[i].TargetTime >= zdata[i].TimePlayed) { zdata[i]['Color'] = 'green'; }...

## How to add Aggregate (Sum) To Kendo UI Stacked Bar Chart

javascript,kendo-ui,bar-chart
I have a simple bar chart with basic data. The tooltip shows the specific value it is representing which is good. I want to, just below it, show the Total for that entire bar/stack. So if the top bar had 10, 20, 50 for its corresponding values, the total for...

## Putting space between bars using bar function

matlab,plot,bar-chart
I am try to plot 16 bars, 8 of these belong to one group. I want to give this group the red color, the other 8 belong to another group which is given the blue color. I would like to arrange the bar in pairs, each pair containing one from...

## How to add three legends of a bar graph in matlab?

matlab,plot,bar-chart,legend,precision-recall
i have a bar graph which calculates precession and recall for three different methods and represents them in three different colors, code i used is as follows x=[0.4,0.31,0.21] y=[0.45,0.38,0.27] bar(x,y,0.1) h = bar(x,diag(y),0.1,'stacked'); xlabel('precession') ylabel('recall') i want to add a legend that should show maroon color is for indiscernible relation,...

## Primefaces 5 Rotated Axis Tick Labels

css,jsf-2,primefaces,bar-chart
In Primefaces 4 we can configure the rotation of axis tick labels as below: <p:barChart id="idBars" value="#{chartBean.modelChart}" [...] style=" xaxisAngle="-30" > </p:barChart> Now, how can I configure the rotation of axis tick labels using Primefaces 5 or higher? Thanks in advance....

r,bar-chart,na

## Set custom colours for tooltip squares Chart.js

jquery,charts,html5-canvas,bar-chart,chartjs
When using Chart.js is it possible to change the colour of the squares within the tooltip that is used to respresent each bar? I've noticed that when you change the pointColor value it affects the colour of the squares but can you somehow use a different colour other than whats...

## Android - BarChart, Bargraph

android,bar-chart
I want to implement a feedback/rating chart in my android app.(it is like when you open the google play and check an app's feedback there is a colourful graph from users who had voted it) Can anyone help me how to start that? I appreciate any help you can provide.

## Grouped barplot in ggplot2 in R

r,ggplot2,bar-chart
I would like to make a grouped bar plot. An example of my data is as follows: site code year month gear total value 678490 2012 3 GL 13882 678490 2012 4 GL 50942 678490 2012 5 GL 54973 678490 2012 6 GL 63938 678490 2012 7 GL 23825 678490...

## Recreate bar chart without it remembering data

javafx,bar-chart
Task I have a BarChart which I have to fill with different data over and over again. The data must be in a predefined order. Of course I only want to change the data and not create a bar chart every time. Problem Once you have a category with a...

## creating a grouped barplot in r that does'nt use counts

r,bar-chart
I am trying to create a barplot with the following data: https://www.dropbox.com/s/8xthu6aupp8c7ox/codeexampl.PNG?dl=0 I want the x-axis to show the elements (Sc, Y, La...) and for every element I want two bars next to each other. One for X13608g and one for X13608f with 48.3235 and 53.9796 as the y values....

## How to adjust grid lines in R's barplot?

r,grid,bar-chart
I am using grid() inside of barplot() (using the panel.first argument) to draw the grid lines. However, the grid lines do not match the ticks of y-axis. Can anyone tell me how to solve this problem? My code is like below, thanks. WRE <- c(1423, 41721) bp <- barplot(WRE, xaxt...

## Empty space in MATLAB bar chart [duplicate]

matlab,plot,bar-chart
This question already has an answer here: White space on the right when using bar Matlab 2 answers I'm plotting a bar chart of 901 values using MATLAB R2015a: What is empty space in the end of plot (black box)? How can I remove it?...

## How to change colours for Angular-Chart.js

javascript,angularjs,charts,bar-chart,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. <div class="graph-display" ng-controller="chartController"> <canvas class="chart chart-bar" data="bilans.data" labels="bilans.labels" series="bilans.series" options="{ scaleShowHorizontalLines: true, scaleShowVerticalLines:...

## multiBarChart (nvd3) in rCharts is not displaying

javascript,r,bar-chart,rcharts
I am using rChart library for generating javascript plots directly from R statistical package. I am trying to compute multiBarChart but the plot seems to be blank. EDIT What is more, none of examples from here displays on my computer: https://github.com/ramnathv/rCharts/blob/master/inst/libraries/nvd3/examples.R all examples are blank. Also some1 has a similar...

## Bar graph using php and mysql

javascript,php,mysql,arrays,bar-chart
Requirement Bar chart from MySql data , i have working code for static bar chart the code as follows --> <script> var data = [ [0, 11], //London, UK [1, 15], //New York, USA [2, 25], //New Delhi, India [3, 24], //Taipei, Taiwan [4, 13], //Beijing, China [5, 18] //Sydney,...

## How to display the value of the bar on each bar with pyplot.barh()?

python,matplotlib,bar-chart
I generated a bar plot, how can I display the value of the bar on each bar? Current plot: What I am trying to get: My code: import os import numpy as np import matplotlib.pyplot as plt x = [u'INFO', u'CUISINE', u'TYPE_OF_PLACE', u'DRINK', u'PLACE', u'MEAL_TIME', u'DISH', u'NEIGHBOURHOOD'] y = [160,...

## How to create stacked bar chart using C3 for string data?

bar-chart,c3
I am trying to created stacked bar chart using C3 chart. But i am facing problem as i am trying to plot a graph with string values. My data looks like this var data1=["Country", "Denmark", "India"] var data2=["Value", 1, 1] var X=["Item",'Item1','Item2] c3.generate({ data: { x:'Item', columns:[[data1],[data2]], type: 'bar' ,...

## How to remove bars for those bars with zero value in Chartjs bar chart?

html5,html5-canvas,bar-chart,chartjs
Even if the bars have value of zero in bar chart created using chartjs, they still show a visible bar. This is misleading for my purpose and I would like to have it removed and show nothing there (meaning that, I still want to show labels with zero value but...

## Different color for each column in angular-chartjs bar chart

javascript,angularjs,bar-chart,chart.js,angular-chart
I'm using angular-chartJS in a project I'm working on and I need a different color for each bar in a Bar Chart. Canvas: <canvas id="bar" class="chart chart-bar" data="medal_data" labels="medal_ticks"></canvas> Controller: $scope.medal_ticks = ['Gold', 'Silver', 'Bronze', 'Not passed'];$scope.series = ['Medaljer']; $scope.medals_colours= ['#087D76', '#B3BC3A', '#38B665', '#8B4A9D'];$scope.medal_data = ['1', '5', '2',...

## set the x-axis to meet y-axis at 0 with lattice

r,bar-chart,lattice
I am struggling with some plots in R. At the moment I am running R version: R version 3.2.0 (2015-04-16) Platform: i386-w64-mingw32/i386 (32-bit) Running under: Windows 7 (build 7601) Service Pack 1 I really hope someone can give me some advise on how to set my x-axis to meet the...

## How to adjust the y-axis of bar plot in R using only the barplot function

r,plot,bar-chart,axis-labels
Using this example: x<-mtcars; barplot(x\$mpg); you get a graph that is a lot of barplots from (0 - 30). My question is how can you adjust it so that the y axis is (10-30) with a split at the bottom indicating that there was data below the cut off? Specifically,...

## Error bars not plotting correctly on barplot

r,ggplot2,bar-chart,standard-error
I am having trouble getting my error bars to plot correctly. Here is my data frame: > d Date Plate.1 Plate.2 Plate.3 Plate.4 Plate.5 Plate.6 Plate.7 Plate.8 Sum Average SE Treatment 1 2014-10-15 2 2 0 5 8 11 11 0 39 4.875 1.6304852 1 2 2014-11-12 5 4 11...

## Removing negative values from axis

java,javafx-8,bar-chart,linechart,axis-labels
I have a BarChart and a LineChart. The possible values go from negative(-) to positive(+). How would I only display the positive axis-labels? As in only remove the numbers. Should I make a custom Chart or is there an easier way?...

## Barplot sum of observations in two groups in R

r,bar-chart
I have data of the form: mydata <- data.frame(test = 1:20, group = sample(c("A", "B"), 20, rep=TRUE), var1 = sample(c("yes", "no", "NA"), 20, rep=TRUE), var2 = sample(c("yes", "no", "NA"), 20, rep=TRUE), var3 = sample(c("yes", "no", "NA"), 20, rep=TRUE), var4 = sample(c("yes", "no", "NA"), 20, rep=TRUE), var5 = sample(c("yes", "no", "NA"),...

## Put one line chart and bar chart in one plot in R (Not ggplot)?

r,plot,ggplot2,data.frame,bar-chart
how to Combine a bar chart and line in single plot in R (from different data sources)? Say I have two data sources as: barData<-c(0.1,0.2,0.3,0.4) #In percentage lineData<-c(100,22,534,52,900) Note that they may not be in the same scale. Can I plot both barData and LineData in one plot and make...