Finding Mean and Standard Deviation
The mean and standard deviation of the data plotted by boxplot can be found using the boxmean parameter. It can take two values –
- True for mean
- sd for standard deviation.
Example:
Python3
import plotly.graph_objects as px import numpy as np # creating random data through randomint # function of numpy.random np.random.seed( 42 ) random_x1 = np.random.randint( 1 , 101 , 100 ) random_x2 = np.random.randint( 1 , 101 , 100 ) x = [ 'A' , 'B' , 'C' , 'D' ] plot = px.Figure() plot.add_trace(px.Box(x = random_x1, marker_color = 'indianred' , boxmean = True )) plot.add_trace(px.Box(x = random_x2, marker_color = 'royalblue' , boxmean = 'sd' )) plot.show() |
Output:
Box plot in Plotly using graph_objects class
Plotly is a Python library which is used to design graphs, especially interactive graphs. It can plot various graphs and charts like histogram, barplot, boxplot, spreadplot and many more. It is mainly used in data analysis as well as financial analysis. plotly is an interactive visualization library.