Hi all,
I am trying to figure out how to make bar graph out of a matrix. I know there have been many posts about this, but I am struggling to put it all together.
What I want to do:
In the example I have three variables with different sensitivity and specificity plus 95% CI, respectively. How can I show a bar for sensitivity and specificity in pairs/adjacent to each other with CI as error bars. This for each variable in the same diagram, with some space between the two bars for each variable and variable labels beneath the bars (x-axis).
Here is my code, I have tried svmat and svmat2 but I am struggling putting it together from there.
Stata version 16.1

Code:
clear all
sysuse auto
// here I generate binary varibles for later use with "diagt", "price_b_RF" will be the reference standard. The output is of course nonsense...
recode price (0/5006.5=0) (5006.5/16000=1), gen(price_b_RF)
recode mpg (0/20=0) (20/16000=1), gen(mpg_b)
recode headroom (0/3=0) (3/5=1), gen(headroom_b)
recode trunk (0/10=0) (11/20=1), gen(trunk_b)


local test_var mpg_b headroom_b trunk_b
local ntest_var : word count `test_var'

matrix sens_spec = J(`ntest_var', 6, .)
//labeling av columns
matrix colnames sens_spec = sens "(CI  " "95%)" spec "(CI  " "95%)"
//labeling rows
local lable_rownames_diagt

local row = 1
foreach var in `test_var' {
    diagt price_b_RF `var'
    matrix sens_spec[`row', 1] = r(sens)
    matrix sens_spec[`row', 2] = r(sens_lb)
    matrix sens_spec[`row', 3] = r(sens_ub)    
    matrix sens_spec[`row', 4] = r(spec)
    matrix sens_spec[`row', 5] = r(spec_lb)
    matrix sens_spec[`row', 6] = r(spec_ub)
    //labeling av matrix rows
    local lable_rownames_diagt `lable_rownames_diagt' "`var'"
    local ++row
}

matrix rownames sens_spec = `lable_rownames_diagt'

matrix sens_spec_trans = J(6, `ntest_var', .)

matrix sens_spec_trans = sens_spec'

// I do not know which format of the two following is better suited for making a graph afterwards.

matlist sens_spec, format(%5.2f) twidth(10) title(Diagnostic performance)

matlist sens_spec_trans, format(%12.2f) twidth(15) title(Diagnostic performance)
Any help would be much appreciated.