Hello,
I am using graph builder (JMP 17) and have almost what I need. But I need to add a reference line.
This first image ('example') is what I currently have (I need all 3 viruses in 1 graph with lines and dots for the rates for both years).
BUT, I need to add a reference line for each virus so that it looks like 'example with ref line' (below).
I don't know if it is possible. But essentially, I am trying to get a reference line to show up for each one my y-groups. I can use JSL if someone has something that will work using scripts.
Not sure anymore what lines we are plotting here
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Variables(X(:weight), Y(:height), Group Y(:sex)),
Elements(Points(X, Y, Legend(11)))
);
fbs = Report(gb) << XPath("//FrameBox");
lines = {60, 65};
For Each({fb, idx}, fbs,
fb << Add Line Annotation(Line({478, (192 / (70.76 - 50)) * (70.76 - lines[idx])}, {478 + 42, (192 / (70.76 - 50)) * (70.76 - lines[idx])}), Color("Blue"));
);
Attached is the data file. I only need 2022 and 2023 in the final graph.
This is what it should like (but instead of gray lines, they are green, and actually in there instead of just drawn in manually at a guess). The line for HIV is 12.7, HCV is 1.6, and HBV is 0.6.
I still think it would be better to create new column into your data table with the values and use separate line chart, but here is graphic script version
Names Default To Here(1);
dt = Open("$DOWNLOADS/Stacked Combined CSV files.jmp");
gb = dt << Run Script("PPTA Overall Infection Rates All");
fbs = Report(gb) << XPath("//FrameBox");
lines = {12.7, 1.6, 0.6}; // These must be in correct order (using associative array could be better idea
For Each({fb, idx}, fbs,
Eval(EvalExpr(
fb << Add Graphics Script(
Pen Color("Green");
H Line(Expr(lines[idx]));
);
));
);
I will try this. I don't want to add columns to the existing file.
...and you could do a slightly different version of that by using the "Page" function. That allows you to specify individual Ref lines per Virus. However the visual is not so nice, since it creates 3 different graphs basically:
Best
Florian