 # Matrix with graphic means and horizontal confidence intervals

Hey there,
I need an R command, which creates a table similar to the picture below (this picture was created by hand and does not correspond to any real data).

I have data from several dependent variables (the Big5, each in one column), influenced by different categorial independent variables (each group in one row). Namely I have (already calculated) the mean and the lower and upper border of the confidence interval for each measure.

However now I would like to plot these data in the matrix, so that in each cell there are three points (in a horizontal line): One for the mean and one for the two borders of the confidence interval) as I have demonstrated in the picture.

Does anybody knwo how I can get this in R?

Some kind of horizontal lollipop chart.

Thank you for your answer, but how can I put 3 dots (I have 3 values for each group) in each row?
I know how to put two dots in one row (cleveland dot plot), but is it also possible with three?

You can have multiple geom_point()'s mapped to different aesthetics if you want to. Can you be more specific about what your issue is ?

I want to create a lollipop chart with three dots, which are connected with two lines, but anyway it doesn´t work: I always get a lollipop chart with just two dots.

My data: My syntax:

ggplot(A_al) +
geom_segment( aes(x=x, xend=x, y=value1, yend=value2), color="blue") +
geom_segment( aes(x=x, xend=x, y=value2, yend=value3), color="blue") +
geom_point( aes(x=x, y=value1), color=rgb(0.2,0.7,0.1,0.5), size=3 ) +
geom_point( aes(x=x, y=value2), color=rgb(0.1,0.2,0.7,0.5), size=3 ) +
geom_point( aes(x=x, y=value3), color=rgb(0.7,0.1,0.2,0.5), size=3 ) +
coord_flip()+
theme_ipsum() +
theme(
legend.position = "none",
) +
xlab("") +
ylab("Value of Y")

What am I doing wrong?

I'm sure you shared this image with the best intentions, but perhaps you didnt realise what it implies.
If someone wished to use example data to test code against, they would type it out from your screenshot...

This is very unlikely to happen, and so it reduces the likelihood you will receive the help you desire.
Therefore please see this guide on how to reprex data. Key to this is use of either datapasta, or dput() to share your data `as code`

Ok, sorry.

I have tried it again with simple data, but then I got the warning "Discrete value supplied to continuous scale".

However I didn´t change anything but reducing the number of values and rounding them...

I can't comment, I havent seen it.

I got it. It worked, I have three dots in each row.
Now I just need to do the fine-tuning and then create one chart for each column and connect it all to one table

Can you tell us how you did it?

Actually I used the same syntax I´ve posted above.
Anyway it (getting three dots in each row) worked.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.