bar-chart

Add labels to bar chart D3

我是研究僧i 提交于 2019-12-11 08:42:52
问题 I'm trying to add labels to my bar chart, and I can't make it work. I read a lot about it and tried many things already, but no success. var margin = {top: 20, right: 20, bottom: 70, left: 40}, width = 600 - margin.left - margin.right, height = 300 - margin.top - margin.bottom; var parseDate = d3.timeParse("%Y-%m"); var x = d3.scaleBand().rangeRound([0, width]).paddingInner(0.05); var y = d3.scaleLinear().range([height, 0]); var xAxis = d3.axisBottom(x) .tickFormat(d3.timeFormat("%Y-%m"));

Do floating bar graphs exist in matlab?

血红的双手。 提交于 2019-12-11 08:38:42
问题 I'm trying to make a simple bar graph that would essentially look like the following horrible ASCII rendering: Y | ---------- | --- | ----- | -- | ------- |______________ X 5 6 7 8 9 Is this possible? I haven't found a way to do it. 回答1: If you know exactly the coordinates of the desired bars in the graph, and the width of each bar line, you can do somthing like that: a=[5 10; 5 23; 7 13; 6 18]; % each pair is a start point of bar L=0.1; %Bar width for i=1:size(a,1) plot([a(i,1) a(i,1)+L], [a

Altering the margins of a legend in R

蓝咒 提交于 2019-12-11 08:33:01
问题 I am very new to R, so I'm struggling here a bit and I haven't found an answer to my problem. I'm trying to produce a simple bar-chart in R, and I have set my x-axis variable labels to be vertical, using las=2 . I then changed the margins for the barplot so that the labels would not overlap the xlab label, using par(mar=c(20,15,5,3)) and par(mgp=c(6,1,0)) . I would like to add a legend to this, but the one I have has adopted the margin dimensions of the graph itself, so that it appears too

jqplot - Limiting point labels displayed to just 1 series

风流意气都作罢 提交于 2019-12-11 08:27:27
问题 using jqPlot, is it possible to limit the point labels to just one series? See screenshot below! What I would like displayed is just the values above the "Actual" bar. The "mean" and "Planned" should'nt display! Thanks! Here's my code <script type="text/javascript"> $(document).ready(function () { $.jqplot.config.enablePlugins = true; var trendline = [60000, 70000, 110000, 80000]; var planned = [70000, 90000, 120000, 100000,]; var actual = [80000, 80000, 150000, 120000]; var xAxis = ['Jan',

Empty Flot Charts?

泄露秘密 提交于 2019-12-11 08:00:42
问题 I'm running the code below and getting an empty chart using Flot/jQuery. Ideally what I am after is a bar chart of the data. I'm looked and looked at this with no joy - does anyone have any ideas? <div id="user_breakdown_placeholder" style="width:300px;height:300px"></div> <script> $(function () { var d = [["Unassigned", 310],["Maynard Schumm", 274]]; var options = {}; $.plot($("#user_breakdown_placeholder"), d, options); }); </script> 回答1: The current version of flot (v. 0.6) supports bar

How to “group” order data in R for a barplot?

最后都变了- 提交于 2019-12-11 07:38:16
问题 I'm doing bioinformatics and I need to output a graph (barplot) with the ancestry results in it. Usually, these graphs are draw by grouping the populations together. The way it's done is that you simply plot the barplot of the Q score (data below) for the different putative population (here 4). The problem is that I use ord = tbl[order(tbl$V1,tbl$V2,tbl$V3),] to sort my values. That way I see that some bars do not cluster in the right population (see the orange bar in the graph that should

D3 Updating x axis groups on grouped bar chart

我的未来我决定 提交于 2019-12-11 07:15:16
问题 I'm trying to update a grouped bar chart with varying groups along the x axis (depending on the data). Here is the fiddle: https://jsfiddle.net/mrl513/arjcq9ka/ Use the radio button to see the update. The issue is that I need to update the x1 domain (range bands), by calling exit on existing rangebands. The original range bands are retained on the first 4 data groups. 1st data set has 4 groups. 2nd data set has 8 groups You can see on the fiddle that when the second button is selected (it has

dc.js charts not linked

半城伤御伤魂 提交于 2019-12-11 07:08:33
问题 I have two barCharts exactly equivalent except for the .brushOn option : pnlPerDaybarChart .height(300) .width(700) .dimension(dims.date) .group(groups.date.pnlSum) .valueAccessor(function(d) { return Math.abs(d.value); }) .renderTitle(false) .x(d3.time.scale().domain([minDate,maxDate])) .xUnits(d3.time.days) .colors(colorChoice) .colorAccessor(colorAccessorPosNeg) .brushOn(false) .elasticY(true) .margins({left: 70 ,top: 10, bottom: 30, right: 50}) .centerBar(true); pnlPerDaybarChartBrush

How can I calculate a value and place it inside the last bar in a Chart.JS bar chart?

≯℡__Kan透↙ 提交于 2019-12-11 07:08:24
问题 Since it seems impossible or highly difficult (no working answers here) to place a label above the last bar on a bar chart, I would like to now know how to place a label inside the last bar. I am adding labels to all the bars of a horizontal bar chart with this code: Chart.pluginService.register({ afterDraw: function (chartInstance) { if (chartInstance.id !== 1) return; // affect this one only var ctx = chartInstance.chart.ctx; // render the value of the chart above the bar ctx.font = Chart

How to show null data in barplot R

冷暖自知 提交于 2019-12-11 06:58:13
问题 I want to draw a barplot with in axis x the number of months and in axis y the value of a variable. The variable can be null for some months. How can I coerce the axis x to always show the 12 months? With V a data frame like: month variable 1 125 2 45 3 158 4 15 5 58 6 78 7 89 9 15 10 85 11 799 12 55 Here in August (month 8) the variable is 0. bp <- barplot(V[,2], axes = FALSE) axis(1, at = bp, labels=c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"))