Hallo zusammen,
Meine Frage besteht aus zwei Teilen und im Idealfall kann Nummer 1 gelöst werden. Es ist in Ordnung, wenn Sie Nummer 2 nicht herausfinden können. Ich bin für jede Hilfe dankbar!
1. Wie kann ich festlegen, dass eine der Kategorien in jeder Legende die Farbe Schwarz hat und nicht die Standardfarbe, die jmp zuweist?
Beispiel: Machen Sie Chrysler in der ersten Legende zur Farbe Schwarz, in der zweiten zu Stadtauto-Schwarz, in der dritten zu 90 Schwarz, in der vierten zu 2 Schwarz und in der fünften zu Van-Schwarz?
2. Wie kann ich durch eine for-Schleife zu jedem Variabilitätsdiagramm eine Legende hinzufügen? Und ebenso möchte ich, dass es einem bestimmten Muster folgt.
Beispiel: In diesem Fall ist die Legende des D-Airbags die Marke, die Legende der D&P-Airbags das Modell, die manuellen Gurte das Baujahr, die motorisierten Gurte die Türen und die passiven Gurte die Größe.
Variability Chart(
SendToByGroup( {:"D/P"n == "Driver", :Protection == "d airbag"} ),
Y( :Head IC ),
SendToByGroup( {:"D/P"n == "Driver", :Protection == "d airbag"}, Y( :Head IC ) ),
SendToByGroup(
{:"D/P"n == "Driver", :Protection == "d&p airbags"},
Y( :Head IC )
),
SendToByGroup(
{:"D/P"n == "Driver", :Protection == "manual belts"},
Y( :Head IC )
),
SendToByGroup(
{:"D/P"n == "Driver", :Protection == "Motorized belts"},
Y( :Head IC )
),
SendToByGroup(
{:"D/P"n == "Driver", :Protection == "passive belts"},
Y( :Head IC )
),
SendToByGroup(
{:"D/P"n == "Passenger", :Protection == "d airbag"},
Y( :Head IC )
),
SendToByGroup(
{:"D/P"n == "Passenger", :Protection == "d&p airbags"},
Y( :Head IC )
),
SendToByGroup(
{:"D/P"n == "Passenger", :Protection == "manual belts"},
Y( :Head IC )
),
SendToByGroup(
{:"D/P"n == "Passenger", :Protection == "Motorized belts"},
Y( :Head IC )
),
SendToByGroup(
{:"D/P"n == "Passenger", :Protection == "passive belts"},
Y( :Head IC )
),
X( :Make, :Model ),
Show Range Bars( 0 ),
Show Cell Means( 0 ),
Std Dev Chart( 0 ),
Points Jittered( 1 ),
By( :"D/P"n, :Protection ),
SendToByGroup(
{:"D/P"n == "Driver", :Protection == "d airbag"},
SendToReport(
Dispatch(
{"Variability Gauge D/P=Driver, Protection=d airbag",
"Variability Chart for Head IC"},
"Variability Chart",
FrameBox,
{Row Legend(
Make,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
),
SendToByGroup(
{:"D/P"n == "Driver", :Protection == "d&p airbags"},
SendToReport(
Dispatch(
{"Variability Gauge D/P=Driver, Protection=d&p airbags",
"Variability Chart for Head IC"},
"Variability Chart",
FrameBox,
{Row Legend(
Model,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
),
SendToByGroup(
{:"D/P"n == "Driver", :Protection == "manual belts"},
SendToReport(
Dispatch(
{"Variability Gauge D/P=Driver, Protection=manual belts",
"Variability Chart for Head IC"},
"Variability Chart",
FrameBox,
{Row Legend(
Year,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
),
SendToByGroup(
{:"D/P"n == "Driver", :Protection == "Motorized belts"},
SendToReport(
Dispatch(
{"Variability Gauge D/P=Driver, Protection=Motorized belts",
"Variability Chart for Head IC"},
"Variability Chart",
FrameBox,
{Row Legend(
Doors,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
),
SendToByGroup(
{:"D/P"n == "Driver", :Protection == "passive belts"},
SendToReport(
Dispatch(
{"Variability Gauge D/P=Driver, Protection=passive belts",
"Variability Chart for Head IC"},
"Variability Chart",
FrameBox,
{Row Legend(
Size,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
),
SendToByGroup(
{:"D/P"n == "Passenger", :Protection == "d airbag"},
SendToReport(
Dispatch(
{"Variability Gauge D/P=Passenger, Protection=d airbag",
"Variability Chart for Head IC"},
"Variability Chart",
FrameBox,
{Row Legend(
Make,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
),
SendToByGroup(
{:"D/P"n == "Passenger", :Protection == "d&p airbags"},
SendToReport(
Dispatch(
{"Variability Gauge D/P=Passenger, Protection=d&p airbags",
"Variability Chart for Head IC"},
"Variability Chart",
FrameBox,
{Row Legend(
Model,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
),
SendToByGroup(
{:"D/P"n == "Passenger", :Protection == "manual belts"},
SendToReport(
Dispatch(
{"Variability Gauge D/P=Passenger, Protection=manual belts",
"Variability Chart for Head IC"},
"Variability Chart",
FrameBox,
{Row Legend(
Year,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
),
SendToByGroup(
{:"D/P"n == "Passenger", :Protection == "Motorized belts"},
SendToReport(
Dispatch(
{"Variability Gauge D/P=Passenger, Protection=Motorized belts",
"Variability Chart for Head IC"},
"Variability Chart",
FrameBox,
{Row Legend(
Doors,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
),
SendToByGroup(
{:"D/P"n == "Passenger", :Protection == "passive belts"},
SendToReport(
Dispatch(
{"Variability Gauge D/P=Passenger, Protection=passive belts",
"Variability Chart for Head IC"},
"Variability Chart",
FrameBox,
{Row Legend(
Size,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
)
)


Hoffentlich gibt es einfachere Lösungen als diese sehr skriptintensive Lösung, die die Spalteneigenschaft „Wertfarben“ verwendet, aber das könnte Ihnen den Einstieg erleichtern
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Cars.jmp");
aa_protection_legend = Associative Array("Year"); // default value Year as I won't write all of these
aa_protection_legend["d airbag"] = "Make";
aa_protection_legend["d&p airbags"] = "Model";
cols_to_color = Associative Array();
cols_to_color["Make"] = "Chrysler";
cols_to_color["Model"] = "Town Car";
vars = dt << Variability Chart(
SendToByGroup({:"D/P"n == "Driver", :Protection == "d airbag"}),
Y(:Head IC),
SendToByGroup({:"D/P"n == "Driver", :Protection == "d airbag"}, Y(:Head IC)),
SendToByGroup({:"D/P"n == "Driver", :Protection == "d&p airbags"}, Y(:Head IC)),
SendToByGroup({:"D/P"n == "Driver", :Protection == "manual belts"}, Y(:Head IC)),
SendToByGroup({:"D/P"n == "Driver", :Protection == "Motorized belts"}, Y(:Head IC)),
SendToByGroup({:"D/P"n == "Driver", :Protection == "passive belts"}, Y(:Head IC)),
SendToByGroup({:"D/P"n == "Passenger", :Protection == "d airbag"}, Y(:Head IC)),
SendToByGroup({:"D/P"n == "Passenger", :Protection == "d&p airbags"}, Y(:Head IC)),
SendToByGroup({:"D/P"n == "Passenger", :Protection == "manual belts"}, Y(:Head IC)),
SendToByGroup({:"D/P"n == "Passenger", :Protection == "Motorized belts"}, Y(:Head IC)),
SendToByGroup({:"D/P"n == "Passenger", :Protection == "passive belts"}, Y(:Head IC)),
X(:Make, :Model),
Show Range Bars(0),
Show Cell Means(0),
Std Dev Chart(0),
Points Jittered(1),
By(:"D/P"n, :Protection)
);
dt_colors = New Table("colors", New Column("color", Numeric, Ordinal, Values(1::1000)), invisible);
Column(dt_colors, "color") << Set Property("Value Colors", "JMP Default");
colors = Column(dt_colors, "color") << Get Property("Value Colors");
Close(dt_colors, no save);
set_color_property = function({dt, col_name, black_val}, {uniq, color_idx, property_list},
Summarize(dt, uniq = by(eval(col_name)));
color_idx = 1;
property_list = "";
For Each({val}, uniq,
If(val == black_val,
colorval = "\!"" || val || "\!" = 0";
,
colorval = "\!"" || val || "\!" = " || char(Arg(colors[color_idx], 2));
color_idx++;
);
property_list = property_list || colorval || ", ";
);
property_list = "{" ||Regex(property_list, ", $", "", GLOBALREPLACE) ||"}";
Eval(EvalExpr(Column(dt, col_name) << Set Property("Value Colors",
Expr(Parse(property_list))
)));
);
For Each({{key, val}}, cols_to_color,
set_color_property(dt, key, val);
);
For Each({var, idx}, vars,
rep = Report(var);
framebox = rep[Frame Box(1)];
cur_protection = Regex(rep << get title, ".*Protection=(.+)", "\1");
framebox << Row Legend(
Eval(aa_protection_legend[cur_protection]),
Color(1),
Color Theme(""),
Marker(0),
Marker Theme(""),
Continuous Scale(0),
Reverse Scale(0),
Excluded Rows(0)
);
);
