Ciao @Jordan_Hiller , è stato un piacere incontrarti al Discovery Summit 2025 (online)
Un problema di cui soffro ancora:
Come assegnare i colori ai grafici lineari, in particolare quando la linea viene utilizzata in combinazione con lo smoother:
Graph Builder. Come combinare Smoother e Line?

Avrei voluto che questa opzione fosse disponibile in JMP: Graph Builder: Linea - possibilità di aggiungere interruzioni
o questo: Graph Builder - Sovrapposizione di più colonne
Ecco un altro compito interessante, trasferito alla Big Class:
- Voglio applicare il colore a un gran numero di curve.
Quindi, utilizziamo gli studenti della classe numerosa e tracciamo il nome (39 valori!) sull'asse x.
Immagina che le barre siano in realtà grafici lineari di colori diversi.
- Non voglio vedere tutti i dati in una volta, ma "scorrere" i dati - età per età
quindi aggiungiamo un filtro dati per limitare la visualizzazione a un'età specifica
- Il compito: in questa vista, ogni studente (visibile) dovrebbe essere rappresentato da un colore univoco.
Ricorda: il grafico a barre sarà composto da curve complesse. Quindi, non vogliamo due curve dello stesso colore in un grafico.
Possiamo usare il nuovo punteggio col() introdotto in JMP19: Novità in Graph Builder per JMP 19
così utile! - così facile da usare! - un vantaggio enorme!
Ordiniamo gli studenti in base alla fascia d'età in ordine alfabetico
[i primi studenti sono: Jaclyn (età: 12), Alice (età: 13), i secondi: James e Barbara ...]
Questo punteggio può essere utilizzato per assegnare un colore univoco: punteggio diverso - colore diverso.
Ora, se passiamo in rassegna i gruppi di età, vediamo:
nessun colore duplicato in nessuno dei gruppi di età
(in effetti, possiamo usare una scala di colori migliore con colori più distinti : )

Fin qui: fantastico! Ora, affrontiamo il problema.
Per questo grafico, è possibile disattivare la legenda poiché non offre grandi vantaggi: mostra solo il valore della colonna ausiliaria 'punteggio colonna'.
Qui gli studenti sono chiaramente visibili sull'asse x.
Tuttavia, questo è solo un grafico fittizio. In realtà, l'asse x deve essere utilizzato per una variabile continua e, invece di noiosi grafici a barre, abbiamo curve complesse. L'unico modo per identificare gli " studenti " è tramite la legenda.
Quindi, come è possibile trasferire le impostazioni del colore dalla colonna ausiliaria "punteggio colore" alla colonna "nome", in modo che la legenda abbia senso?
Qualsiasi suggerimento o alternativa è ben accetto.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
{uniqueColor} = dt << New Formula Column(
Operation( Category( "Aggregate" ), "Score Unique" ),
Columns( :name ),
Group By( :age )
);
uniqueColor<< set name ("uniqueColor");
Graph Builder(
Variables( X( :name ), Color( :uniqueColor ) ),
Elements( Bar( X, Legend( 3 ) ) ),
Local Data Filter( Add Filter( columns( :age ), Where( :age == 12 ) ) )
);
Ciao Holger, è stato un piacere vederti all'Online Discovery Summit!
Ho un approccio un po' "hacky" che puoi provare per il primo problema: consiste nel suddividere i dati per gruppi. Ho dovuto gestire manualmente i colori, ma non è stato poi così male.

