In this article, we will see how we can get the opacity property of the error bar graph in the PyQtGraph module. The PyQtGraph is a graphics and user interface library for Python that provides functionality commonly required in designing and science applications. Its primary goals are to provide fast, interactive graphics for displaying data (plots, video, etc.). Error bars are graphical representations of the variability of data and used on graphs to indicate the error or uncertainty in a reported measurement. They give a general idea of how precise a measurement is, or conversely, how far from the reported value the true value might be. Opacity is the measure of impenetrability to electromagnetic or other kinds of radiation, especially visible light. In radiative transfer, it describes the absorption and scattering of radiation in a medium, such as a plasma, dielectric, shielding material, glass, etc. It can be set with the help of the setOpacity() method.
We can create a plot window and create error bar graph on it with the help of commands given below:
# creating a pyqtgraph plot window plt = pg.plot() # creating a error bar item object error = pg.ErrorBarItem(x=x, y=y, top=top, bottom=bottom, beam=0.5)
In order to do this, we use opacity() method with the error bar item object:
Syntax : error.opacity()
Argument : It takes no argument
Return : It returns float value
Below is the implementation:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course