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.draw2DFunction
draw2D(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 : The PlotBoard or MetaPostBoard to be used.
  • drawNodes : Set this value to "false" in order to not show the nodes in the output
  • drawVerteces : Set this value to "false" in order to not show the verteces in the output
  • drawEdges : Set this value to "false" in order to not show the edges in the output
source
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 type Boundary can be passed here. This will be shown in the color specified by domain_color.
source

You may need the following:

HighVoronoi.PlotBoardType
PlotBoard

Provides a board to display a two-dimensional VoronoiGeometry in the Julia Plots format using draw2D or draw3D.

source

draw3D

Sample 3D plot

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.MetaPostBoardMethod

The 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 scaling
  • vertex_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 verteces
  • edge_color="blue": color of edges
  • domain_color="": color the domain, in case a domain argument is passed to the draw2D-function. Also it displays the domain that was passed to a VoronoiGeometry during instatiation
  • board::Boundary: provides a board: every node or vertex outside this board is not drawn
source