After a previous question (Block diagram layout with dot/Graphviz) I have further questions. The following is compiled like so:
dot -Gsplines=none test.gv | neato -n -Gsplines=ortho -Tpng -otest.png
digraph G {
graph [rankdir = LR];
node[shape=record, style=filled];
bar[label="Bar", height=1.3636363636363635];
tea[label="Tea", height=1.3636363636363635];
brew[label="Brew", height=3.6363636363636362];
bar1[label="Bar1", height=2.2727272727272725];
baz[label="Baz", height=1];
foo[label="Foo", height=5.0];
darjeeling[label="Darjeeling", height=3.1818181818181817];
example[label="Example", height=17.727272727272727];
bar -> example [label="bar_clk"];
bar -> example [label="bar_bar"];
example -> tea [label="bli1"];
example -> tea [label="blo2"];
example -> tea [label="blo3"];
example -> brew [label="bli"];
example -> brew [label="blo"];
example -> brew [label="blo"];
example -> brew [label="blo"];
example -> brew [label="blo"];
example -> brew [label="blo"];
example -> brew [label="blo"];
example -> brew [label="blo"];
bar1 -> example [label="bar1_foo"];
bar1 -> example [label="bar1_bar"];
bar1 -> example [label="bar1_baz"];
bar1 -> example [label="bar1_baz1"];
bar1 -> example [label="bar1_bar2"];
baz -> example [label="baz_foo"];
example -> foo [label="bla"];
example -> foo [label="bla"];
example -> foo [label="bla"];
example -> foo [label="bla"];
example -> foo [label="bla"];
example -> foo [label="bla"];
example -> foo [label="bla"];
example -> foo [label="bla"];
example -> foo [label="bla"];
example -> foo [label="bla"];
example -> foo [label="bla"];
example -> bar [label="blu"];
example -> baz [label="ble"];
darjeeling -> example [label="darjeeling_bli1"];
darjeeling -> example [label="darjeeling_blo2"];
darjeeling -> example [label="darjeeling_blo3"];
darjeeling -> example [label="darjeeling_bli1"];
darjeeling -> example [label="darjeeling_blo2"];
example -> darjeeling [label="bla"];
darjeeling -> example [label="darjeeling_blo3"];
}
My question is how I could take the, say, Baz and Darjeeling nodes and move them to the left side to decrease the height of the middle node. I don't know what determines this. I understand this is a directional graph, so the general "flow" of the diagram is left to right, I'd just like more control.
These diagrams will be generated automatically, so an explanation on how to lay it out as I wish and why, as opposed to a code snippet that makes it work for this particular example, is preferred.
A couple of points:
how I could take the, say, Baz and Darjeeling nodes and move them to the left side
By setting constraint=false for the edges going from Example to Baz and Darjeeling, or by grouping all the nodes to appear left of Example in a subgraph with rank=min.
You may say that this is not a suitable solution (at least not the one with constraint=false) because
These diagrams will be generated automatically
and I completely understand (been there many times) - but at the same time, you wish
to decrease the height of the middle node
which is set manually, so the graph still is not fully auto-generated (how do you calculate the height needed for Example?).
I don't know what determines this
I'm not completely sure neither - Baz could might as well be on the left.
Surprisingly, the order of appearance of the nodes changes the layout in some cases. For example, if you move up the definition of the Darjeeling node, it will appear on the left side (and Bar gets to be at the right side).
Edit: Here comes the code snippet...
A third possibility is to define all edges in the right order (top-down/left-right) and decorate the edges going back with dir=back.
If you change these 3 lines
example -> bar [label="blu"];
example -> baz [label="ble"];
example -> darjeeling [label="bla"];
into
bar -> example [label="blu", dir=back];
baz -> example [label="ble", dir=back];
darjeeling -> example [label="bla", dir=back];
or into
example -> bar [label="blu", constraint=false];
example -> baz [label="ble", constraint=false];
example -> darjeeling [label="bla", constraint=false];
(and change the height of example)
You'll get
Related
I'm trying to create a state chart from Graphviz of type record. Please check the reference here.
So here is the basic code:
digraph lamp {
node [shape=point,label=""]ENTRY
node [style=rounded shape=record ]
ON [label="{On| Some code here}"];
OFF [label="{Off| Some code here}"];
ENTRY -> ON[label="Initialization"]
ON -> OFF[label="|toggle|"]
OFF -> ON[label="|toggle|"]
}
In above code, I need to add some code below the state name like On and Off where I put the line Some code here. Since there will be a code and it can be any number of lines, I like to change the font size of this single record block where I will put the code (Not the state name record).
So in this line of code:
ON [label="{On| Some code here}"];
I like to change the font size of Some code here only not of On.
So, How can I get the control to independently change styling like font size or font name etc of the entered code here?
You can use html-like text, without building tables. (https://www.graphviz.org/doc/info/shapes.html#html). Like so:
digraph lamp {
node [shape=point,label=""]ENTRY
node [style=rounded shape=record ]
ON [label=<{<FONT COLOR="RED" POINT-SIZE="24.0">On</FONT>|<FONT COLOR="darkgreen" POINT-SIZE="10.0"> Some code here</FONT>}>];
OFF [label=<{<FONT COLOR="black" POINT-SIZE="24.0">Off</FONT>|<FONT COLOR="darkred" POINT-SIZE="10.0"> Some code here</FONT>}>];
ENTRY -> ON[label="Initialization"]
ON -> OFF[label=" |toggle| "]
OFF -> ON[label=" |toggle| "]
}
Giving:
I'm plotting a graph in dot. In order to make it legible I need to fine-tune the placement of the edge labels, as well as (if possible) making certain edges straight while others are curved. I would appreciate general advice on how to accomplish these things in dot, but for the sake of concreteness I include my specific problem below.
Here is the code, followed by what it currently looks like:
digraph myGraph {
rankdir=BT;
splines=line;
"AB.BC" -> "AB.AC.BC" [weight=4]
"AB.BC" -> "ABC" [color=red,style=dashed,label="I(A;C|B)"]
"A.B.C" -> "A.BC" [color=red, label="I(B;C)"]
"A.B.C" -> "AC.B" [color=red, label="I(A;C)"]
"A.B.C" -> "AB.C" [color=red, label="I(A;B)"]
"A.BC" -> "AB.BC" [color=red, label="I(A;B)"]
"A.BC" -> "AC.BC" [color=red, label="I(A;C)"]
"AB.AC.BC" -> "ABC" [weight=4]
"AC.B" -> "AC.BC" [color=red, label="I(B;C)"]
"AC.B" -> "AB.AC" [color=red, label="I(A;B)"]
"AC.BC" -> "AB.AC.BC" [weight=4]
"AC.BC" -> "ABC" [color=red,style=dashed, label="I(A;B|C)"]
"AB.AC" -> "AB.AC.BC" [weight=4]
"AB.AC" -> "ABC" [color=red,style=dashed, label="I(B;C|A)"]
"AB.C" -> "AB.BC" [color=red, label="I(A;B)"]
"AB.C" -> "AB.AC" [color=red, label="I(A;C)"]
}
This is close to what I want, but it has a few problems:
The labels are placed in such a way that you can't easily see which one is associated with which edge
For some reason, some of the edges have a bend in them at the label. (They came out as straight lines before I added the labels.)
I've tried playing with the rowsep and nodesep attributes but wasn't able to improve it. If I remove the splines=line line it becomes legible but isn't really what I want:
It's fine for the dotted edges to be curved -- it's actually good, because it will prevent them from overlapping the second node from the top -- but the solid ones really should be straight.
I'd like any advice on how to fine tune node, edge and label placement (as the documentation is really unhelpful and good examples are hard to find), but specifically, my questions are:
Can I tell dot to make specific edges curved while keeping others straight? (I know there is a splineType edge attribute, but the documentation doesn't give me a clue how to use it and I'm not even sure this is what it does.)
If the above is not possible, how can I tell dot to make the straight lines dead straight, rather than bending at the label?
For straight edges, how can I fine tune the placement of the labels? I don't mind doing it by hand, and there seem to be several edge attributes that should help me do that, but none of them seem to have any effect whatsoever, so I must be doing something wrong.
As a bonus question: is there a way that I can give the nodes a more grid-like layout, so that they're nicely vertically aligned?
Any answer is appreciated, but most especially helpful would be answers that explain how to handle these issues more generally, for the sake of future visitors, rather than just fixing my code.
If you use the neato layout engine, you can set the nodes explicit coordinates with attribute pos="x,y". In dot layout engine this is possible by using {rank=same; node1; node2; ...} for vertical alignment and group attribute (node1[group=g1]; node3[group=g1];) for horizontal alignment.
The position of the labels can be changed using the attributes headlabel and taillabel.
Image:
Script:
digraph myGraph {
layout=neato
splines=true
rankdir=BT
node [pin=true]
"A.B.C" [pos="0,0"]
"AC.B" [pos="0,2"]
"A.BC" [pos="-2,2"]
"AB.C" [pos="2,2"]
"AC.BC" [pos="-2,4"]
"AB.BC" [pos="0,4"]
"AB.AC" [pos="2,4"]
"AB.AC.BC" [pos="0,6"]
"ABC" [pos="0,8"]
"AB.BC" -> "AB.AC.BC"
"AB.BC" -> "ABC" [color=red,style=dashed,taillabel="I(A;C|B)"]
"A.B.C" -> "A.BC" [color=red, label="I(B;C)"]
"A.B.C" -> "AC.B" [color=red, label="I(A;C)"]
"A.B.C" -> "AB.C" [color=red, label="I(A;B)"]
"A.BC" -> "AB.BC" [color=red, taillabel="I(A;B)"]
"A.BC" -> "AC.BC" [color=red, taillabel="I(A;C)"]
"AB.AC.BC" -> "ABC"
"AC.B" -> "AC.BC" [color=red, taillabel="I(B;C)"]
"AC.B" -> "AB.AC" [color=red, taillabel="I(A;B)"]
"AC.BC" -> "AB.AC.BC"
"AC.BC" -> "ABC" [color=red,style=dashed, label="I(A;B|C)"]
"AB.AC" -> "AB.AC.BC"
"AB.AC" -> "ABC" [color=red,style=dashed, label="I(B;C|A)"]
"AB.C" -> "AB.BC" [color=red, taillabel="I(A;B)"]
"AB.C" -> "AB.AC" [color=red, taillabel="I(A;C)"]
}
I am using M 8.0.4.
I am use TableView in demo Manipulate[] to display final solution data, which is a matrix of numerical data.
TableView is very nice to use, since it comes with an automatic scroll bars to move down the rows and to the right over the columns, so that one can see the whole matrix, while keeping the overall display area fixed. (I have an image at the bottom)
The problem that I am not able to find a solution for, is that I need to format the matrix data, so that it looks nice. Otherwise, if the a data element is too large to fit in a cell, it will wrap around, making the TableView misaligned. I also need to adjust decimal point an such other formatting.
I can't apply NumberForm nor AccountForm to the data, and then apply TableView on the result, because TableView does not like to see those wrappers, it needs the numbers.
But if apply the AccountingForm to the TableView, then the numbers that represent the row numbers and column numbers, which are added by TableView automatically, get formatted as well. And I do not want those formatted as well. A row number should remain an integer, not floating point. I just want the data itself formatted.
I could not figure how to format the data from inside Table view. When I use FullForm to see how the data is kept inside TableView, I could not figure how to format it without breaking TableView.
I'll show the problem, then show what I tried.
(* make up some data, and make a TableView of it *)
data = {{-1234.8, 0.123}, {0.12345678, 0.1234}}
tbl = TableView[data, ItemSize -> {{3, {8}}}, DefaultBaseStyle -> 11,
Spacings -> {.2, .1}, FrameStyle -> Gray]
Notice the row numbers and columns number (marked) are positive integers.
Now, I wanted to format the data itself, (the exact formatting options used below is just an example)
AccountingForm[tbl, {6, 3}, NumberSigns -> {"-", "+"},
NumberPadding -> {"", ""}, SignPadding -> True]
But now the Table rows and columns are also formatted:
The FullForm of TableView is:
In[156]:= FullForm[tbl]
TableView[List[List[-1234.8`,0.123`],List[0.12345678`,0.1234`]],
Rule[ItemSize,List[List[3,List[8]]]],
Rule[DefaultBaseStyle,11],Rule[Spacings,List[0.2`,0.1`]],
Rule[FrameStyle,GrayLevel[0.5`]]]
So the data in TableView can be pulled out using
In[166]:= tbl[[1]]
Out[166]= {{-1234.8,0.123},{0.12345678,0.1234}}
But when I change tbl[[1]], using ReplacePart[], with an AccountingForm version of the data, TableView no longer works:
formattedData =
AccountingForm[data, {6, 3}, NumberSigns -> {"-", "+"},
NumberPadding -> {"", "0"}, SignPadding -> True];
In[245]:= tbl=ReplacePart[tbl,1->formatted]
Out[245]= TableView[{{-1234.8,+0.123},{+0.123,+0.123}},
ItemSize->{{3,{8}}},DefaultBaseStyle->11,Spacings->{0.2,0.1},
FrameStyle->GrayLevel[0.5]]
So, I broke TableView. Since it does not display any more.
Question is: How to format numeric data that goes into TableView without affecting the row/column index values?
Fyi, this is how the TableView looks inside one Manipulate demo I have. Notice the automatics scroll-bars. (In this one, I am not using NumberForm and its friends to do the formatting. But what I did is not very efficient, I'd rather use NumberForm if I can, hence my question)
thanks
update 12/22/11 1:30 AM
Here is a complete code example for Mike to follow up on his answer below
data = {{-1234.8, 0.123}, {0.12345678, 0.1234}};
newData =
Map[AccountingForm[#, {6, 3}, NumberSigns -> {"-", "+"},
NumberPadding -> {"", ""}, SignPadding -> True] &, data, {2}];
tbl = TableView[newData, ItemSize -> {{3, {8}}}, Spacings -> {.2, .1},
FrameStyle -> Gray]
Now how exactly do I use the Cell command for the above? (This is in Manipulate, not a notebook session, Manipulate runs all in one cell. I can't make separate cells and such in this code. But for trying it, I can in a new notebook, but the actual code that will use this solution, has to run in a Manipulate with no Cells.
Update 12/22/11 5 am
I am noticing some not good performance of TableView. Consider this code
Remove["Global`*"];
ClearSystemCache[]
m1 = MemoryInUse[$FrontEnd];
N[m1/10^6]
n = 256;
data = Table[RandomReal[], {n}, {n}];
TableView[data, ContentSize -> {300, 300}]
m2 = MemoryInUse[$FrontEnd] - m1;
N[m2/10^6]
The data itself, assuming double for the reals, is about half MB only. ByteCount says
2 MB due to other bookkeeping data struct.
In[114]:= ByteCount[data]/10^6//N
Out[114]= 2.10948
But Front end seems to use much more RAM (for the whole TableView I mean not just the data), sometimes I get 20 MB and sometimes much more (got 100 MB at one time). But if you try the above on your computer, you'll notice M is having hard time with this. I think it might be the rendering of the table part that causes M to take so much time.
I do not think 256 by 256 is such a large matrix. Even with 128 by 128, it was having hard time to render it on the screen. Once it is up, then it is fast and no problem using it.
It looks like TableView is not yet optimized well. I think I will only use it to display small part of the solution Matrix as the performance is not good to use it in a demo to display the whole solution, it will make the demo look bad.
The problem is that my solution matrix can be large, and I wanted a away to display the data in limited amount of GUI space. TableView is all what I can find that comes with scrollbars build-in. Nothing else in the Manipulate controls has something like this to use, so I have to use TableView.
Update 12/22/11 4 PM
Thanks for the hint by Mike below, I am now looking at using Pane with Scollbars, and it is working better than TableView. (still little slow with large data, but not as bad as TableView)
Here is a code example of doing that:
n = 32;
data = Table[RandomReal[], {n}, {n}];
grid = Grid[data, Spacings -> {.4, .4}, Alignment -> Left, Frame -> All];
grid = Style[NumberForm[grid, {6, 5}], LineBreakWithin -> False];
pane = Pane[grid, ImageSize -> {200}, Scrollbars -> True]
Only problem I noticed so far is that when n gets large, Pane generates this outer frame saying very large output was generated. But I am sure there is a programmatic way (option somewhere) to turn that effect off, I just started looking at this and should be able to find a way around this once I have my coffee. (fingers crossed)
good news
The "Very large output was generated" ONLY showed up when in notebook interface. When I put the code in a Manipulate and and run it, it did not show this output frame. So, I am happy now and this issue is closed. I'll use Pane from now on. (Thanks again to Mike)
btw, to remove the message in question, here is a useful link I found:
http://forums.wolfram.com/mathgroup/archive/2009/Apr/msg00935.html
but I did not need to do anything for what I am doing.
I guess this is a different enough method to post as another answer, though it clearly borrows from Mike's answer.
f = ToString #
AccountingForm[#, {6, 3}, NumberSigns -> {"-", "+"},
NumberPadding -> {"", ""}, SignPadding -> True] &;
data = {{-1234.8, 0.123}, {0.12345678, 0.1234}};
TableView[Map[f, data, {2}], ItemSize -> {{3, {8}}},
DefaultBaseStyle -> 11, Spacings -> {.2, .1}, FrameStyle -> Gray]
Since using ToString was non-intuitive, I decided to explore it a bit more. It seems that TableView suppresses quotation marks in strings, but only bare strings. e.g.:
string = "\"\"\"test\"";
TableView[{{ string }}]
TableView[{{ {string} }}]
Other interesting behavior can be seen with 2D formatted strings:
string = "\!\(\*SuperscriptBox[SqrtBox[\"5\"], \"2\"]\)";
TableView[{{ string }}]
TableView[{{ {string} }}]
One suggestion:
Firstly make each element in your data into AccountingForm, or whatever Form you want:
f = AccountingForm[#, {6, 3}, NumberSigns -> {"-", "+"},
NumberPadding -> {"", ""}, SignPadding -> True] &
newdata = {f[#[[1]]], f[#[[2]]]} & /# data
Note that I've had a bit of a brain fade doing this. I'm sure there is an easier way than Mapping (Edit: the brain fade made me forget levelspec). This will give you output like this:
The problem of course is that you now have string characters showing and "conventional" attempts to switch this off failed ("conventional" == options inspector, Style[] etc.). But you can fix this by modifying two styles that exist in the Core.nb stylesheet. So you will need to edit the private styles in your current notebook -- and also remove DefaultBaseStyle from your code because it will cause conflicts with the stylesheet style. So Format > Edit Stylesheet and add this style:
Cell[StyleData["TableViewItemExpression"],
ShowStringCharacters->False,
TemplateBoxOptions->{DisplayFunction->(StyleBox[#, Deployed -> False]& )}]
Actually that is really all you need to do but if you subsequently wanted to do some additional styling of the numbers then you need to modify a different style. Here is an example making the numbers red:
Cell[StyleData["TableViewGrid"],
ContextMenu->FEPrivate`FrontEndResource["ContextMenus", "TableView"],
ShowAutoStyles->False,
AutoSpacing->False,
ShowStringCharacters->False,
AutoNumberFormatting->True,
LineIndent->0,
FontWeight->"Plain",
FontColor->RGBColor[1, 0, 0]]
And this is what it looks like:
I have modified my notebook's stylesheet to include a StyleData["Todo"] that inherits from StyleData["Item"]. It changes the cell dingbat to a checkbox. In the stylesheet editor:
Cell[StyleData["ToDo", StyleDefinitions -> StyleData["Item"]],
CellDingbat->DynamicModuleBox[{$CellContext`color$$},
CheckboxBox[
Dynamic[$CellContext`color$$], {RGBColor[1, 0.5, 0],RGBColor[0,Rational[2, 3], 0]},
Background -> Dynamic[$CellContext`color$$]],
DynamicModuleValues :> {}
],
]
The problem is that the state of the checkbox, when used in a notebook, is not saved between Mathematica sessions. I thought the DynamicModule[] would do the trick. How do I get the checkbox to remember its state?
EDIT
Simon's solution does save the state of the checkbox, but the checkbox is clipped when used as a CellDingbat (MacOS X). Putting Simon's code in a CellFrameLabels options does the trick, and also keeps the default "Item" CellDingbat. Here is what I've gone with:
Cell[StyleData["ToDo", StyleDefinitions -> StyleData["Item"]],
CellFrameLabels->{{
ButtonBox[
CheckboxBox[False], ButtonFunction :> (SelectionMove[
ButtonNotebook[], All, ButtonCell];
With[{$CellContext`new = ReplaceAll[
Options[
NotebookSelection[
ButtonNotebook[]], CellFrameLabels], CheckboxBox[
Pattern[$CellContext`x,
Alternatives[True, False]]] :> CheckboxBox[
Not[$CellContext`x]]]},
SetOptions[
NotebookSelection[
ButtonNotebook[]], $CellContext`new]]; SelectionMove[
ButtonNotebook[], After, CellContents]), Appearance -> None,
Method -> "Preemptive", Evaluator -> Automatic], None}, {
None, None}},
MenuSortingValue->1621]
The problem with your code (I think) is that a new DynamicModule does not get created each time you create a new "ToDo" cell. So there is nowhere that the state of each Checkbox can get saved.
The simplest solution I could think of for storing the state of the Checkbox for each "ToDo" cell is to overwrite the CellDingbat the first time that the Checkbox is activated.
(Other options I played with were using TaggingRules,
toggling between "ToDo" and "ToDone" styles, etc...)
However, even a plain Checkbox in a CellDingbat does not store its state - try running the following then cycle the output through a Show Expression cycle.
CellPrint[Cell["test", "Text", CellDingbat -> ToBoxes[Checkbox[]]]]
To get around this, I used Checkbox with the definite argument True or False wrapped up in a button that changes the state. This is stupid and inefficient, but it works!
So, my code for the cell style
Cell[StyleData["ToDo", StyleDefinitions -> StyleData["Item"]],
CellDingbat -> ButtonBox[CheckboxBox[False],
ButtonFunction :> (SelectionMove[ButtonNotebook[], All, ButtonCell];
With[{$CellContext`new = ReplaceAll[
Options[NotebookSelection[ButtonNotebook[]], CellDingbat],
CheckboxBox[Pattern[$CellContext`x, Alternatives[True, False]]] :> CheckboxBox[Not[$CellContext`x]]]},
SetOptions[NotebookSelection[ButtonNotebook[]], $CellContext`new]];
SelectionMove[ButtonNotebook[], After, CellContents]),
Appearance -> None, Method -> "Preemptive", Evaluator -> Automatic]]
I'm not happy with this solution, but it's the best I've come up with. An improvement would be to move the button function code out of the cell so that it is not repeated for every checked ToDo cell. Also to make it run without a ReplaceAll so that the kernel is not needed and the function can be run using just the frontend.
By default Notebook[] has a small set of Options:
In[4]:= Options[EvaluationNotebook[]]
Out[4]= {FrontEndVersion ->
"7.0 for Microsoft Windows (32-bit) (February 18, 2009)",
StyleDefinitions -> "Default.nb",
WindowMargins -> {{0, Automatic}, {Automatic, 0}},
WindowSize -> {616, 537}}
Sometimes I wish to modify Notebook appearance and set additional Options. For example I like to have comments to be Plain rather than Bold:
SetOptions[EvaluationNotebook[],
AutoStyleOptions -> {"CommentStyle" -> {FontWeight -> Plain,
FontColor -> GrayLevel[0.6`], ShowAutoStyles -> False,
ShowSyntaxStyles -> False, AutoNumberFormatting -> False}}]
Now Options[EvaluationNotebook[]] will return also new option I have set.
But sometimes I wish to restore default behavior and delete additional Options. How can I do that?
Igor's answer is almost right. To remove the options set by
SetOptions[EvaluationNotebook[],
AutoStyleOptions -> {"CommentStyle" -> {FontWeight -> Plain,
FontColor -> GrayLevel[0.6`], ShowAutoStyles -> False,
ShowSyntaxStyles -> False, AutoNumberFormatting -> False}}]
You need to run
SetOptions[EvaluationNotebook[],
AutoStyleOptions -> {"CommentStyle" -> Inherited}]
But this only works for options that are standard and have a default to inherit (if it's a cell then from the enclosing section or notebook, if it's a notebook then from the stylesheet). What if you make up your own option, e.g.
Protect[HiddenData];
SetOptions[EvaluationNotebook[], HiddenData -> {"here's a string"}]
I don't know how to programmatically remove this option.
Edit:
Actually, to remove the HiddenData option created above, I can use something like
NotebookPut[DeleteCases[NotebookGet[EvaluationNotebook[]],
$CellContext`HiddenData -> _],
EvaluationNotebook[]]
Edit 2:
Mr Wizard asked how to remove all user-set notebook options. Assuming that this means all options that can't be inherited, then I believe that the following should work:
NotebookPut[
With[{nb = NotebookGet[EvaluationNotebook[]], opts = Options[Notebook][[All, 1]]},
Prepend[Select[Rest#nb, MemberQ[opts, First[#]] &], First#nb]],
EvaluationNotebook[]]
But maybe there are options associated with the StyleSheet that I've ignored...
If he meant how do you get back to your system's default notebook options - then you can just delete all notebook options:
NotebookPut[Notebook[First#NotebookGet[EvaluationNotebook[]]],
EvaluationNotebook[]]
(1) Select Format -> Options Inspector (or Shift+Ctrl+O on Windows)
(2) For the two fields next to "Show option values" select Notebook and as text
(3) Select and delete all text in the box below
(4) Click Apply
After understanding NotebookGet, I believe this works for full options reset.
NotebookPut[
Notebook#First#NotebookGet[EvaluationNotebook[]],
EvaluationNotebook[]]
Use:
SetOptions[EvaluationNotebook[], Background -> Inherited]
Igor