Relative Content

Tag Archive for rplotlyboxplot

colouring lines around plotly box plot

I am creating a grouped boxplot in plotly using predefined quantiles. I want to color the lines around the boxes based on a separate variable. I can’t seem to do this directly in my plotly call. There is a nice solution here which involves changing the line colours as a post-processing step using plotly_build. The example in that link works well but the structure of the data is different when using pre-defined quantiles, and I can’t seem to access the data as in that example. Perhaps there is a way but I can’t figure it out.

plotly grouped barplot: how to specify quartiles but showoutliers

I am creating a grouped boxplot using plotly. I have to specify the quanitles because I have a specific way of calculating them. I also want to add the outliers to the plot as with standard behavior for a boxplot where plotly calculates the quantiles internally. I am currently trying to add them as a separate trace, but they end up in the middle of the grouped boxes. Maybe there is a way of adding them along with the plotly call that adds the grouped boxes, but if there is I cant’t see it. How can I make it so that the outliers line up with the boxes? Reprex below.