I am working on data presentation and i need to plot boxplot with stacked barplot in parallel.
With colored in different shade colors with proportion of points covering area. How can i plot it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here a generic solution that you can use to add parallel percent box to a lattice bowplot. It computes the exact percent descrbing parts of boxplot (whisker and main part).
The solution is based on the grid package. Viewport manipulation is easier with lattice than ggplot2, that’s why I choose a bwplot.
I generate some sample data:
I catch the main viewport
Then I store the dimensions of whiskers and positions of extremities boxplot positions.
The function drawBox , draw a rectangle with the text in percent. I Call it 3 times for each box.
The function drawbox is called 3 times: