Add reference line to Y-group axisHello,
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).
patriciafm811_0-1706640947824.png
BUT, I need to add a reference line for each virus so that it looks like 'example with ref line' (below).
patriciafm811_1-1706641063371.png
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.
Data Exploration and VisualizationWindowsRe: Add reference line to Y-group axisBased on what is the reference line plotted from? How does your data look like?
Re: Add reference line to Y-group axisThe blue and red lines are my data, but I want to add in a CDC line (which is only available for the year and not monthly like my data) as the green line.
Re: Add reference line to Y-group axisDepending on how your data is formatted, you might be able to add it as a separate line graph or you could add reference lines through scripting.
Re: Add reference line to Y-group axisI don't want it as a separate line graph. I just don't know how to do the script for it.
Re: Add reference line to Y-group axisIs there a specific reason for not wanting separate line graph?
Re: Add reference line to Y-group axisIt isn't really a line graph if there is only 1 data point (from the CDC). We just need it as a reference, not part of the actual data.
Re: Add reference line to Y-group axisYou can go the complicated way of using graphic script
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,
Eval(EvalExpr(
fb << Add Graphics Script(
H Line(Expr(lines[idx]));
);
));
);
or easier option of adding new chart
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column("Line", Numeric, Continuous, << Set Each Value(
If(:sex == "M", 65, 60)
));
gb = dt << Graph Builder(
Size(567, 523),
Show Control Panel(0),
Variables(X(:weight), Y(:height), Y(:Line, Position(1)), Group Y(:sex)),
Elements(Points(X, Y(1), Legend(8)), Line(Y(2), Legend(10)))
);Re: Add reference line to Y-group axis...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:
Florian_Vogt_0-1706646632251.png
Best
Florian
Re: Add reference line to Y-group axisYou can add the horizontal line in Graph Builder. Double-click on the Y axis and put a value in to the reference line section.
pmroz_1-1706646913453.png
pmroz_2-1706646934846.png
Re: Add reference line to Y-group axisBut I need to do this for the Y-Group, not the Y-Axis.
Re: Add reference line to Y-group axisNot 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"));
);
jthi_0-1706721139746.png