标签: bar-chart

如何在d3中制作多系列条形图?

我有两个显示相同数据的条形图。每个 x 轴标签显示一个条形,它是输出集和输入集的总和。我的另一个需要将每个 x 轴标签的输入和输出数据分成两个相邻的条形。

我想要它的外观: 在此输入图像描述

从我在其他示例中看到的数据被合并到一个数组中,然后成对绘制。我尝试将两组合并为一组,但无法使其工作。

这是我绘制条形的方法:

svg.selectAll(".bar")
                .data(options.series[i].data)
                .enter().append("rect")
                .attr("class", "bar")
                .attr("class", function(d) {
                    if (d < 0) {
                        return "bar positive";
                    } else {
                        return "bar negative";
                    }
                })
                .attr("height", function(d) {
                    return Math.abs(yScale(d) - yScale(0));
                })
                .attr("y", function(d) {
                    if (d > 0) {
                        return yScale(d);
                    } else {
                        return yScale(0);
                    }
                    // return yScale(d)
                })
                .attr("width", (xScale.bandwidth()))
                .attr("x", function(d, j) {
                    return xScale(options.labels[j])
                })
                .on('mouseover', function(d, j){
                    d3.select(this).style("opacity", 0.6);
                    tip.show(d, j);
                })
                .on('mouseout', function(d, j){ …
Run Code Online (Sandbox Code Playgroud)

bar-chart d3.js vue.js

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

创建特殊的径向条形图(赛道图)

我能够在这里复制另一个好的答案来创建一个基本的径向图,但是任何人都可以给我任何其他函数/参数/想法的线索,了解如何将基本函数转换为与此类似的东西: 在此输入图像描述

plot r radial bar-chart ggplot2

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

如何使用 R 将平均值绘制为条形图?

在此输入图像描述

如果我有这样的表格,如何使用 ggplot 制作条形图,其中平均值作为条形的高度,误差条作为 R 中的标准误差?

r bar-chart ggplot2

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

R ggplot 条形图组

我正在学习 ggplot2,我想按原样使用数据框绘制条形图,如果可能的话不进行转换。

数据框:

在此输入图像描述

我想这样绘制它:

在此输入图像描述

谢谢,

r bar-chart ggplot2

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

TypeError: barplot() 采用 0 到 1 个位置参数,但给出了 2 个

有人可以告诉我这里出了什么问题吗

\n
#stemming all the words to their root word\nstemmer = SnowballStemmer(language='english')\nstem=[]\nfor word in lines:\n    stem.append(stemmer.stem(word))\nstem[:20]\n#removes stopwords (very common words in a sentence)\nstem2 = []\nfor word in stem:\n    if word not in nlp.Defaults.stop_words:\n        stem2.append(word)\n#creates a new dataframe for the stem and shows the count of the most used words\ndf = pd.DataFrame(stem2)\ndf=df[0].value_counts()\ndf #shows the new dataframe\n
Run Code Online (Sandbox Code Playgroud)\n

我不知道这里出了什么问题,当我运行这些代码时遇到的错误 \xe2\xac\x87\xe2\xac\x87\xe2\xac\x87

\n
#plots the top 20 used words\ndf = df[:20]\nplt.figure(figsize=(10,5))\nsns.barplot(df.values, df.index, alpha=0.8)\nplt.title('Top Words Overall')\nplt.xlabel('Count of words', fontsize=12)\nplt.ylabel('Word from Tweet', fontsize=12)\nplt.show()\n
Run Code Online (Sandbox Code Playgroud)\n

然后得到这些错误

\n …

python bar-chart seaborn

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

绘制条形图以使用ggplot2包比较两组数据?

构建条形图以比较两组数据的最佳方法是什么?

例如数据集:

Number <- c(1,2,3,4)
Yresult <- c(1233,223,2223,4455)
Xresult <- c(1223,334,4421,0)
nyx <- data.frame(Number, Yresult, Xresult)
Run Code Online (Sandbox Code Playgroud)

我想要的是横跨X的数字和彼此相邻的条形,代表各个X和Y值

r bar-chart ggplot2

-2
推荐指数
1
解决办法
7282
查看次数

ggplot 条形图图例中的项目顺序出现问题

我的数据看起来像

    language    tone        count   tone_percent    label_pos   pos
1   c           positive    3460    36.16977        18.08488    7
2   c           neutral     2046    21.38825        46.86389    7
3   c           negative    4060    42.44198        78.77901    7
4   c#          positive    3732    41.26949        20.63475    3
5   c#          neutral     1832    20.25876        51.39887    3
6   c#          negative    3479    38.47175        80.76413    3
7   c++         positive    3136    33.13960        16.56980    8
8   c++         neutral     2008    21.21949        43.74934    8
9   c++         negative    4319    45.64092        77.17954    8
Run Code Online (Sandbox Code Playgroud)

我一直在尝试使用 ggplot2 条形图将它们可视化:

p <-ggplot() + theme_bw() + geom_bar(aes(y=tone_percent, x=reorder(language, …
Run Code Online (Sandbox Code Playgroud)

r legend bar-chart ggplot2

-2
推荐指数
1
解决办法
2565
查看次数

标签 统计

bar-chart ×7

ggplot2 ×5

r ×5

d3.js ×1

legend ×1

plot ×1

python ×1

radial ×1

seaborn ×1

vue.js ×1