Graphical Output in 2D and 3D
Graphical output can be produced using the Plots.jl
. This is achieved as follows
draw2D
Example:
VG = VoronoiGeometry(VoronoiNodes(rand(2,5)),cuboid(2,periodic=[]))
HighVoronoi.draw2D(VG)
Optionally, the output can be stored in any format supported by Plots:
HighVoronoi.draw2D(VG,"nice_plot.png")
The package provides the following output functions:
HighVoronoi.draw2D
— Functiondraw2D(VG::VoronoiGeometry, filename=""; board=PlotBoard(), drawNodes=true, drawVerteces=true, drawEdges=true)
Generates MetaPost of VG output in the file with name filename for a two-dimensional VoronoiGeometry.
board
: ThePlotBoard
orMetaPostBoard
to be used.drawNodes
: Set this value to "false" in order to not show the nodes in the outputdrawVerteces
: Set this value to "false" in order to not show the verteces in the outputdrawEdges
: Set this value to "false" in order to not show the edges in the output
draw2D(Integral::Voronoi_Integral, filename::String; domain=nothing, board=PlotBoard(), drawNodes=true, drawVerteces=true, drawEdges=true)
Almost the same as for a VoronoiGeometry
. It has one additional parameter:
domain
: A domain of typeBoundary
can be passed here. This will be shown in the color specified bydomain_color
.
You may need the following:
HighVoronoi.PlotBoard
— TypePlotBoard
Provides a board to display a two-dimensional VoronoiGeometry
in the Julia Plots
format using draw2D
or draw3D
.
draw3D
The same works with 3 dimensions (you may also pass a customized PlotBoard
):
VG = VoronoiGeometry(VoronoiNodes(rand(3,5)),cuboid(3,periodic=[]))
draw3D(VG,"nice_plot_3D.pdf")
Using PlotlyJS
using PlotlyJS
plotly()
VG = VoronoiGeometry(VoronoiNodes(rand(3,5)),cuboid(3,periodic=[]))
draw3D(VG)
When you use plotly()
you will not be able to write the output to a file.
2D-Output using MetaPost
Similar to LaTeXX, MetaPost is an elegant way to create eps, pdf etc. from a programming language vector graphic code. If you do not have it installed on your PC, you may use the MetaPost generator by Troy Henderson: www.tlhiv.org/mppreview/. However, this link sometimes did not work in the past.
The MeatPostBoard
These methods are based on the MetaPostBoard
structure:
HighVoronoi.MetaPostBoard
— TypeMetaPostBoard
Provides a board to display a two-dimensional VoronoiGeometry
in MetaPost text format using draw2D.
HighVoronoi.MetaPostBoard
— MethodThe constructor
MetaPostBoard()
Generates a MetapostBoard where the following <:Real
-type arguments may be passed (=standard value)
scaling=100
: denotes a factor by which every object is magnified (also applies to the coordinates of points)node_size=0.01
: nodes are drawn as a cross. This variable is the size of a cross BEFORE scalingvertex_size=0.003
: same for verteces
Additionally, the following colors may be passed as a <:String
. note that an empty string implies the usage of the MetaPost standard pen color.
nodes_color=""
: the color at which nodes are draw. Empty string implies standard color (typically black)vertex_color="red"
: color vertecesedge_color="blue"
: color of edgesdomain_color=""
: color the domain, in case adomain
argument is passed to thedraw2D
-function. Also it displays the domain that was passed to aVoronoiGeometry
during instatiation- board::Boundary: provides a board: every node or vertex outside this board is not drawn