8 years, 44 days

## Excellent...

I think you misunderstood me by Reversing.

So, using what you did and a bit more, here is the best final result.

 > restart;   with(Logic):   separation:= 1:   logic:= &xor x[1] &xor x[2] &xor x[3]:   TTOrginal:=TruthTable( logic, form=MOD2):   result:= Q:   # Now to Swap order of columns so out Timing Digram looks correct. IE final answer  is at the bottom   TT:= DataFrame(seq(TTOrginal[j],j=upperbound(TTOrginal,2)..1,-1),        columns=ListTools:-Reverse([ColumnLabels(TTOrginal)[1..-2][],result])):   yAxisLabels:= ColumnLabels(TT):   rows:= upperbound( TT, 1 ):   columns:= upperbound( TT, 2):   shift:= 1:  # shift y axis up so that result does not end on the axis line. Looks better and easier to upderst   xAxis:= time:   lineColours:= [red,seq(blue,i=2..columns)]:   plotOptions:= xAxis=0..rows-1, title = cat("Timing Diagram for ", result),titlefont=[times,bold,18],                 color=lineColours,                 tickmarks= [ [],[seq( [i*(1+separation)+shift =0, 1+i*(1+separation)+shift=1][], i=0..columns-1)]],                 axis[1]= [gridlines= [[seq(i=i,i=0..rows)],colour= gray,linestyle= dash]]:   toPW:=M->piecewise(seq( [xAxis
 >

## Getting there...

Thanks for the excellent replies. I was thinking about maually plotting each line!!

Still do not understand the piecewise function yet, but got the following working and reasonably close to what is expected in a Timing diagram.

 > restart;   with(Logic):   TT:=TruthTable( x[1] &xor x[2] &xor x[3] &or x[4], form=MOD2):   TT := SubsColumnLabel(TT, -1, Q):   separation:= 2:   yAxisLabels:= ColumnLabels(TT):   rows:= upperbound( TT, 1 ):   columns:= upperbound( TT, 2):   xAxis:= time:   lineColours:= [seq(blue,i=1..columns-1)]:   lineColours:=[op(lineColours),'red']:   plotOptions:= xAxis=0..rows-1, title = "Timing diagram",titlefont=[times,bold,18],                 color=lineColours,                 tickmarks= [ default,[seq( j= j mod 2, j=0..(rows-1),1)]],                 axis[1]= [gridlines= [[seq(j=j,j=0..rows)],colour= gray,linestyle= dash]]:   toPW:=M->piecewise(seq( [xAxis
 >

How do I reverse the order of the graphs so that x[1] is at the top and Q is at the bottom. I.E reverse the order.

Is my code efficient enough? And also I want separation between graphs to be between 1 and  2 (e.g. 1.5), however I could not get the separation to scale correctly.

Could not get Tabulate to display the Title, even though I could set it. Weird!

Once it it is reasonably sorted, I will request that MapleSoft add a timing graph to the Logic Package. Really it should be there.

Again A massive thanks to both of you.