标签: bar-chart

如何更改 Crystal Reports 10 中图表对象的图例文本

如何更改 Crystal Reports 10 中图表对象的图例文本?

我用水晶报表做了一份带有图表的报告。图表显示了那里有多少男性和女性。所以现在男性输入数据库为int= 0,女性输入数据库为int= 1,所以在图表显示的图例中 0 = 226 和 1 = 44,意味着男性 = 226,女性 = 44。我需要制作一个公式,可以将 0 更改为男性,将 1 更改为女性。请看下图:

显示有多少男性和女性的图表

请参阅格式对象我找不到任何显示字符串公式:

格式化对象

charts legend crystal-reports bar-chart highcharts

1
推荐指数
1
解决办法
1万
查看次数

matplotlib 中的“面板条形图”

我想使用 matplotlib 生成这样的图:

“面板条形图”
(来源:peltiertech.com

我的数据位于 pandas DataFrame 中,并且我已经得到了常规的堆叠条形图,但我不知道如何执行每个类别都有自己的 y 轴基线的部分。

理想情况下,我希望所有子图的垂直比例完全相同,并将面板标签移到一侧,以便行之间没有间隙。

matplotlib facet bar-chart pandas

1
推荐指数
1
解决办法
1524
查看次数

使用 ggplot 用不同颜色和标签绘制条形图

我想用不同的颜色绘制条形图。数据是时间序列数据,如下所示:

date          volume         label
2015-02-16    102              1 
2015-02-17    112              1 
2015-02-18    152              2 
2015-02-19    132              1 
2015-02-20    122              1 
2015-02-21    92               3
Run Code Online (Sandbox Code Playgroud)

我想使用 ggplot 将此时间序列数据绘制为条形图。困难的部分是,

1)我想绘制黑色,标签= 1,红色,标签= 2,蓝色,标签= 3

2)我想在每个每日栏的顶部绘制标签“1”、“2”、“3”。

r bar-chart ggplot2

1
推荐指数
1
解决办法
3204
查看次数

如何在 barplot() 中将“names.arg”加粗

我想在 Rnames.arg中将名称参数(例如 )加粗barplot()。例如:

bars <- as.table(c(1,2))
barplot(bars, names.arg = c("MMM", "NNN"), cex.names = 2)
Run Code Online (Sandbox Code Playgroud)

关于如何实现这一目标有什么想法吗?谢谢。

plot r bar-chart

1
推荐指数
1
解决办法
6093
查看次数

使用 ChartJS 在条形图中分页

我正在使用 ChartJS 通过条形图显示一些数据。ChartJs 存在一些问题。当我需要归档大量数据(例如 100 个或更多数据字段)并且它具有持久标签时,它看起来很难看。

如何配置条形图?

这是我的条形图屏幕截图 在此输入图像描述

这是我的小提琴

在上面的例子中,我有 100 个数据文件,我可以对这个条形图进行分页吗?

这是我的代码

