Plotten Sie eine Spalte gegen alle anderen<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Ich habe eine Variable, die die Anzahl der Spalten Y anzeigt.
Ich möchte x gegen alle Y plotten.
Zum Beispiel ist die erste Spalte x und A = 6 zeigt, dass wir nach x 6 Y-Spalten haben.
Wie erstelle ich ein Overlay-Plot?
so etwas wie:
X ( : Entfernung ) .
Y ( ( : Säule 3) :: Spalte (char (A))); hahaha
Vielen Dank
Re: Zeichne eine Kolonne gegen alle anderenDie Komplexität von Graph Builder bedeutet unweigerlich, dass es für Skripte etwas komplexer ist. Hier ist ein Weg. Ich bin zuversichtlich, dass es noch viele andere gibt.
NamesDefaultToHere ( 1 ) ;
// Machen Sie einige Demo-Daten
dt = NewTable ( "Daten" .
NewColumn ( "y1" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
NewColumn ( "y2" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
NewColumn ( "x" . Numerisch . Kontinuierlich . Formel ( RandomInteger ( 1 . 20 ))) .
NewColumn ( "y3" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
NewColumn ( "y4" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
Zeilen hinzufügen ( 10 )
) ;
// Zeichne jede Spalte in dt nicht "x" gegen "x"
Cols = dt << getColumnNames ( "String" ) ;
Entfernen von ( Cols . Loc ( Cols . "x" ) [ 1 ]) ;
// Erstellen Sie einen Ausdruck der Variablen, die Graph Builder verwenden soll
varExpr = Ausdruck ( Variablen ( X ( : x ) ) ) ;
Zum ( ich = 1 . ich <= NItems ( Cols ) . ich ++
ob ( ich == 1 .
Einfügen in ( varExpr . Parse ( EvalInsert ( "Y (: ^ Cols) ^) " ))) .
Einfügen in ( varExpr . Parse ( EvalInsert ( "Y (: ^ Cols) ^, Position (1)) )))
) ;
) ;
// Graph Builder-Ausdruck. . .
doGB = Ausdruck ( dt << Graph Builder ( varTBD )) ;
//. . . Fügen Sie die Variablen in diese ein
SubstituteInto ( doGB . Ausdruck ( varTBD ) . EvalExpr ( varExpr )) ;
// Erstellen Sie das Diagramm
doGB ;
Re: Zeichne eine Kolonne gegen alle anderenDanke Lou; Das Problem ist, ich habe keinen Namen von Spalten. Ian Trick ist großartig, um "Spaltennamen holen" zu verwenden. aber ich muss es in Graph Builder verwenden.
also kann ich nicht verwenden:
Y ( : y1 ) .
Y ( : y2 . Position ( 1 ) ) .
Y ( : y3 . Position ( 1 ) ) .
Y ( : y4 . Position ( 1 ) )
großartiger Weg:
Cols = dt << getColumnNames ( "String" ) ;
Entfernen von ( Cols . Loc ( Cols . "x" ) [ 1 ]) ;
dt << Überlagerungsplot ( X ( : x ) . Y ( Eval ( Cols ) ) . Punkte verbinden ( 1 ) ) ;
Re: Zeichne eine Kolonne gegen alle anderenFunktioniert das?
// Machen Sie einige Demo-Daten
dt = NewTable ( "Daten" .
NewColumn ( "y1" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
NewColumn ( "y2" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
NewColumn ( "x" . Numerisch . Kontinuierlich . Formel ( RandomInteger ( 1 . 20 ))) .
NewColumn ( "y3" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
NewColumn ( "y4" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
Zeilen hinzufügen ( 10 )
) ;
Graph Builder (
Größe ( 534 . 454 ) .
Systemsteuerung anzeigen ( 0 ) .
Variablen (
X ( : x ) .
Y ( : y1 ) .
Y ( : y2 . Position ( 1 ) ) .
Y ( : y3 . Position ( 1 ) ) .
Y ( : y4 . Position ( 1 ) )
) .
Elemente ( Linie ( X . Y ( 1 ) . Y ( 2 ) . Y ( 3 ) . Y ( 4 ) . Legende ( 51 ) ) )
) ;
Re: Zeichne eine Kolonne gegen alle anderenDanke vielmals; es läuft gut.
Wie wäre es mit dem Graph Builder?
Wenn ich den Graph Builder anstelle des Überlagerungsplots verwende, kann er "eval (cols)" nicht erkennen.
Gibt es eine Möglichkeit, dasselbe Konzept im Graph Builder zu verwenden?
Re: Zeichne eine Kolonne gegen alle anderenWenn ich es richtig verstanden habe, sollte so etwas tun:
NamesDefaultToHere ( 1 ) ;
// Machen Sie einige Demo-Daten
dt = NewTable ( "Daten" .
NewColumn ( "y1" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
NewColumn ( "y2" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
NewColumn ( "x" . Numerisch . Kontinuierlich . Formel ( RandomInteger ( 1 . 20 ))) .
NewColumn ( "y3" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
NewColumn ( "y4" . Numerisch . Kontinuierlich . Formel ( RandomNormal ())) .
Zeilen hinzufügen ( 10 )
) ;
// Zeichne jede Spalte in dt nicht "x" gegen "x"
Cols = dt << getColumnNames ( "String" ) ;
Entfernen von ( Cols . Loc ( Cols . "x" ) [ 1 ]) ;
dt << Überlagerungsplot ( X ( : x ) . Y ( Eval ( Cols ) ) . Punkte verbinden ( 1 ) ) ;