Add Graphs To Notebook
hrodstein
// Adds graphs from list to notebook.
// Example:
// String graphList = "Graph0;Graph1;Graph2;"
// AddGraphsToNotebook("MyNotebook", graphList, 2, 0, 50)
Function AddGraphsToNotebook(nb, graphList, desiredNumGraphsInParagraph, graphicsMode, scaling)
String nb // Name of notebook, e.g., "MyNotebook"
String graphList // e.g., "Graph0;Graph1;" or WinList("*", ";", "") for all graphs
Variable desiredNumGraphsInParagraph // e.g., 2
Variable graphicsMode // e.g., 0; See documentation for Notebook picture= command.
Variable scaling // e.g., 50 for 50 percent
DoWindow/F $nb
if (V_flag == 0)
NewNotebook /F=1 /N=$nb /W=(10,50,700,500)
endif
Variable index
Variable numGraphsInParagraph
numGraphsInParagraph = 0
do
String graphName = StringFromList(index, graphList)
if (strlen(graphName) == 0)
break // All done
endif
// Add graph
Notebook $nb, scaling={scaling,scaling}, picture={$graphName, graphicsMode, 1}
if (numGraphsInParagraph < (desiredNumGraphsInParagraph-1))
Notebook $nb, text="\t" // Add tab between graphs
endif
numGraphsInParagraph += 1
if (numGraphsInParagraph == desiredNumGraphsInParagraph)
Notebook $nb, text="\r" // Go to the next paragraph
Notebook $nb, text="\r" // Add a blank line between graph rows
numGraphsInParagraph = 0
endif
index += 1
while(1)
End
// Example:
// String graphList = "Graph0;Graph1;Graph2;"
// AddGraphsToNotebook("MyNotebook", graphList, 2, 0, 50)
Function AddGraphsToNotebook(nb, graphList, desiredNumGraphsInParagraph, graphicsMode, scaling)
String nb // Name of notebook, e.g., "MyNotebook"
String graphList // e.g., "Graph0;Graph1;" or WinList("*", ";", "") for all graphs
Variable desiredNumGraphsInParagraph // e.g., 2
Variable graphicsMode // e.g., 0; See documentation for Notebook picture= command.
Variable scaling // e.g., 50 for 50 percent
DoWindow/F $nb
if (V_flag == 0)
NewNotebook /F=1 /N=$nb /W=(10,50,700,500)
endif
Variable index
Variable numGraphsInParagraph
numGraphsInParagraph = 0
do
String graphName = StringFromList(index, graphList)
if (strlen(graphName) == 0)
break // All done
endif
// Add graph
Notebook $nb, scaling={scaling,scaling}, picture={$graphName, graphicsMode, 1}
if (numGraphsInParagraph < (desiredNumGraphsInParagraph-1))
Notebook $nb, text="\t" // Add tab between graphs
endif
numGraphsInParagraph += 1
if (numGraphsInParagraph == desiredNumGraphsInParagraph)
Notebook $nb, text="\r" // Go to the next paragraph
Notebook $nb, text="\r" // Add a blank line between graph rows
numGraphsInParagraph = 0
endif
index += 1
while(1)
End
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More