Friday, October 7, 2022

[FIXED] How to get error bars on barchart PowerBI?

Issue

I want to have such barchart:

Desired bar chart

The error bar on each column should show dispersion (I have it calculated in one of the columns). And top lines show whether there is a significant difference. Right now I have only achieved such graph:

achieved bar chart

I am using simple clustered barchart in PowerBI Desktop. Maybe there is another visual for that or another program which could do it? Maybe Python somehow?


Solution

A mentioned here you can do that with matplotlib from python. Just as an example:

import numpy as np
import pylab as plt

data       = np.array(np.random.rand(1000))
y,binEdges = np.histogram(data,bins=10)
bincenters = 0.5*(binEdges[1:]+binEdges[:-1])
menStd     = np.sqrt(y)
width      = 0.05
plt.bar(bincenters, y, width=width, color='r', yerr=menStd)
plt.show()


Answered By - rikyeah
Answer Checked By - Marilyn (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.