stacked-chart

different colors for each bar in stacked bar graph - base graphics

大憨熊 提交于 2019-11-27 18:21:45
问题 I want to plot a stacked bar graph like the one attached, but I want the colors to vary between the categories aa, bb and cc. Specifically, I want the grey blocks in bb to be red and the grey blocks in cc to be green. The following code serves as a simple example and illustrates what I have already tried: aa=c(0.2,0.6,0.1,0.1) bb=c(0.4,0.5,0.05,0.05) cc=c(0.5,0.25,0.1,0.15) x=cbind(aa,bb,cc) x #the data aa bb cc [1,] 0.2 0.40 0.50 [2,] 0.6 0.50 0.25 [3,] 0.1 0.05 0.10 [4,] 0.1 0.05 0.15

Data tooltips in Bokeh don't show data, showing '???' instead

天大地大妈咪最大 提交于 2019-11-27 14:31:43
I'm trying to create a stacked bar chart using Bokeh. I'd like to use the hover feature, displaying the relevant data in each part of the bar, but instead of the data Bokeh shows '???'. I got the data in an excel file called "Example worksheet", in a sheet called "Sales". The sheet looks like this: Year Category Sales 2016 A 1 2016 B 1 2016 C 1.5 2017 A 2 2017 B 3 2017 C 1 2018 A 2.5 2018 B 3 2018 C 2 I tried running the following code: import numpy as np import scipy as sp from bokeh.charts import Bar, output_file, show from bokeh.models import HoverTool import pandas as pd x = pd.read_excel(

Proper x-axis for Highcharts stack group column

ⅰ亾dé卋堺 提交于 2019-11-27 06:29:07
问题 I'm trying to develop a chart that visualizes data using 1 measurement and 3 dimensions. I put one dimension on the x-axis, one as stack and one as list of series. HighCharts has the stacked-grouped-column chart that I use as basis. See my jsfiddle. series: [{ name: 'John', color: '#ff4400', data: [5, 3, 4, 7, 2], stack: '2014' }, { name: 'Joe', color: '#44ff00', data: [3, 4, 4, 2, 5], stack: '2014' }, { name: 'John', color: '#ff4400', data: [2, 5, 6, 2, 1], showInLegend: false, stack: '2015'

D3.js Stacked Bar Chart, from vertical to horizontal

淺唱寂寞╮ 提交于 2019-11-27 03:37:26
问题 I like to make this vertical Bar Chart (http://bl.ocks.org/mbostock/3886208) to a horizontal Bar Chart. Thanks for your help! Code examples would be nice. 回答1: It's just a matter of reversing the domains, axis and then the rect calculations: var y = d3.scale.ordinal() .rangeRoundBands([height, 0], .1); // y becomes ordinal var x = d3.scale.linear() .rangeRound([0, width]); // x becomes linear // change state group to be positioned in the y now instead of x var state = svg.selectAll(".state")

Data tooltips in Bokeh don't show data, showing '???' instead

雨燕双飞 提交于 2019-11-26 16:47:15
问题 Note from maintainers: this question concerns the obsolete bokeh.charts API that was removed several years ago. See this section for information about hover tools with Bar charts in modern Bokeh: https://docs.bokeh.org/en/latest/docs/user_guide/categorical.html#hover-tools I'm trying to create a stacked bar chart using Bokeh. I'd like to use the hover feature, displaying the relevant data in each part of the bar, but instead of the data Bokeh shows '???'. I got the data in an excel file

ggplot2: Changing the order of stacks on a bar graph

♀尐吖头ヾ 提交于 2019-11-26 09:57:05
问题 I\'m trying to make a stacked bar graph with a facet_wrap, but I want the order of my stacked variables (\"developed\") to be flipped. I\'ve reordered the factors, and tried \"order=descend(),\" as well as \"scale_fill_manual\" and nothing seems to work. Here is my code: developed=rep(c(\"developed\",\"available\"),6) agriculture=rep(c(rep(\"loi\",2), rep(\"dryland\",2), rep(\"agroforestry\",2)),2) acres=c(7435,24254,10609,120500,10651,75606,6037,9910,4390,895,9747,46893) islands=c(rep(\"All

Reverse stacked bar order

瘦欲@ 提交于 2019-11-26 03:58:17
问题 I\'m creating a stacked bar chart using ggplot like this: plot_df <- df[!is.na(df$levels), ] ggplot(plot_df, aes(group)) + geom_bar(aes(fill = levels), position = \"fill\") Which gives me something like this: How do I reverse the order the stacked bars themselves, so that level 1 is at the bottom, and level 5 is at the top of each bar? I\'ve seen a number of questions on this (e.g. How to control ordering of stacked bar chart using identity on ggplot2) and the common solution seems to be to