diff --git a/Kernel/style.m b/Kernel/style.m
index d5e115782..d816ba995 100644
--- a/Kernel/style.m
+++ b/Kernel/style.m
@@ -68,6 +68,11 @@
PackageScope["$genericLinePlotStyles"]
PackageScope["$genericGraphEdgeStyle"]
+combinedOptionsProperties[plotFunction_][options__] := Sequence[
+ "Options" -> {options},
+ "Function" -> (plotFunction[#, options] &)
+]
+
$styleNames = KeySort /@ KeySort @ <|
"EvolutionObject" -> <|"Icon" -> $evolutionObjectIcon|>,
"SpatialGraph" -> <|
@@ -90,14 +95,16 @@
"HighlightStyle" -> $highlightStyle,
"HyperedgeRendering" -> $hyperedgeRendering,
"DefaultImageSize" -> $wolframModelPlotImageSize,
- "Background" -> $spatialGraphBackground
+ "Background" -> $spatialGraphBackground,
+ combinedOptionsProperties[Graph][VertexStyle -> $vertexStyle, EdgeStyle -> $edgeLineStyle]
|>,
"CausalGraph" -> <|
"VertexStyle" -> $causalGraphVertexStyle,
"InitialVertexStyle" -> $causalGraphInitialVertexStyle,
"FinalVertexStyle" -> $causalGraphFinalVertexStyle,
"EdgeStyle" -> $causalGraphEdgeStyle,
- "Background" -> $causalGraphBackground
+ "Background" -> $causalGraphBackground,
+ combinedOptionsProperties[Graph][VertexStyle -> $causalGraphVertexStyle, EdgeStyle -> $causalGraphEdgeStyle]
|>,
"ExpressionsEventsGraph" -> <|
"EventVertexStyle" -> $causalGraphVertexStyle,
@@ -131,18 +138,21 @@
"SpatialGraph3D" -> <|
"VertexStyle" -> $spatialGraph3DVertexStyle,
- "EdgeLineStyle" -> $spatialGraph3DEdgeStyle
+ "EdgeLineStyle" -> $spatialGraph3DEdgeStyle,
+ combinedOptionsProperties[Graph3D][VertexStyle -> $spatialGraph3DVertexStyle, EdgeStyle -> $spatialGraph3DEdgeStyle]
|>,
(* MultiwaySystem styles *)
-
+
"StatesGraph" -> <|
"VertexStyle" -> $statesGraphVertexStyle,
- "EdgeStyle" -> $statesGraphEdgeStyle
+ "EdgeStyle" -> $statesGraphEdgeStyle,
+ combinedOptionsProperties[Graph][VertexStyle -> $statesGraphVertexStyle, EdgeStyle -> $statesGraphEdgeStyle]
|>,
"StatesGraph3D" -> <|
"VertexStyle" -> $statesGraphVertexStyle, (* same as 2D *)
- "EdgeStyle" -> $statesGraph3DEdgeStyle
+ "EdgeStyle" -> $statesGraph3DEdgeStyle,
+ combinedOptionsProperties[Graph][VertexStyle -> $statesGraphVertexStyle, EdgeStyle -> $statesGraph3DEdgeStyle]
|>,
"EvolutionCausalGraph" -> <|
"StateVertexStyle" -> $statesGraphVertexStyle,
@@ -152,7 +162,8 @@
|>,
"BranchialGraph" -> <|
"VertexStyle" -> $statesGraphVertexStyle,
- "EdgeStyle" -> $branchialGraphEdgeStyle
+ "EdgeStyle" -> $branchialGraphEdgeStyle,
+ combinedOptionsProperties[Graph][VertexStyle -> $statesGraphVertexStyle, EdgeStyle -> $branchialGraphEdgeStyle]
|>,
"RulialGraph" -> <|
"VertexStyle" -> $rulialGraphVertexStyle,
@@ -160,16 +171,19 @@
"VertexIconFontColor" -> $rulialGraphVertexIconFontColor,
"VertexIconBackground" -> $rulialGraphVertexIconBackground,
"VertexIconFrameStyle" -> $rulialGraphVertexIconFrameStyle,
- "VertexIconFrameMargins" -> $rulialGraphVertexIconFrameMargins
+ "VertexIconFrameMargins" -> $rulialGraphVertexIconFrameMargins,
+ combinedOptionsProperties[Graph][VertexStyle -> $rulialGraphVertexStyle, EdgeStyle -> $rulialGraphEdgeStyle]
|>,
(* Generic plots *)
"GenericLinePlot" -> <|
- "PlotStyles" -> $genericLinePlotStyles
+ "PlotStyles" -> $genericLinePlotStyles,
+ "Options" -> {PlotStyle -> $genericLinePlotStyles}
|>,
"GenericGraph" -> <|
- "EdgeStyle" -> $genericGraphEdgeStyle
+ "EdgeStyle" -> $genericGraphEdgeStyle,
+ combinedOptionsProperties[Graph][EdgeStyle -> $genericGraphEdgeStyle]
|>
|>;
diff --git a/README.md b/README.md
index 30e10ae09..7a261a442 100644
--- a/README.md
+++ b/README.md
@@ -2077,6 +2077,25 @@ In[] := WolframPhysicsProjectStyleData["CausalGraph"]
This function is useful if one needs to produce "fake" example plots using styles consistent with the Wolfram Physics Project.
+For graphs composed of only a single type of vertices and edges, there is a short-hand syntax.
+One can get the list of all options that needs to be passed using an `"Options"` property:
+
+```wl
+In[] := WolframPhysicsProjectStyleData["SpatialGraph3D", "Options"]
+```
+
+
+
+Alternatively, one can use the `"Function"` property, which would give a function that takes a graph and produces a
+correctly styled graph:
+
+```wl
+In[] := WolframPhysicsProjectStyleData["SpatialGraph3D", "Function"][
+ Graph3D[{1 -> 2, 2 -> 3, 3 -> 1, 3 -> 4, 4 -> 1}]]
+```
+
+
+
### Build Data
There are two constants containing information about the build. **`$SetReplaceGitSHA`** is a git SHA of the currently-used version of *SetReplace*:
diff --git a/READMEImages/FakeStyledSpatialGraph3D.png b/READMEImages/FakeStyledSpatialGraph3D.png
new file mode 100644
index 000000000..12b2c4991
Binary files /dev/null and b/READMEImages/FakeStyledSpatialGraph3D.png differ
diff --git a/READMEImages/SpatialGraph3DOptions.png b/READMEImages/SpatialGraph3DOptions.png
new file mode 100644
index 000000000..b57d75ce2
Binary files /dev/null and b/READMEImages/SpatialGraph3DOptions.png differ
diff --git a/Tests/WolframPhysicsProjectStyleData.wlt b/Tests/WolframPhysicsProjectStyleData.wlt
index d72be6b9c..718d49b68 100644
--- a/Tests/WolframPhysicsProjectStyleData.wlt
+++ b/Tests/WolframPhysicsProjectStyleData.wlt
@@ -142,6 +142,15 @@
MemberQ[
WolframPhysicsProjectStyleData /@ $WolframPhysicsProjectPlotThemes,
WolframPhysicsProjectStyleData[]]
+ ],
+
+ VerificationTest[
+ Options[
+ Graph[{1 -> 2, 2 -> 3, 2 -> 4}, WolframPhysicsProjectStyleData["CausalGraph", "Options"]],
+ {VertexStyle, EdgeStyle}],
+ Options[
+ WolframPhysicsProjectStyleData["CausalGraph", "Function"][Graph[{1 -> 2, 2 -> 3, 2 -> 4}]],
+ {VertexStyle, EdgeStyle}]
]
}]
|>,