Non ho capito il tuo secondo problema: forse potresti fornire un esempio con le curve in questione, anziché con le barre.
Saluti,
Giordania
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Functional Data/Weekly Weather Data.jmp" );
dt << New Column( "group", Character, "Nominal", Formula( Substr( :STATION, 8, 1 ) ) );
dt << New Column( "DupGroup", Character, "Nominal", Formula( :group ) ) << Run Formulas;
//Split data table
dt2 = dt << Split(
Split By( :group ),
Split( :TAVG ),
Group( :DATE, :STATION ),
Output Table( "SplitByStationDate" ),
Remaining Columns( Keep( :DupGroup ) ),
Sort by Column Property
);
dt2 << Graph Builder(
Size( 636, 564 ),
Show Control Panel( 0 ),
Fit to Window( "Off" ),
Variables(
X( :DATE ),
Y( :"2"n ),
Y( :"3"n, Position( 1 ) ),
Y( :"4"n, Position( 1 ) ),
Overlay( :STATION, Overlay Encoding( "None" ) ),
Color( :DupGroup )
),
Elements(
Line( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 6 ) ),
Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Overlay( 0 ), Color( 0 ), Legend( 7 ) )
),
SendToReport(
Dispatch( {}, "400", ScaleBox,
{Legend Model(
6,
Properties( 0, {Line Color( 21 )}, Item ID( "2", 1 ) ),
Properties( 1, {Line Color( 19 )}, Item ID( "3", 1 ) ),
Properties( 2, {Line Color( 20 )}, Item ID( "4", 1 ) ),
Properties( 3, {Line Color( 19 )}, Item ID( "2 (STATION=USW00003195)", 1 ) ),
Properties( 4, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00003195)", 1 ) ),
Properties( 5, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00003195)", 1 ) ),
Properties( 6, {Line Color( 19 )}, Item ID( "2 (STATION=USW00003868)", 1 ) ),
Properties( 7, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00003868)", 1 ) ),
Properties( 8, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00003868)", 1 ) ),
Properties( 9, {Line Color( 19 )}, Item ID( "2 (STATION=USW00003949)", 1 ) ),
Properties( 10, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00003949)", 1 ) ),
Properties( 11, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00003949)", 1 ) ),
Properties( 12, {Line Color( 21 )}, Item ID( "2 (STATION=USW00012924)", 1 ) ),
Properties( 13, {Line Color( 21 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00012924)", 1 ) ),
Properties( 14, {Line Color( 21 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00012924)", 1 ) ),
Properties( 15, {Line Color( 19 )}, Item ID( "2 (STATION=USW00013733)", 1 ) ),
Properties( 16, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00013733)", 1 ) ),
Properties( 17, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00013733)", 1 ) ),
Properties( 18, {Line Color( 19 )}, Item ID( "2 (STATION=USW00013877)", 1 ) ),
Properties( 19, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00013877)", 1 ) ),
Properties( 20, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00013877)", 1 ) ),
Properties( 21, {Line Color( 20 )}, Item ID( "2 (STATION=USW00014751)", 1 ) ),
Properties( 22, {Line Color( 20 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00014751)", 1 ) ),
Properties( 23, {Line Color( 20 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00014751)", 1 ) ),
Properties( 24, {Line Color( 20 )}, Item ID( "2 (STATION=USW00014922)", 1 ) ),
Properties( 25, {Line Color( 20 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00014922)", 1 ) ),
Properties( 26, {Line Color( 20 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00014922)", 1 ) ),
Properties( 27, {Line Color( 20 )}, Item ID( "2 (STATION=USW00024024)", 1 ) ),
Properties( 28, {Line Color( 20 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00024024)", 1 ) ),
Properties( 29, {Line Color( 20 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00024024)", 1 ) ),
Properties( 30, {Line Color( 20 )}, Item ID( "2 (STATION=USW00024144)", 1 ) ),
Properties( 31, {Line Color( 20 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00024144)", 1 ) ),
Properties( 32, {Line Color( 20 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00024144)", 1 ) ),
Properties( 33, {Line Color( 19 )}, Item ID( "2 (STATION=USW00053182)", 1 ) ),
Properties( 34, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00053182)", 1 ) ),
Properties( 35, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00053182)", 1 ) ),
Properties( 36, {Line Color( 21 )}, Item ID( "2 (STATION=USW00092811)", 1 ) ),
Properties( 37, {Line Color( 21 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00092811)", 1 ) ),
Properties( 38, {Line Color( 21 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00092811)", 1 ) ),
Properties( 39, {Line Color( 19 )}, Item ID( "2 (STATION=USW00093067)", 1 ) ),
Properties( 40, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00093067)", 1 ) ),
Properties( 41, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00093067)", 1 ) ),
Properties( 42, {Line Color( 19 )}, Item ID( "2 (STATION=USW00093242)", 1 ) ),
Properties( 43, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00093242)", 1 ) ),
Properties( 44, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00093242)", 1 ) ),
Properties( 45, {Line Color( 19 )}, Item ID( "2 (STATION=USW00093718)", 1 ) ),
Properties( 46, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00093718)", 1 ) ),
Properties( 47, {Line Color( 19 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00093718)", 1 ) ),
Properties( 48, {Line Color( 20 )}, Item ID( "2 (STATION=USW00094626)", 1 ) ),
Properties( 49, {Line Color( 20 ), Line Style( "Solid" )}, Item ID( "3 (STATION=USW00094626)", 1 ) ),
Properties( 50, {Line Color( 20 ), Line Style( "Solid" )}, Item ID( "4 (STATION=USW00094626)", 1 ) )
), Legend Model(
7,
Type Properties( 0, "H Line", {Line Width( 5 )} ),
Properties( 0, {Line Color( 21 ), Line Width( 5 )}, Item ID( "Smooth(2)", 1 ) ),
Properties( 1, {Line Color( 19 ), Line Width( 5 )}, Item ID( "Smooth(3)", 1 ) ),
Properties( 2, {Line Color( 20 ), Line Width( 5 )}, Item ID( "Smooth(4)", 1 ) )
)}
)
)
);
tramite scripting:
fromCol = Name Expr( :uniqueColor );
toCol = Name Expr( :name );
steal my colors( Name Expr( fromCol ), Name Expr( toCol ) )
<BR />// helper labels to sort the entries in the legend by age (not needed with a data filter)<BR />
students= set unique(:name << get values());
myValueLabels =Transform each({student}, students,
Eval Expr((Expr(student) = Expr(Char(:age[where(dt,:name == student)[1]])||"_"||student)))
);
dt:name << Value Labels( myValueLabels ) << Use Value Labels( 1 );

ruba i miei colori:
steal my colors = Function( {fromCol, toCol}, // fromCol and toCol are "Columns"
//{default local},
write("from column ", Name Expr( fromCol ), "\!n");
write("to ", Name Expr( toCol ) , "\!n");
// Lookup: Name -> UniqueColorID
Eval(
Eval Expr(
Lookup = Current Data Table() << Summary(
Group( Expr( Name Expr( toCol ) ) ),
Mean( Expr( Name Expr( fromCol ) ) ),
statistics column name format( "column" )
)
)
);
// grey values for duplicates (like Robert)
duplicates = As Column( Lookup, 1 )[Where( Lookup, :N Rows > 1 )]; // AsColumn(Lookup,1), not toCol?!? toCol lives in dt !
If(N items(duplicates),ColorsDuplicates = Transform Each( {duplicate}, As List( Index( 1, N Items( duplicates ) ) ),
{255, 255, 255} - duplicate / N Items( duplicates ) * {255, 255, 255}
));
// Lookup: label -> uniqueColorID
AA1 = Associative Array( lookup[0, {1, 3}] ); // 1: label , 3: uniqueColorID
labels = AA1 << get keys;
Close(Lookup, noSave);
// workaround: assign colors to "fromCol" and get them via the column script
// (because I don't know how to get the Nth color from a Color Theme on my own)
Eval(
Eval Expr(
dt << Color or Mark by Column(
Expr( Name Expr( fromCol ) ),
Color Theme( "JMP Blue Red Green" ),
Marker( 0 ),
Continuous Scale( 0 ),
Save To Column Property( 1 )
)
)
);
myScript = fromCol << get script;
// convert colors from a column property
ValueColorsProperty = Extract Expr( myScript, Set Property( "Value Colors", Wild List() ) );
// ... into an Associative Array for the Lookup: uniqueColorID -> color
AA2 = Associative Array( Substitute( Arg( ValueColorsProperty, 2 ), Expr( Assign() ), Expr( List() ) ) );
// for each label, define a color
assignments = Transform Each( {label}, labels,
duplicateID = Contains( duplicates, label );
Eval Expr( // don't execute, just evaluate the left and right part
Expr( label ) = Expr(
If( duplicateID, // duplicate Label? -> grey value
ColorsDuplicates[duplicateID]
,
AA2[AA1[label]]
) // otherwise: look it up via the associative arrays
)
);
);
// assign the settings to the target column
toCol << Set Property( "Value Colors", assignments );
);