Skip to content

Commit 7a548e2

Browse files
committed
plotDFG replaces dfgplot
1 parent 2dbbbbc commit 7a548e2

File tree

7 files changed

+19
-18
lines changed

7 files changed

+19
-18
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Listing news on any major breaking changes in DFG. For regular changes, see int
88
- Towards distributions serialized via JSON, getting away from custom strings.
99
- `LocalDFG` replaces `DefaultDFG` (#844).
1010
- Optimized creation of CGDFG / `createDfgSessionIfNotExist` (#839, #815).
11+
- `plotDFG` replaces `dfgplot` (#841, #844).
1112

1213
# v0.16.0
1314

attic/MetaGraphsDFG/DFGPlots.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ using GraphPlot
99
using DistributedFactorGraphs, DistributedFactorGraphs.DFGPlots
1010
# ... Make graph...
1111
# Using GraphViz plotting
12-
dfgplot(fg)
12+
plotDFG(fg)
1313
# Save to PDFG
1414
using Compose
15-
draw(PDF("/tmp/graph.pdf", 16cm, 16cm), dfgplot(fg))
15+
draw(PDF("/tmp/graph.pdf", 16cm, 16cm), plotDFG(fg))
1616
```
1717
1818
More information at [GraphPlot.jl](https://github.com/JuliaGraphs/GraphPlot.jl)
1919
"""
20-
function dfgplot(dfg::DistributedFactorGraphs.MetaGraphsDFG, p::DFGPlotProps = DFGPlotProps())
20+
function plotDFG(dfg::DistributedFactorGraphs.MetaGraphsDFG, p::DFGPlotProps = DFGPlotProps())
2121
@info "Deprecated, please use GraphsDFG or LightDFG."
2222
nodesize = [has_prop(dfg.g,i,:factor) ? p.nodesize.fac : p.nodesize.var for i=vertices(dfg.g)]
2323
if p.drawlabels

docs/src/DrawingGraphs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ using GraphPlot
1818
using DistributedFactorGraphs
1919
```
2020

21-
Any factor graph can then be drawn by calling [`dfgplot`](@ref):
21+
Any factor graph can then be drawn by calling [`plotDFG`](@ref):
2222

2323
```@example plots
2424
using Cairo # hide
@@ -35,7 +35,7 @@ f1 = addFactor!(dfg, [:l0; :x0], LinearConditional(Normal(40.0,5.0)), solvable=1
3535
f1 = addFactor!(dfg, [:l0; :x1], LinearConditional(Normal(-10.0,5.0)), solvable=1)
3636
3737
# Plot graph
38-
dfgplot(dfg)
38+
plotDFG(dfg)
3939
```
4040

4141
### Rendering GraphPlot to PDF
@@ -49,7 +49,7 @@ dfg.solverParams.graphinit = false # hide
4949
addVariable!(dfg, :x2, ContinuousScalar);
5050
addFactor!(dfg, [:x1; :x2], LinearConditional(Normal(50.0,2.0)));
5151
# Save to SVG
52-
draw(SVG("graph.svg", 10cm, 10cm), dfgplot(dfg));
52+
draw(SVG("graph.svg", 10cm, 10cm), plotDFG(dfg));
5353
nothing # hide
5454
```
5555
![](graph.svg)

src/DFGPlots/DFGPlots.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import ..GraphPlot: gplot
99
using ...DistributedFactorGraphs
1010

1111
export
12-
dfgplot,
12+
plotDFG,
1313
DFGPlotProps
1414

1515
struct DFGPlotProps
@@ -40,15 +40,15 @@ using GraphPlot
4040
using DistributedFactorGraphs, DistributedFactorGraphs.DFGPlots
4141
# ... Make graph...
4242
# Using GraphViz plotting
43-
dfgplot(fg)
43+
plotDFG(fg)
4444
# Save to PDF
4545
using Compose
46-
draw(PDF("/tmp/graph.pdf", 16cm, 16cm), dfgplot(fg))
46+
draw(PDF("/tmp/graph.pdf", 16cm, 16cm), plotDFG(fg))
4747
```
4848
4949
More information at [GraphPlot.jl](https://github.com/JuliaGraphs/GraphPlot.jl)
5050
"""
51-
function dfgplot(dfg::GraphsDFG, p::DFGPlotProps = DFGPlotProps())
51+
function plotDFG(dfg::GraphsDFG, p::DFGPlotProps = DFGPlotProps())
5252

5353
nodetypes = [haskey(dfg.g.variables, s) for s in dfg.g.labels]
5454

@@ -66,11 +66,11 @@ function dfgplot(dfg::GraphsDFG, p::DFGPlotProps = DFGPlotProps())
6666

6767
end
6868

69-
function dfgplot(dfg::AbstractDFG, p::DFGPlotProps = DFGPlotProps())
69+
function plotDFG(dfg::AbstractDFG, p::DFGPlotProps = DFGPlotProps())
7070
# TODO implement convert functions
7171
ldfg = GraphsDFG{NoSolverParams}()
7272
copyGraph!(ldfg, dfg, listVariables(dfg), listFactors(dfg), copyGraphMetadata=false)
73-
dfgplot(ldfg, p)
73+
plotDFG(ldfg, p)
7474
end
7575

7676
function gplot(dfg::GraphsDFG; keyargs...)
@@ -79,14 +79,14 @@ end
7979

8080
#TODO decide if we want to overload show for display in juno, It's a bit annoying with development
8181
# function Base.show(io::IO, ::MIME"application/prs.juno.plotpane+html", dfg::AbstractDFG)
82-
function dfgplot(io::IO, ::MIME"application/prs.juno.plotpane+html", dfg::AbstractDFG)
82+
function plotDFG(io::IO, ::MIME"application/prs.juno.plotpane+html", dfg::AbstractDFG)
8383

8484
if length(ls(dfg)) != 0
8585
size = get(io, :juno_plotsize, [100, 100])
8686

8787
plot_output = IOBuffer()
8888
GraphPlot.draw(GraphPlot.SVGJS(plot_output, GraphPlot.Compose.default_graphic_width,
89-
GraphPlot.Compose.default_graphic_width, false), dfgplot(dfg))
89+
GraphPlot.Compose.default_graphic_width, false), plotDFG(dfg))
9090
plotsvg = String(take!(plot_output))
9191

9292
print(io,

test/attic/IIF4DoorsTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ mlc = MixturePrior(Normal.(doors[1,:], bws[1]), 0.25*ones(4))
6767
addFactor!(fg,[:x7], mlc )
6868

6969

70-
dfgplot(fg)
70+
plotDFG(fg)
7171

7272
tree = solveTree!(fg)
7373

test/plottingTest.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ map(n -> addFactor!(dfg, DFGFactor{TestFunctorInferenceType1}(Symbol("x$(n)x$(n+
1919
##
2020

2121
# Using GraphPlot plotting
22-
plot = dfgplot(dfg)
22+
plot = plotDFG(dfg)
2323
@test plot !== nothing
2424

2525
##
2626

2727
#TODO test something more
2828
#NOTE just running function to see if it plots
2929
iobuf = IOBuffer()
30-
dfgplot(iobuf, MIME("application/prs.juno.plotpane+html"), dfg)
30+
plotDFG(iobuf, MIME("application/prs.juno.plotpane+html"), dfg)
3131
@test length(take!(iobuf)) > 1e3
3232

3333
##

test/testBlocks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ function CopyFunctionsTest(testDFGAPI; kwargs...)
14971497
@test issetequal(ls(dcdfg_part), vlbls)
14981498
@test issetequal(lsf(dcdfg_part), flbls)
14991499
@test !isConnected(dcdfg_part)
1500-
# dfgplot(dcdfg_part)
1500+
# plotDFG(dcdfg_part)
15011501

15021502

15031503
vlbls = [:x2, :x3]

0 commit comments

Comments
 (0)