Hello R Community,
I am trying to plot item threshold plots in R (psychometrics). The data consists of a matrix, each column is a "threshold" and each row corresponds to an item, or question. The goal is to compare the difference between thresholds and see where the items are located compared to each other.
The plot I need consists of horizontal "bars" made up of intervals. One bar for each row. If there are 3 columns, then there should be 4 intervals. For example, the following data:
Thr1 Thr2 Thr3
1 -0.69 2.63 4.95
2 -3.08 -1.98 0.64
3 -2.79 -0.22 3.14
would result in a graph with three horizontal "bars" (can't think of a better word), each made up of four color-coded intervals. Setting xlim=c(-10,10), the first two interval bars would be:
1 (-10, -0.69) , ( -0.69, 2.63), (2.63, 4.95), (4.95, 10)
2 (-10, -3.08), (-3.08, -1.98), (-1.98, 0.64), (0.64, 10)
These are kind of like horizontal stacked bar plots except that we are not doing a count of data, and these are intervals on the real line.
I tried:
- plot() plotting each line on an integer value. but in that case I don't get bars, just lines with points. I also would like to be able to plot this automatically and not have to do each line separately or with a loop.
- barplot()
- ggplot geom_bar
and was not successful.
Any ideas? Thanks in advance.