var lbl = [];
var dt = [];
for(var i = 1;i<=100;i++){
 lbl.push("this_is_my_lable_name_"+i);
}
for(var i = 1;i<=100;i++){
  dt.push(Math.floor((Math.random() * 100) + 1));
}
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
    type: 'bar',
    data: {
        labels: lbl,
        datasets: [{
            label: '# of Votes',
            data: dt,
            backgroundColor: [
                'rgba(255, 99, 132, 0.2)',
                'rgba(54, 162, 235, 0.2)',
                'rgba(255, 206, 86, 0.2)',
                'rgba(75, 192, 192, 0.2)', …
Run Code Online (Sandbox Code Playgroud)

javascript css jquery bar-chart chart.js

1
推荐指数
1
解决办法
7611
查看次数

如何将计数标签添加到 R ggplot 中的百分比条形图中?

假设我们想要使用 R ggplot 生成一个条形图,显示某个类别变量在另一个类别变量中的百分比。下面是 R 中的一个小数据框和一些代码,用于获得我想要的漂亮的条形图。

MYDATA <- data.frame(Region = c(1, 1, 2, 2, 3, 3, 4, 4, 5, 5),
                     Sex    = c("M", "F", "M", "F", "M", "F", "M", "F", "M", "F"),
                     Count  = c(185, 130, 266, 201, 304, 283, 102, 60, 55, 51))

library(ggplot2)

ggplot(data = MYDATA, aes(x = Region, y = Count, fill = Sex)) + 
       geom_bar(position = "fill", stat = 'identity') + 
       scale_y_continuous(labels = scales::percent) +   
       scale_fill_manual(values = c("Maroon1", "RoyalBlue1")) +
       ggtitle("Figure 1: Sex breakdown by Region") …
Run Code Online (Sandbox Code Playgroud)

r bar-chart ggplot2 geom-bar geom-text

1
推荐指数
1
解决办法
4251
查看次数

有没有办法将来自两个单独堆积条形图的列组合成一个图形?

我想制作一个堆叠条形图,说明按研究类别为每个项目(X 轴)请求和完成了多少研究(Y 轴)。每个项目将有两个堆叠的条形图,一个用于请求的研究,一个用于已完成的研究。

这是我用于数据的示例:

数据

我可以将它分成一组用于要求的研究和一组用于完成的数据,我想出了这个(忽略可笑的颜色和标题):

堆

这是我使用的代码:

data<-read.csv("table56req.csv")
data
library(ggplot2)
ggplot(data=data, aes(x=proj, y=req, fill=cat)) +
  geom_bar(stat="identity", position="stack") + 
  labs(title="Type of Study by Project", x="Project", y="Number of Studies") + 
  theme(plot.title = element_text(size=30,hjust = 0.5)) + 
  theme(panel.background = element_rect(fill = 'white')) + 
  theme(axis.line = element_line(color="black", size = 0.5)) + 
  theme(axis.text.x= element_text(size=10,color = "black")) + 
  theme(axis.text.y = element_text(size=12, color = "black")) + 
  scale_y_continuous(breaks=seq(0,20,5)) + 
  scale_x_discrete(labels=c("Bowersock","Dorena","Holtwood","Jackson","Milford","Nisqually","Smoky Mtn")) + 
  theme(axis.title.x = element_text(face="bold", size=12,vjust=-0.5,hjust=0.5)) + 
  theme(axis.title.y = element_text(face="bold", size=12,vjust=2,hjust=.5)) + 
  scale_fill_discrete(name = "Categories", labels = c("Biota and …
Run Code Online (Sandbox Code Playgroud)

r bar-chart ggplot2

1
推荐指数
1
解决办法
222
查看次数

按降序排列堆叠的条形

我已经成功地在 R 中制作了一个堆叠条形图,其中几个不同类别的百分比加起来为 100%。数据框如下所示:

 sujeito epentese vozeamento teste posicao palavra tipo  ortografia cseguinte
   <chr>   <chr>    <chr>      <chr> <chr>   <chr>   <chr> <chr>      <chr>    
 1 a       1        1          P     L       alpes   ps    ces        d_v      
 2 a       0        1          P     L       crepes  ps    ces        d_v      
 3 a       0        0          P     L       chopes  ps    ces        d_v      
 4 a       1        0          P     L       jipes   ps    ces        d_d      
 5 a       1        0          P     L       naipes  ps    ces        d_d      
 6 a       0        0          P     L       xaropes ps …
Run Code Online (Sandbox Code Playgroud)

r bar-chart ggplot2

1
推荐指数
1
解决办法
146
查看次数

R中的水平条形图

我正在尝试使用unvotes标记为每个问题类别“重要”的投票数的数据来重现水平条形图(如下所示)。问题按频率排序。我尝试了以下但停留在情节如何生成ggplot

柱状图

到目前为止我的方法:

library(dplyr)
library(unvotes)
library(ggplot2)

unique(issues$issue)
issues1 = issues %>% left_join(roll_calls)
issues1 %>%
  mutate(date2 = ymd(date)) %>%
  mutate(year = year(date2)) -> issues1
head(issues1)
Run Code Online (Sandbox Code Playgroud)

输出 dput

> dput(head(issues))
structure(list(rcid = c(77, 9001, 9002, 9003, 9004, 9005), short_name = c("me", 
"me", "me", "me", "me", "me"), issue = c("Palestinian conflict", 
"Palestinian conflict", "Palestinian conflict", "Palestinian conflict", 
"Palestinian conflict", "Palestinian conflict")), row.names = c(NA, 
-6L), class = c("tbl_df", "tbl", "data.frame"))
Run Code Online (Sandbox Code Playgroud)

r bar-chart ggplot2

1
推荐指数
1
解决办法
52
查看次数

如何用两个类别绘制条形图?

我有这样的数据

import pandas as pd
df = pd.DataFrame(
dict(
    week=[1, 1, 2, 2, 3, 3] * 2,
    layout=["classic", "classic", "modern", "modern"] * 3,
    response=["conversion", "exit"] * 6,
    cnt=[26, 23, 45, 34, 55, 44, 53, 27, 28, 25, 30, 34],))
Run Code Online (Sandbox Code Playgroud)

我需要像excel一样使用plotly获得这样的条形图: 在此处输入图片说明

我不能使用两个类别的主要问题。我的代码:

px.bar(
    data_frame=df,
    x='week',
    y='cnt',
    template='plotly_dark',
    color = 'layout'
)
Run Code Online (Sandbox Code Playgroud)

结果: 在此处输入图片说明

但我无法像 excel 示例中那样显示有关“响应”的信息

python plot bar-chart plotly

1
推荐指数
1
解决办法
65
查看次数