bar-chart

Side-by-side bar chart with columns proportional by group (relative frequency bar chart)

[亡魂溺海] 提交于 2020-05-14 12:37:49
问题 The dataset gender <- c('Male', 'Male', 'Male', 'Female', 'Female', 'Female', 'Male', 'Male', 'Male', 'Female', 'Female', 'Female', 'Female', 'Female', 'Male', 'Female', 'Female', 'Male', 'Female', 'Female') answer <- c('Yes', 'No', 'Yes', 'Yes', 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'Yes', 'No', 'No', 'Yes', 'Yes', 'Yes', 'Yes', 'No', 'Yes') df <- data.frame(gender, answer) is biased towards females: df %>% ggplot(aes(gender, fill = gender)) + geom_bar() My task is to build a graph that

Bar chart with rounded corners in Matplotlib?

99封情书 提交于 2020-05-13 06:40:53
问题 How can I create a bar plot with rounded corners, like shown in this image? Can it be done with matplotlib? 回答1: It looks like there's no way to directly add rounded corners to a bar chart. But matplotlib does provide a FancyBboxPatch class a demo of which is available here. So in order to create a plot like shown in the question we could first make a simple horizontal bar chart: import pandas as pd import numpy as np # make up some example data np.random.seed(0) df = pd.DataFrame(np.random

R barplot Y-axis scale too short

左心房为你撑大大i 提交于 2020-05-10 03:43:45
问题 I'm trying to generate a barplot, but the y-axis scale is too short. Here's my code: barplot(as.matrix(dat), log="y", ylim=c(10000,100000000), beside=TRUE, ylab = "Number of reads", col = c("gray","black","white")) It leaves the room for the axis (as per ylim), but doesn't fill in the actual axis. I've been through ?barplot and tried a few things (from googling around I thought xpd = F, yaxs = c(10000,10000000,5) should work, but it didn't). I know it's a minor thing, but it's exactly the

R barplot Y-axis scale too short

筅森魡賤 提交于 2020-05-10 03:42:09
问题 I'm trying to generate a barplot, but the y-axis scale is too short. Here's my code: barplot(as.matrix(dat), log="y", ylim=c(10000,100000000), beside=TRUE, ylab = "Number of reads", col = c("gray","black","white")) It leaves the room for the axis (as per ylim), but doesn't fill in the actual axis. I've been through ?barplot and tried a few things (from googling around I thought xpd = F, yaxs = c(10000,10000000,5) should work, but it didn't). I know it's a minor thing, but it's exactly the

Plot line-chart on the left axis uper the bar-chart on the right axis

£可爱£侵袭症+ 提交于 2020-05-09 04:45:51
问题 In a graph with two y axis, one for a line plot (left) and one for a bar-chart (right), I would like that the bar-chart get under the line chart for a better visibility instead of uper it. As you can see on this picture (I hope you can see it), the bar chart shows the evolution of the precipitation and the different line the evolution of the chlorophyll index, my problem is that the bar-chart overlay the lines and I want the line to be uper. This is my script: figure yyaxis right bar (meteo(:

JavaFX Adding a MouseEvent to a bar inside of a BarChart

非 Y 不嫁゛ 提交于 2020-03-26 06:43:11
问题 So i am trying to create an application that has values on a chart, which shows normally. However i am also trying to add a mouse event that is called when i click on a particular bar of the bar graph. More specifically it updates a status bar with some more detail pulled from the database. Group root = new Group(); String[] years = {"Opened", "Closed", "Still Opened"}; CategoryAxis xAxis = new CategoryAxis(); xAxis.setCategories(FXCollections.observableArrayList(years)); NumberAxis yAxis =

barplot(): Frequency percentages per group

爷,独闯天下 提交于 2020-03-20 07:47:13
问题 I'm trying to make a grouped barplot with frequency (%) on the y-axis and depression_meds (N/Y) on the x-axis, grouped by another variable score (LOW/HIGH). My code so far: meds <- table(data2$depression_meds,data2$score)/sum(table(data2$score)) * 100 bp <- barplot(meds, beside=TRUE, axes=FALSE, xlab="Anti-depression meds use", names=c("No", "Yes"), col=c("azure3", "azure"), ylab="Frequency (%)", ylim=c(0,100)) axis(2, at=seq(0,100,10)) legend("topright", legend=c("LOW", "HIGH"), bty="n",

How to make rectangle in chart.js

余生颓废 提交于 2020-03-05 05:24:05
问题 I am trying to put rectangle to make a upper-lower range/level in chart.js, like in image Although I am able to make it by drawing two line in this example var ctx = document.querySelector("#myChart").getContext('2d'); Chart.pluginService.register({ afterDraw: function(chart) { if (typeof chart.config.options.lineAt != 'undefined') { var lineAt = chart.config.options.lineAt; var ctxPlugin = chart.chart.ctx; var xAxe = chart.scales[chart.config.options.scales.xAxes[0].id]; ctxPlugin

How to make rectangle in chart.js

我的未来我决定 提交于 2020-03-05 05:23:06
问题 I am trying to put rectangle to make a upper-lower range/level in chart.js, like in image Although I am able to make it by drawing two line in this example var ctx = document.querySelector("#myChart").getContext('2d'); Chart.pluginService.register({ afterDraw: function(chart) { if (typeof chart.config.options.lineAt != 'undefined') { var lineAt = chart.config.options.lineAt; var ctxPlugin = chart.chart.ctx; var xAxe = chart.scales[chart.config.options.scales.xAxes[0].id]; ctxPlugin

How to add a separator in D3 bar chart D3V3

让人想犯罪 __ 提交于 2020-03-05 03:56:35
问题 I'm having a bar chart in my application which was drawn using D3V3. The sample code has been added below. In my chart, it shows months in a 12 months time period. So depending on the situation, December doesn't always come to the corner of the x-axis. So to show the separation of the year I want to show a separator in the chart to separate two years. Is there a way that can be done. Following is an image of my requirement. Does anyone know how to do this? I found a solution for this for D3V4