GR.GRPreferences.diagnostics
— Methoddiagnostics()
Output diagnostics about preferences and overrides for GR and GR_jll.
GR.GRPreferences.get_overrides_toml_path
— Methodget_overrides_toml_path()
Get the path the depot's Overrides.toml
GR.GRPreferences.override_depot
— Functionoverride_depot([grdir])
Override GRjll in the DEPOTPATH[1]/artifacts/Overrides.toml with grdir
.
GR.GRPreferences.override_project
— Functionoverride_project([grdir])
Override individual GR_jll artifacts in the (Local)Preferences.toml of the project.
GR.GRPreferences.unoverride_depot
— Methodunoverride_depot()
Remove the override for GRjll in DEPOTPATH[1]/artifats/Overrides.toml
GR.GRPreferences.unoverride_project
— Methodunoverride_project()
Remove overrides for GR_jll artifacts in the (Local)Preferences.toml of the project.
GR.GRPreferences.use_jll_binary
— Methoduse_jll_binary(; export_prefs = false, force = false)
Use GR_jll in the its standard configuration from BinaryBuilder.org.
See Preferences.set_preferences!
for the export_prefs
and force
keywords.
GR.GRPreferences.use_system_binary
— Methoduse_system_binary(grdir; export_prefs = false, force = false, override = :depot)
Use the system binaries located at grdir
. See Preferences.set_preferences!
for the export_prefs
and force
keywords.
The override keyword can be either:
- :depot, Override GR_jll using the depot Overrides.toml
- :project, Override GR_jll using the project Preferences.toml
- (:depot, :project), Overide GR_jll in both the depot and the project
GR.GRPreferences.use_upstream_binary
— Methoduse_upstream_binary([install_dir]; export_prefs = false, force = false, override = :depot)
Download the binaries from https://github.com/sciapp/gr/ and configure GR to use those.
A directory "gr" will be placed within install_dir
containing the upstream binaries. By default install_dir will be joinpath(pathof(GR), "deps")
.
See use_system_binary
for details.
GR.GRPreferences.Downloader
— ModuleGR.GRPreferences.Downloader is a Module that contains the GR download script.
GR.GRPreferences.Downloader.download() can be invoked manually.
GR.GRPreferences.Downloader.apple_install
— Methodapple_install(grdir::String)
Register launch services and install rpath for qt5plugin.so
GR.GRPreferences.Downloader.check_dependencies
— Methodcheck_dependencies(grdir::String)
Check dependencies using ldd on Linux and FreeBSD
GR.GRPreferences.Downloader.download
— Functiondownload(install_dir)
Download tarball from https://github.com/sciapp/gr/releases and extract the tarball into install_dir.
GR.GRPreferences.Downloader.download_tarball
— Functiondownload_tarball(version, os, arch, downloads_dir = mktempdir())
Download tarball to downloads_dir.
GR.GRPreferences.Downloader.get_default_install_dir
— Methodget_default_install_dir()
Return the default install directory where we have write permissions. Currently, this is the deps directory of the GR package: joinpath(pathof(GR), "..", "deps")
GR.GRPreferences.Downloader.get_grdir
— Methodget_grdir()
Try to locate an existing GR install. The search will look in the following places:
- ENV["GRDIR"]
- ~/gr
- /opt/gr
- /usr/local/gr
- /usr/gr
It will confirm the install by checking for the existence of a fonts subdirectory.
The function will return a String
representing one of the paths above or nothing
if a GR install is not located in any of those locations.
GR.GRPreferences.Downloader.get_os_and_arch
— Methodget_os_and_arch()
Figure out which specific operating system this, including the specific Linux distribution.
GR.GRPreferences.Downloader.get_os_release
— Methodget_os_release(key)
Grep for key in /etc/os-release
GR.GRPreferences.Downloader.get_version
— Methodget_version()
Get the version of GR.jl package.
If ENV["GRDIR"] exists and non-empty, this will return "latest"
GR.GRPreferences.Downloader.try_download
— Methodtry_download(url, file)
Try to download url to file. Return true
if successful, or false
otherwise.
GR.contour
— MethodDraw a contour plot.
This function uses the current colormap to display a either a series of points or a two-dimensional array as a contour plot. It can receive one or more of the following:
- x values, y values and z values, or
- M x values, N y values and z values on a NxM grid, or
- M x values, N y values and a callable to determine z values
If a series of points is passed to this function, their values will be interpolated on a grid. For grid points outside the convex hull of the provided points, a value of 0 will be used.
:param args: the data to plot
Usage examples:
.. code-block:: julia
julia> # Create example point data
julia> x = 8 .* rand(100) .- 4
julia> y = 8 .* rand(100) .- 4
julia> z = sin.(x) .+ cos.(y)
julia> # Draw the contour plot
julia> contour(x, y, z)
julia> # Create example grid data
julia> x = LinRange(-2, 2, 40)
julia> y = LinRange(0, pi, 20)
julia> z = sin.(x') .+ cos.(y)
julia> # Draw the contour plot
julia> contour(x, y, z)
julia> # Draw the contour plot using a callable
julia> contour(x, y, (x,y) -> sin(x) + cos(y))
GR.contourf
— MethodDraw a filled contour plot.
This function uses the current colormap to display a either a series of points or a two-dimensional array as a filled contour plot. It can receive one or more of the following:
- x values, y values and z values, or
- M x values, N y values and z values on a NxM grid, or
- M x values, N y values and a callable to determine z values
If a series of points is passed to this function, their values will be interpolated on a grid. For grid points outside the convex hull of the provided points, a value of 0 will be used.
:param args: the data to plot
Usage examples:
.. code-block:: julia
julia> # Create example point data
julia> x = 8 .* rand(100) .- 4
julia> y = 8 .* rand(100) .- 4
julia> z = sin.(x) .+ cos.(y)
julia> # Draw the contour plot
julia> contourf(x, y, z)
julia> # Create example grid data
julia> x = LinRange(-2, 2, 40)
julia> y = LinRange(0, pi, 20)
julia> z = sin.(x') .+ cos.(y)
julia> # Draw the contour plot
julia> contourf(x, y, z)
julia> # Draw the contour plot using a callable
julia> contourf(x, y, (x,y) -> sin(x) + cos(y))
GR.hexbin
— MethodDraw a hexagon binning plot.
This function uses hexagonal binning and the the current colormap to display a series of points. It can receive one or more of the following:
- x values and y values, or
- x values and a callable to determine y values, or
- y values only, with their indices as x values
:param args: the data to plot
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> x = randn(100000)
julia> y = randn(100000)
julia> # Draw the hexbin plot
julia> hexbin(x, y)
GR.jlgr.barplot
— FunctionDraw a bar plot.
If no specific labels are given, the axis is labelled with integer numbers starting from 1.
Use the keyword arguments barwidth, baseline or horizontal to modify the default width of the bars (by default 0.8 times the separation between bars), the baseline value (by default zero), or the direction of the bars (by default vertical).
:param labels: the labels of the bars :param heights: the heights of the bars
Usage examples:
.. code-block:: julia
julia> # World population by continents (millions)
julia> population = Dict("Africa" => 1216,
"America" => 1002,
"Asia" => 4436,
"Europe" => 739,
"Oceania" => 38)
julia> barplot(keys(population), values(population))
julia> # Horizontal bar plot
julia> barplot(keys(population), values(population), horizontal=true)
GR.jlgr.drawgrid
— FunctionSet the flag to draw a grid in the plot axes.
:param flag: the value of the grid flag (true
by default)
Usage examples:
.. code-block:: julia
julia> # Hid the grid on the next plot
julia> grid(false)
julia> # Restore the grid
julia> grid(true)
GR.jlgr.figure
— MethodCreate a new figure with the given settings.
Settings like the current colormap, title or axis limits as stored in the current figure. This function creates a new figure, restores the default settings and applies any settings passed to the function as keyword arguments.
Usage examples:
.. code-block:: julia
julia> # Restore all default settings
julia> figure()
julia> # Restore all default settings and set the title
julia> figure(title="Example Figure")
GR.jlgr.heatmap
— FunctionDraw a heatmap.
This function uses the current colormap to display a two-dimensional array as a heatmap. The array is drawn with its first value in the bottom left corner, so in some cases it may be neccessary to flip the columns (see the example below).
By default the function will use the column and row indices for the x- and y-axes, respectively, so setting the axis limits is recommended. Also note that the values in the array must lie within the current z-axis limits so it may be neccessary to adjust these limits or clip the range of array values.
:param data: the heatmap data
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> x = LinRange(-2, 2, 40)
julia> y = LinRange(0, pi, 20)
julia> z = sin.(x') .+ cos.(y)
julia> # Draw the heatmap
julia> heatmap(z)
GR.jlgr.histogram
— FunctionDraw a histogram.
If nbins is nothing or 0, this function computes the number of bins as 3.3 * log10(n) + 1, with n as the number of elements in x, otherwise the given number of bins is used for the histogram.
:param x: the values to draw as histogram :param num_bins: the number of bins in the histogram
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> x = 2 .* rand(100) .- 1
julia> # Draw the histogram
julia> histogram(x)
julia> # Draw the histogram with 19 bins
julia> histogram(x, nbins=19)
GR.jlgr.hold
— FunctionSet the hold flag for combining multiple plots.
The hold flag prevents drawing of axes and clearing of previous plots, so that the next plot will be drawn on top of the previous one.
:param flag: the value of the hold flag
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> x = LinRange(0, 1, 100)
julia> # Draw the first plot
julia> plot(x, x.^2)
julia> # Set the hold flag
julia> hold(true)
julia> # Draw additional plots
julia> plot(x, x.^4)
julia> plot(x, x.^8)
julia> # Reset the hold flag
julia> hold(false)
GR.jlgr.imshow
— FunctionDraw an image.
This function can draw an image either from reading a file or using a two-dimensional array and the current colormap.
:param image: an image file name or two-dimensional array
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> x = LinRange(-2, 2, 40)
julia> y = LinRange(0, pi, 20)
julia> z = sin.(x') .+ cos.(y)
julia> # Draw an image from a 2d array
julia> imshow(z)
julia> # Draw an image from a file
julia> imshow("example.png")
GR.jlgr.isosurface
— MethodDraw an isosurface.
This function can draw an image either from reading a file or using a two-dimensional array and the current colormap. Values greater than the isovalue will be seen as outside the isosurface, while values less than the isovalue will be seen as inside the isosurface.
:param v: the volume data :param isovalue: the isovalue
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> s = LinRange(-1, 1, 40)
julia> v = 1 .- (s .^ 2 .+ (s .^ 2)' .+ reshape(s,1,1,:) .^ 2) .^ 0.5
julia> # Draw an image from a 2d array
julia> isosurface(v, isovalue=0.2)
GR.jlgr.legend
— MethodSet the legend of the plot.
The plot legend is drawn using the extended text function GR.textext. You can use a subset of LaTeX math syntax, but will need to escape certain characters, e.g. parentheses. For more information see the documentation of GR.textext.
:param args: The legend strings
Usage examples:
.. code-block:: julia
julia> # Set the legends to "a" and "b"
julia> legend("a", "b")
GR.jlgr.oplot
— MethodDraw one or more line plots over another plot.
This function can receive one or more of the following:
- x values and y values, or
- x values and a callable to determine y values, or
- y values only, with their indices as x values
:param args: the data to plot
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> x = LinRange(-2, 2, 40)
julia> y = 2 .* x .+ 4
julia> # Draw the first plot
julia> plot(x, y)
julia> # Plot graph over it
julia> oplot(x, x -> x^3 + x^2 + x)
GR.jlgr.plot
— MethodDraw one or more line plots.
This function can receive one or more of the following:
- x values and y values, or
- x values and a callable to determine y values, or
- y values only, with their indices as x values
:param args: the data to plot
Usage examples:
.. code-block:: julia-repl
julia> # Create example data
julia> x = LinRange(-2, 2, 40)
julia> y = 2 .* x .+ 4
julia> # Plot x and y
julia> plot(x, y)
julia> # Plot x and a callable
julia> plot(x, t -> t^3 + t^2 + t)
julia> # Plot y, using its indices for the x values
julia> plot(y)
GR.jlgr.plot3
— MethodDraw one or more three-dimensional line plots.
:param x: the x coordinates to plot :param y: the y coordinates to plot :param z: the z coordinates to plot
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> x = LinRange(0, 30, 1000)
julia> y = cos.(x) .* x
julia> z = sin.(x) .* x
julia> # Plot the points
julia> plot3(x, y, z)
GR.jlgr.polar
— MethodDraw one or more polar plots.
This function can receive one or more of the following:
- angle values and radius values, or
- angle values and a callable to determine radius values
:param args: the data to plot
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> angles = LinRange(0, 2pi, 40)
julia> radii = LinRange(0, 2, 40)
julia> # Plot angles and radii
julia> polar(angles, radii)
julia> # Plot angles and a callable
julia> polar(angles, r -> cos(r) ^ 2)
GR.jlgr.polarhistogram
— FunctionDraw a polar histogram.
If nbins is nothing or 0, this function computes the number of bins as 3.3 * log10(n) + 1, with n as the number of elements in x, otherwise the given number of bins is used for the histogram.
:param x: the values to draw as a polar histogram :param num_bins: the number of bins in the polar histogram
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> x = 2 .* rand(100) .- 1
julia> # Draw the polar histogram
julia> polarhistogram(x, alpha=0.5)
julia> # Draw the polar histogram with 19 bins
julia> polarhistogram(x, nbins=19, alpha=0.5)
GR.jlgr.redraw
— MethodRedraw current plot
This can be used to update the current plot, after setting some attributes like the title, axes labels, legend, etc.
Usage examples:
.. code-block:: julia-repl
julia> # Create example data
julia> x = LinRange(-2, 2, 40)
julia> y = 2 .* x .+ 4
julia> # Add title and labels
julia> title("Example plot")
julia> xlabel("x")
julia> ylabel("y")
julia> # Redraw the plot with the new attributes
julia> redraw()
GR.jlgr.savefig
— FunctionSave the current figure to a file.
This function draw the current figure using one of GR's workstation types to create a file of the given name. Which file types are supported depends on the installed workstation types, but GR usually is built with support for .png, .jpg, .pdf, .ps, .gif and various other file formats.
:param filename: the filename the figure should be saved to
Usage examples:
.. code-block:: julia
julia> # Create a simple plot
julia> x = 1:100
julia> plot(x, 1 ./ (x .+ 1))
julia> # Save the figure to a file
julia> savefig("example.png")
GR.jlgr.scatter
— MethodDraw one or more scatter plots.
This function can receive one or more of the following:
- x values and y values, or
- x values and a callable to determine y values, or
- y values only, with their indices as x values
Additional to x and y values, you can provide values for the markers' size and color. Size values will determine the marker size in percent of the regular size, and color values will be used in combination with the current colormap.
:param args: the data to plot
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> x = LinRange(-2, 2, 40)
julia> y = 0.2 .* x .+ 0.4
julia> # Plot x and y
julia> scatter(x, y)
julia> # Plot x and a callable
julia> scatter(x, x -> 0.2 * x + 0.4)
julia> # Plot y, using its indices for the x values
julia> scatter(y)
julia> # Plot a diagonal with increasing size and color
julia> x = LinRange(0, 1, 11)
julia> y = LinRange(0, 1, 11)
julia> s = LinRange(50, 400, 11)
julia> c = LinRange(0, 255, 11)
julia> scatter(x, y, s, c)
GR.jlgr.scatter3
— MethodDraw one or more three-dimensional scatter plots.
Additional to x, y and z values, you can provide values for the markers' color. Color values will be used in combination with the current colormap.
:param x: the x coordinates to plot :param y: the y coordinates to plot :param z: the z coordinates to plot :param c: the optional color values to plot
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> x = 2 .* rand(100) .- 1
julia> y = 2 .* rand(100) .- 1
julia> z = 2 .* rand(100) .- 1
julia> c = 999 .* rand(100) .+ 1
julia> # Plot the points
julia> scatter3(x, y, z)
julia> # Plot the points with colors
julia> scatter3(x, y, z, c)
GR.jlgr.stairs
— MethodDraw one or more step or staircase plots.
This function can receive one or more of the following:
- x values and y values, or
- x values and a callable to determine y values, or
- y values only, with their indices as x values
:param args: the data to plot :param where: pre, mid or post, to decide where the step between two y values should be placed
Usage examples:
.. code-block:: julia julia> # Create example data julia> x = LinRange(-2, 2, 40) julia> y = 2 .* x .+ 4 julia> # Plot x and y julia> stairs(x, y) julia> # Plot x and a callable julia> stairs(x, x -> x^3 + x^2 + x) julia> # Plot y, using its indices for the x values julia> stairs(y) julia> # Use next y step directly after x each position julia> stairs(y, where="pre") julia> # Use next y step between two x positions julia> stairs(y, where="mid") julia> # Use next y step immediately before next x position julia> stairs(y, where="post")
GR.jlgr.stem
— MethodDraw a stem plot.
This function can receive one or more of the following:
- x values and y values, or
- x values and a callable to determine y values, or
- y values only, with their indices as x values
:param args: the data to plot
Usage examples:
.. code-block:: julia
julia> # Create example data
julia> x = LinRange(-2, 2, 40)
julia> y = 0.2 .* x .+ 0.4
julia> # Plot x and y
julia> stem(x, y)
julia> # Plot x and a callable
julia> stem(x, x -> x^3 + x^2 + x + 6)
julia> # Plot y, using its indices for the x values
julia> stem(y)
GR.jlgr.subplot
— FunctionSet current subplot index.
By default, the current plot will cover the whole window. To display more than one plot, the window can be split into a number of rows and columns, with the current plot covering one or more cells in the resulting grid.
Subplot indices are one-based and start at the upper left corner, with a new row starting after every num_columns subplots.
:param numrows: the number of subplot rows :param numcolumns: the number of subplot columns :param subplot_indices: - the subplot index to be used by the current plot - a pair of subplot indices, setting which subplots should be covered by the current plot
Usage examples:
.. code-block:: julia
julia> # Set the current plot to the second subplot in a 2x3 grid
julia> subplot(2, 3, 2)
julia> # Set the current plot to cover the first two rows of a 4x2 grid
julia> subplot(4, 2, (1, 4))
julia> # Use the full window for the current plot
julia> subplot(1, 1, 1)
GR.jlgr.title
— FunctionSet the plot title.
The plot title is drawn using the extended text function GR.textext. You can use a subset of LaTeX math syntax, but will need to escape certain characters, e.g. parentheses. For more information see the documentation of GR.textext.
:param title: the plot title
Usage examples:
.. code-block:: julia
julia> # Set the plot title to "Example Plot"
julia> title("Example Plot")
julia> # Clear the plot title
julia> title("")
GR.jlgr.tricont
— MethodDraw a triangular contour plot.
This function uses the current colormap to display a series of points as a triangular contour plot. It will use a Delaunay triangulation to interpolate the z values between x and y values. If the series of points is concave, this can lead to interpolation artifacts on the edges of the plot, as the interpolation may occur in very acute triangles.
:param x: the x coordinates to plot :param y: the y coordinates to plot :param z: the z coordinates to plot
Usage examples:
.. code-block:: julia
julia> # Create example point data
julia> x = 8 .* rand(100) .- 4
julia> y = 8 .* rand(100) .- 4
julia> z = sin.(x) + cos.(y)
julia> # Draw the triangular contour plot
julia> tricont(x, y, z)
GR.jlgr.trisurf
— MethodDraw a triangular surface plot.
This function uses the current colormap to display a series of points as a triangular surface plot. It will use a Delaunay triangulation to interpolate the z values between x and y values. If the series of points is concave, this can lead to interpolation artifacts on the edges of the plot, as the interpolation may occur in very acute triangles.
:param x: the x coordinates to plot :param y: the y coordinates to plot :param z: the z coordinates to plot
Usage examples:
.. code-block:: julia
julia> # Create example point data
julia> x = 8 .* rand(100) .- 4
julia> y = 8 .* rand(100) .- 4
julia> z = sin.(x) .+ cos.(y)
julia> # Draw the triangular surface plot
julia> trisurf(x, y, z)
GR.jlgr.wireframe
— MethodDraw a three-dimensional wireframe plot.
This function uses the current colormap to display a either a series of points or a two-dimensional array as a wireframe plot. It can receive one or more of the following:
- x values, y values and z values, or
- M x values, N y values and z values on a NxM grid, or
- M x values, N y values and a callable to determine z values
If a series of points is passed to this function, their values will be interpolated on a grid. For grid points outside the convex hull of the provided points, a value of 0 will be used.
:param args: the data to plot
Usage examples:
.. code-block:: julia
julia> # Create example point data
julia> x = 8 .* rand(100) .- 4
julia> y = 8 .* rand(100) .- 4
julia> z = sin.(x) .+ cos.(y)
julia> # Draw the wireframe plot
julia> wireframe(x, y, z)
julia> # Create example grid data
julia> x = LinRange(-2, 2, 40)
julia> y = LinRange(0, pi, 20)
julia> z = sin.(x') .+ cos.(y)
julia> # Draw the wireframe plot
julia> wireframe(x, y, z)
julia> # Draw the wireframe plot using a callable
julia> wireframe(x, y, (x,y) -> sin(x) + cos(y))
GR.jlgr.xlabel
— FunctionSet the x-axis label.
The axis labels are drawn using the extended text function GR.textext. You can use a subset of LaTeX math syntax, but will need to escape certain characters, e.g. parentheses. For more information see the documentation of GR.textext.
:param x_label: the x-axis label
Usage examples:
.. code-block:: julia
julia> # Set the x-axis label to "x"
julia> xlabel("x")
julia> # Clear the x-axis label
julia> xlabel("")
GR.jlgr.xlim
— FunctionSet the limits for the x-axis.
The x-axis limits can either be passed as individual arguments or as a tuple of (x_min, x_max). Setting either limit to nothing will cause it to be automatically determined based on the data, which is the default behavior.
:param xmin: - the x-axis lower limit, or - nothing to use an automatic lower limit, or - a tuple of both x-axis limits :param xmax: - the x-axis upper limit, or - nothing to use an automatic upper limit, or - nothing if both x-axis limits were passed as first argument :param adjust: whether or not the limits may be adjusted
Usage examples:
.. code-block:: julia
julia> # Set the x-axis limits to -1 and 1
julia> xlim((-1, 1))
julia> # Reset the x-axis limits to be determined automatically
julia> xlim()
julia> # Reset the x-axis upper limit and set the lower limit to 0
julia> xlim((0, nothing))
julia> # Reset the x-axis lower limit and set the upper limit to 1
julia> xlim((nothing, 1))
GR.jlgr.xticklabels
— FunctionCustomize the string of the X and Y axes tick labels.
The labels of the tick axis can be defined through a function with one argument (the numeric value of the tick position) and returns a string, or through an array of strings that are located sequentially at X = 1, 2, etc.
:param s: function or array of strings that define the tick labels.
Usage examples:
.. code-block:: julia
julia> # Label the range (0-1) of the Y-axis as percent values
julia> yticklabels(p -> Base.Printf.@sprintf("%0.0f%%", 100p))
julia> # Label the X-axis with a sequence of strings
julia> xticklabels(["first", "second", "third"])
GR.jlgr.xticks
— FunctionSet the intervals of the ticks for the X, Y or Z axis.
Use the function xticks
, yticks
or zticks
for the corresponding axis.
:param minor: the interval between minor ticks. :param major: (optional) the number of minor ticks between major ticks.
Usage examples:
.. code-block:: julia
julia> # Minor ticks every 0.2 units in the X axis
julia> xticks(0.2)
julia> # Major ticks every 1 unit (5 minor ticks) in the Y axis
julia> yticks(0.2, 5)
GR.jlgr.ylabel
— FunctionSet the y-axis label.
The axis labels are drawn using the extended text function GR.textext. You can use a subset of LaTeX math syntax, but will need to escape certain characters, e.g. parentheses. For more information see the documentation of GR.textext.
:param y_label: the y-axis label
GR.jlgr.ylim
— FunctionSet the limits for the y-axis.
The y-axis limits can either be passed as individual arguments or as a tuple of (y_min, y_max). Setting either limit to nothing will cause it to be automatically determined based on the data, which is the default behavior.
:param ymin: - the y-axis lower limit, or - nothing to use an automatic lower limit, or - a tuple of both y-axis limits :param ymax: - the y-axis upper limit, or - nothing to use an automatic upper limit, or - nothing if both y-axis limits were passed as first argument :param adjust: whether or not the limits may be adjusted
Usage examples:
.. code-block:: julia
julia> # Set the y-axis limits to -1 and 1
julia> ylim((-1, 1))
julia> # Reset the y-axis limits to be determined automatically
julia> ylim()
julia> # Reset the y-axis upper limit and set the lower limit to 0
julia> ylim((0, nothing))
julia> # Reset the y-axis lower limit and set the upper limit to 1
julia> ylim((nothing, 1))
GR.jlgr.yticklabels
— FunctionCustomize the string of the X and Y axes tick labels.
The labels of the tick axis can be defined through a function with one argument (the numeric value of the tick position) and returns a string, or through an array of strings that are located sequentially at X = 1, 2, etc.
:param s: function or array of strings that define the tick labels.
Usage examples:
.. code-block:: julia
julia> # Label the range (0-1) of the Y-axis as percent values
julia> yticklabels(p -> Base.Printf.@sprintf("%0.0f%%", 100p))
julia> # Label the X-axis with a sequence of strings
julia> xticklabels(["first", "second", "third"])
GR.jlgr.yticks
— FunctionSet the intervals of the ticks for the X, Y or Z axis.
Use the function xticks
, yticks
or zticks
for the corresponding axis.
:param minor: the interval between minor ticks. :param major: (optional) the number of minor ticks between major ticks.
Usage examples:
.. code-block:: julia
julia> # Minor ticks every 0.2 units in the X axis
julia> xticks(0.2)
julia> # Major ticks every 1 unit (5 minor ticks) in the Y axis
julia> yticks(0.2, 5)
GR.jlgr.zticks
— FunctionSet the intervals of the ticks for the X, Y or Z axis.
Use the function xticks
, yticks
or zticks
for the corresponding axis.
:param minor: the interval between minor ticks. :param major: (optional) the number of minor ticks between major ticks.
Usage examples:
.. code-block:: julia
julia> # Minor ticks every 0.2 units in the X axis
julia> xticks(0.2)
julia> # Major ticks every 1 unit (5 minor ticks) in the Y axis
julia> yticks(0.2, 5)
GR.surface
— MethodDraw a three-dimensional surface plot.
This function uses the current colormap to display a either a series of points or a two-dimensional array as a surface plot. It can receive one or more of the following:
- x values, y values and z values, or
- M x values, N y values and z values on a NxM grid, or
- M x values, N y values and a callable to determine z values
If a series of points is passed to this function, their values will be interpolated on a grid. For grid points outside the convex hull of the provided points, a value of 0 will be used.
:param args: the data to plot
Usage examples:
.. code-block:: julia
julia> # Create example point data
julia> x = 8 .* rand(100) .- 4
julia> y = 8 .* rand(100) .- 4
julia> z = sin.(x) .+ cos.(y)
julia> # Draw the surface plot
julia> surface(x, y, z)
julia> # Create example grid data
julia> x = LinRange(-2, 2, 40)
julia> y = LinRange(0, pi, 20)
julia> z = sin.(x') .+ cos.(y)
julia> # Draw the surface plot
julia> surface(x, y, z)
julia> # Draw the surface plot using a callable
julia> surface(x, y, (x,y) -> sin(x) + cos(y))
GR.GR
— ModuleGR is a universal framework for cross-platform visualization applications.
It offers developers a compact, portable and consistent graphics library
for their programs. Applications range from publication quality 2D graphs
to the representation of complex 3D scenes.
See https://gr-framework.org/julia.html for full documentation.
Basic usage:
```julia
using GR
GR.init() # optional
plot(
[0, 0.2, 0.4, 0.6, 0.8, 1.0],
[0.3, 0.5, 0.4, 0.2, 0.6, 0.7]
)
# GR.show() # Use if in a Jupyter Notebook
```
GR.activatews
— Methodactivatews(workstation_id::Int)
Activate the specified workstation.
Parameters:
workstation_id
: A workstation identifier.
GR.axes2d
— Methodaxes2d(x_tick::Real, y_tick::Real, x_org::Real, y_org::Real, major_x::Int, major_y::Int, tick_size::Real)
Draw X and Y coordinate axes with linearly and/or logarithmically spaced tick marks.
Parameters:
x_tick
, y_tick
: The interval between minor tick marks on each axis. x_org
, y_org
: The world coordinates of the origin (point of intersection) of the X and Y axes. major_x
, major_y
: Unitless integer values specifying the number of minor tick intervals between major tick marks. Values of 0 or 1 imply no minor ticks. Negative values specify no labels will be drawn for the associated axis. tick_size
: The length of minor tick marks specified in a normalized device coordinate unit. Major tick marks are twice as long as minor tick marks. A negative value reverses the tick marks on the axes from inward facing to outward facing (or vice versa).
Tick marks are positioned along each axis so that major tick marks fall on the axes origin (whether visible or not). Major tick marks are labeled with the corresponding data values. Axes are drawn according to the scale of the window. Axes and tick marks are drawn using solid lines; line color and width can be modified using the setlinetype
and setlinewidth
functions. Axes are drawn according to the linear or logarithmic transformation established by the setscale
function.
GR.axeslbl
— Methodfunction axeslbl(x_tick::Real, y_tick::Real, x_org::Real, y_org::Real, major_x::Int, major_y::Int, tick_size::Real, fpx::Function, fpy::Function)
Draw X and Y coordinate axes with linearly and/or logarithmically spaced tick marks.
Tick marks are positioned along each axis so that major tick marks fall on the axes origin (whether visible or not). Major tick marks are labeled with the corresponding data values. Axes are drawn according to the scale of the window. Axes and tick marks are drawn using solid lines; line color and width can be modified using the setlinetype
and setlinewidth
functions. Axes are drawn according to the linear or logarithmic transformation established by the setscale
function.
Parameters:
x_tick
, y_tick
: The interval between minor tick marks on each axis. x_org
, y_org
: The world coordinates of the origin (point of intersection) of the X and Y axes. major_x
, major_y
: Unitless integer values specifying the number of minor tick intervals between major tick marks. Values of 0 or 1 imply no minor ticks. Negative values specify no labels will be drawn for the associated axis. tick_size
: The length of minor tick marks specified in a normalized device coordinate unit. Major tick marks are twice as long as minor tick marks. A negative value reverses the tick marks on the axes from inward facing to outward facing (or vice versa). fx
, fy
: Functions that returns a label for a given tick on the X or Y axis. Those functions should have the following arguments: x
, y
: Normalized device coordinates of the label in X and Y directions. svalue
: Internal string representation of the text drawn at (x,y)
. value
: Floating point representation of the label drawn at (x,y)
.
GR.begingraphics
— Methodbegingraphics(path)
Open a file for graphics output.
Parameters:
path
: Filename for the graphics file.
begingraphics
allows to write all graphics output into a XML-formatted file until the endgraphics
functions is called. The resulting file may later be imported with the importgraphics
function.
GR.beginprint
— Methodbeginprint(pathname)
Open and activate a print device.
Parameters:
pathname
: Filename for the print device.
beginprint
opens an additional graphics output device. The device type is obtained from the given file extension. The following file types are supported:
+-------------+---------------------------------------+
|.ps, .eps |PostScript |
+-------------+---------------------------------------+
|.pdf |Portable Document Format |
+-------------+---------------------------------------+
|.bmp |Windows Bitmap (BMP) |
+-------------+---------------------------------------+
|.jpeg, .jpg |JPEG image file |
+-------------+---------------------------------------+
|.png |Portable Network Graphics file (PNG) |
+-------------+---------------------------------------+
|.tiff, .tif |Tagged Image File Format (TIFF) |
+-------------+---------------------------------------+
|.fig |Xfig vector graphics file |
+-------------+---------------------------------------+
|.svg |Scalable Vector Graphics |
+-------------+---------------------------------------+
|.wmf |Windows Metafile |
+-------------+---------------------------------------+
GR.beginprintext
— Methodbeginprintext(pathname, mode, fmt, orientation)
Open and activate a print device with the given layout attributes.
Parameters:
pathname
: Filename for the print device. mode
: Output mode (Color, GrayScale) fmt
: Output format (see table below) orientation
: Page orientation (Landscape, Portait)
The available formats are:
+-----------+---------------+
|A4 |0.210 x 0.297 |
+-----------+---------------+
|B5 |0.176 x 0.250 |
+-----------+---------------+
|Letter |0.216 x 0.279 |
+-----------+---------------+
|Legal |0.216 x 0.356 |
+-----------+---------------+
|Executive |0.191 x 0.254 |
+-----------+---------------+
|A0 |0.841 x 1.189 |
+-----------+---------------+
|A1 |0.594 x 0.841 |
+-----------+---------------+
|A2 |0.420 x 0.594 |
+-----------+---------------+
|A3 |0.297 x 0.420 |
+-----------+---------------+
|A5 |0.148 x 0.210 |
+-----------+---------------+
|A6 |0.105 x 0.148 |
+-----------+---------------+
|A7 |0.074 x 0.105 |
+-----------+---------------+
|A8 |0.052 x 0.074 |
+-----------+---------------+
|A9 |0.037 x 0.052 |
+-----------+---------------+
|B0 |1.000 x 1.414 |
+-----------+---------------+
|B1 |0.500 x 0.707 |
+-----------+---------------+
|B10 |0.031 x 0.044 |
+-----------+---------------+
|B2 |0.500 x 0.707 |
+-----------+---------------+
|B3 |0.353 x 0.500 |
+-----------+---------------+
|B4 |0.250 x 0.353 |
+-----------+---------------+
|B6 |0.125 x 0.176 |
+-----------+---------------+
|B7 |0.088 x 0.125 |
+-----------+---------------+
|B8 |0.062 x 0.088 |
+-----------+---------------+
|B9 |0.044 x 0.062 |
+-----------+---------------+
|C5E |0.163 x 0.229 |
+-----------+---------------+
|Comm10E |0.105 x 0.241 |
+-----------+---------------+
|DLE |0.110 x 0.220 |
+-----------+---------------+
|Folio |0.210 x 0.330 |
+-----------+---------------+
|Ledger |0.432 x 0.279 |
+-----------+---------------+
|Tabloid |0.279 x 0.432 |
+-----------+---------------+
GR.cellarray
— Methodcellarray(xmin::Real, xmax::Real, ymin::Real, ymax::Real, dimx::Int, dimy::Int, color)
Display rasterlike images in a device-independent manner. The cell array function partitions a rectangle given by two corner points into DIMX X DIMY cells, each of them colored individually by the corresponding color index of the given cell array.
Parameters:
xmin
, ymin
: Lower left point of the rectangle xmax
, ymax
: Upper right point of the rectangle dimx
, dimy
: X and Y dimension of the color index array color
: Color index array
The values for xmin
, xmax
, ymin
and ymax
are in world coordinates.
GR.closews
— Methodclosews(workstation_id::Int)
Close the specified workstation.
Parameters:
workstation_id
: A workstation identifier.
GR.contour
— Methodcontour(px, py, h, pz, major_h::Int)
Draw contours of a three-dimensional data set whose values are specified over a rectangular mesh. Contour lines may optionally be labeled.
Parameters:
x
: A list containing the X coordinates y
: A list containing the Y coordinates h
: A list containing the Z coordinate for the height values z
: A list of length len(x)
* len(y)
or an appropriately dimensioned array containing the Z coordinates major_h
: Directs GR to label contour lines. For example, a value of 3 would label every third line. A value of 1 will label every line. A value of 0 produces no labels. To produce colored contour lines, add an offset of 1000 to major_h
.
GR.contourf
— Methodcontourf(px, py, h, pz, major_h::Int)
Draw filled contours of a three-dimensional data set whose values are specified over a rectangular mesh.
Parameters:
x
: A list containing the X coordinates y
: A list containing the Y coordinates h
: A list containing the Z coordinate for the height values z
: A list of length len(x)
* len(y)
or an appropriately dimensioned array containing the Z coordinates major_h
: (intended for future use)
GR.deactivatews
— Methoddeactivatews(workstation_id::Int)
Deactivate the specified workstation.
Parameters:
workstation_id
: A workstation identifier.
GR.drawarc
— Methoddrawarc(xmin::Real, xmax::Real, ymin::Real, ymax::Real, a1::Real, a2::Real)
Draw a circular or elliptical arc covering the specified rectangle.
Parameters:
xmin
: Lower left edge of the rectangle xmax
: Lower right edge of the rectangle ymin
: Upper left edge of the rectangle ymax
: Upper right edge of the rectangle a1
: The start angle a2
: The end angle
The resulting arc begins at a1
and ends at a2
degrees. Angles are interpreted such that 0 degrees is at the 3 o'clock position. The center of the arc is the center of the given rectangle.
GR.drawarrow
— Methoddrawarrow(x1::Real, y1::Real, x2::Real, y2::Real)
Draw an arrow between two points.
Parameters:
x1
, y1
: Starting point of the arrow (tail) x2
, y2
: Head of the arrow
Different arrow styles (angles between arrow tail and wing, optionally filled heads, double headed arrows) are available and can be set with the setarrowstyle
function.
GR.drawimage
— Functiondrawimage(xmin::Real, xmax::Real, ymin::Real, ymax::Real, width::Int, height::Int, data, model::Int = 0)
Draw an image into a given rectangular area.
Parameters:
xmin
, ymin
: First corner point of the rectangle xmax
, ymax
: Second corner point of the rectangle width
, height
: The width and the height of the image data
: An array of color values dimensioned width
by height
model
: Color model (default=0)
The available color models are:
+-----------------------+---+-----------+
|MODEL_RGB | 0| AABBGGRR|
+-----------------------+---+-----------+
|MODEL_HSV | 1| AAVVSSHH|
+-----------------------+---+-----------+
The points (xminx
, ymin
) and (xmax
, ymax
) are world coordinates defining diagonally opposite corner points of a rectangle. This rectangle is divided into width
by height
cells. The two-dimensional array data
specifies colors for each cell.
GR.drawpath
— Methoddrawpath(points, codes, fill::Int)
Draw simple and compound outlines consisting of line segments and bezier curves.
Parameters:
points
: (N, 2) array of (x, y) vertices codes
: N-length array of path codes fill
: A flag indication whether resulting path is to be filled or not
The following path codes are recognized:
+----------+-----------------------------------------------------------+
| STOP|end the entire path |
+----------+-----------------------------------------------------------+
| MOVETO|move to the given vertex |
+----------+-----------------------------------------------------------+
| LINETO|draw a line from the current position to the given vertex |
+----------+-----------------------------------------------------------+
| CURVE3|draw a quadratic Bézier curve |
+----------+-----------------------------------------------------------+
| CURVE4|draw a cubic Bézier curve |
+----------+-----------------------------------------------------------+
| CLOSEPOLY|draw a line segment to the start point of the current path |
+----------+-----------------------------------------------------------+
GR.drawrect
— Methoddrawrect(xmin::Real, xmax::Real, ymin::Real, ymax::Real)
Draw a rectangle using the current line attributes.
Parameters:
xmin
: Lower left edge of the rectangle xmax
: Lower right edge of the rectangle ymin
: Upper left edge of the rectangle ymax
: Upper right edge of the rectangle
GR.fillarc
— Methodfillarc(xmin::Real, xmax::Real, ymin::Real, ymax::Real, a1::Real, a2::Real)
Fill a circular or elliptical arc covering the specified rectangle.
Parameters:
xmin
: Lower left edge of the rectangle xmax
: Lower right edge of the rectangle ymin
: Upper left edge of the rectangle ymax
: Upper right edge of the rectangle a1
: The start angle a2
: The end angle
The resulting arc begins at a1
and ends at a2
degrees. Angles are interpreted such that 0 degrees is at the 3 o'clock position. The center of the arc is the center of the given rectangle.
GR.fillarea
— Methodfillarea(x, y)
Allows you to specify a polygonal shape of an area to be filled.
Parameters:
x
: A list containing the X coordinates y
: A list containing the Y coordinates
The attributes that control the appearance of fill areas are fill area interior style, fill area style index and fill area color index.
GR.fillrect
— Methodfillrect(xmin::Real, xmax::Real, ymin::Real, ymax::Real)
Draw a filled rectangle using the current fill attributes.
Parameters:
xmin
: Lower left edge of the rectangle xmax
: Lower right edge of the rectangle ymin
: Upper left edge of the rectangle ymax
: Upper right edge of the rectangle
GR.gdp
— Methodgdp(x, y, primid, datrec)
Generates a generalized drawing primitive (GDP) of the type you specify, using specified points and any additional information contained in a data record.
Parameters:
x
: A list containing the X coordinates y
: A list containing the Y coordinates primid
: Primitive identifier datrec
: Primitive data record
GR.grid
— Methodgrid(x_tick::Real, y_tick::Real, x_org::Real, y_org::Real, major_x::Int, major_y::Int)
Draw a linear and/or logarithmic grid.
Parameters:
x_tick
, y_tick
: The length in world coordinates of the interval between minor grid lines. x_org
, y_org
: The world coordinates of the origin (point of intersection) of the grid. major_x
, major_y
: Unitless integer values specifying the number of minor grid lines between major grid lines. Values of 0 or 1 imply no grid lines.
Major grid lines correspond to the axes origin and major tick marks whether visible or not. Minor grid lines are drawn at points equal to minor tick marks. Major grid lines are drawn using black lines and minor grid lines are drawn using gray lines.
GR.herrorbars
— Methodherrorbars(px, py, e1, e2)
Draw a standard horizontal error bar graph.
Parameters:
px
: A list of length N containing the X coordinates py
: A list of length N containing the Y coordinates e1
: The absolute values of the lower error bar data e2
: The absolute values of the upper error bar data
GR.init
— Functioninit(always::Bool = false)
Initialize GR's environmental variables before plotting and ensure that the
binary shared libraries are loaded. Initialization usually only needs to be
done once, but reinitialized may be required when settings change.
The `always` argument is true if initialization should be forced in the
current and subsequent calls. It is `false` by default so that
initialization only is done once.
# Extended Help
Environmental variables which influence `init`:
GRDISPLAY - if "js" or "pluto", javascript support is initialized
GKS_NO_GUI - no initialization is done
GKS_IGNORE_ENCODING - Force use of UTF-8 for font encoding, ignore GKS_ENCODING
Environmental variables set by `init`:
GKS_FONTPATH - path to GR fonts, often the same as GRDIR
GKS_USE_CAIRO_PNG
GKSwstype - Graphics workstation type, see help for `openws`
GKS_QT - Command to start QT backend via gksqt executable
GKS_ENCODING - Sets the text encoding (e.g. Latin1 or UTF-8)
GR.load_libs
— Functionload_libs(always = false)
Load shared GR libraries from either GR_jll or from GR tarball.
always is a boolean flag that is passed through to init.
GR.mathtex
— Methodmathtex(x::Real, y::Real, string)
Generate a character string starting at the given location. Strings can be defined to create mathematical symbols and Greek letters using LaTeX syntax.
Parameters:
x
, y
: Position of the text string specified in world coordinates string
: The text string to be drawn
GR.nonuniformcellarray
— Methodnonuniformcellarray(x, y, dimx::Int, dimy::Int, color)
Display a two dimensional color index array with nonuniform cell sizes.
Parameters:
x
, y
: X and Y coordinates of the cell edges dimx
, dimy
: X and Y dimension of the color index array color
: Color index array
The values for x
and y
are in world coordinates. x
must contain dimx
+ 1 elements and y
must contain dimy
+ 1 elements. The elements i and i+1 are respectively the edges of the i-th cell in X and Y direction.
GR.nonuniformpolarcellarray
— Methodnonuniformpolarcellarray(x, y, dimx::Int, dimy::Int, color)
Display a two dimensional color index array mapped to a disk using nonuniform polar coordinates.
Parameters:
x
, y
: X and Y coordinates of the cell edges dimx
, dimy
: X and Y dimension of the color index array color
: Color index array
The two dimensional color index array is mapped to the resulting image by interpreting the X-axis of the array as the angle and the Y-axis as the radius.
GR.openws
— Methodopenws(workstation_id::Int, connection, workstation_type::Int)
Open a graphical workstation.
Parameters:
workstation_id
: A workstation identifier. connection
: A connection identifier. workstation_type
: The desired workstation type.
Available workstation types:
+-------------+------------------------------------------------------+
| 5|Workstation Independent Segment Storage |
+-------------+------------------------------------------------------+
| 7, 8|Computer Graphics Metafile (CGM binary, clear text) |
+-------------+------------------------------------------------------+
| 41|Windows GDI |
+-------------+------------------------------------------------------+
| 51|Mac Quickdraw |
+-------------+------------------------------------------------------+
| 61 - 64|PostScript (b/w, color) |
+-------------+------------------------------------------------------+
| 101, 102|Portable Document Format (plain, compressed) |
+-------------+------------------------------------------------------+
| 210 - 213|X Windows |
+-------------+------------------------------------------------------+
| 214|Sun Raster file (RF) |
+-------------+------------------------------------------------------+
| 215, 218|Graphics Interchange Format (GIF87, GIF89) |
+-------------+------------------------------------------------------+
| 216|Motif User Interface Language (UIL) |
+-------------+------------------------------------------------------+
| 320|Windows Bitmap (BMP) |
+-------------+------------------------------------------------------+
| 321|JPEG image file |
+-------------+------------------------------------------------------+
| 322|Portable Network Graphics file (PNG) |
+-------------+------------------------------------------------------+
| 323|Tagged Image File Format (TIFF) |
+-------------+------------------------------------------------------+
| 370|Xfig vector graphics file |
+-------------+------------------------------------------------------+
| 371|Gtk |
+-------------+------------------------------------------------------+
| 380|wxWidgets |
+-------------+------------------------------------------------------+
| 381|Qt4 |
+-------------+------------------------------------------------------+
| 382|Scaleable Vector Graphics (SVG) |
+-------------+------------------------------------------------------+
| 390|Windows Metafile |
+-------------+------------------------------------------------------+
| 400|Quartz |
+-------------+------------------------------------------------------+
| 410|Socket driver |
+-------------+------------------------------------------------------+
| 415|0MQ driver |
+-------------+------------------------------------------------------+
| 420|OpenGL |
+-------------+------------------------------------------------------+
| 430|HTML5 Canvas |
+-------------+------------------------------------------------------+
GR.path
— Methodpath(x, y, codes)
Draw paths using the given vertices and path codes.
Parameters:
x
: A list containing the X coordinates y
: A list containing the Y coordinates codes
: A list containing the path codes
The values for x
and y
are in world coordinates. The codes
describe several path primitives that can be used to create compound paths.
The following path codes are recognized:
+–––––+––––––––––––––––-+–––––––––-+–––––––––-+ | Code | Description | x | y | +–––––+––––––––––––––––-+–––––––––-+–––––––––-+ | M, m | move | x | y | +–––––+––––––––––––––––-+–––––––––-+–––––––––-+ | L, l | line | x | y | +–––––+––––––––––––––––-+–––––––––-+–––––––––-+ | Q, q | quadratic Bezier | x1, x2 | y1, y2 | +–––––+––––––––––––––––-+–––––––––-+–––––––––-+ | C, c | cubic Bezier | x1, x2, x3 | y1, y2, y3 | +–––––+––––––––––––––––-+–––––––––-+–––––––––-+ | A, a | arc | rx, a1, reserved | ry, a2, reserved | +–––––+––––––––––––––––-+–––––––––-+–––––––––-+ | Z | close path | | | +–––––+––––––––––––––––-+–––––––––-+–––––––––-+ | S | stroke | | | +–––––+––––––––––––––––-+–––––––––-+–––––––––-+ | s | close path and stroke | | | +–––––+––––––––––––––––-+–––––––––-+–––––––––-+ | f | close path and fill | | | +–––––+––––––––––––––––-+–––––––––-+–––––––––-+ | F | close path, fill and stroke | | | +–––––+––––––––––––––––-+–––––––––-+–––––––––-+
Move:
M
,m
Moves the current position to (
x
,y
). The new position is either absolute (M
) or relative to the current position (m
). The initial position of :code:path
is (0, 0).Example:
path([0.5, -0.1], [0.2, 0.1], "Mm")
The first move command in this example moves the current position to the absolute coordinates (0.5, 0.2). The second move to performs a movement by (-0.1, 0.1) relative to the current position resulting in the point (0.4, 0.3).
Line:
L
,l
Draws a line from the current position to the given position (
x
,y
). The end point of the line is either absolute (L
) or relative to the current position (l
). The current position is set to the end point of the line.Example:
path([0.1, 0.5, 0.0], [0.1, 0.1, 0.2], "MLlS")
The first line to command draws a straight line from the current position (0.1, 0.1) to the absolute position (0.5, 0.1) resulting in a horizontal line. The second line to command draws a vertical line relative to the current position resulting in the end point (0.5, 0.3).
Quadratic Bezier curve:
Q
,q
Draws a quadratic bezier curve from the current position to the end point (
x2
,y2
) using (x1
,y1
) as the control point. Both points are either absolute (Q
) or relative to the current position (q
). The current position is set to the end point of the bezier curve.Example:
path([0.1, 0.3, 0.5, 0.2, 0.4], [0.1, 0.2, 0.1, 0.1, 0.0], "MQqS")
This example will generate two bezier curves whose start and end points are each located at y=0.1. As the control points are horizontally in the middle of each bezier curve with a higher y value both curves are symmetrical and bend slightly upwards in the middle. The current position is set to (0.9, 0.1) at the end.
Cubic Bezier curve:
C
,c
Draws a cubic bezier curve from the current position to the end point (
x3
,y3
) using (x1
,y1
) and (x2
,y2
) as the control points. All three points are either absolute (C
) or relative to the current position (c
). The current position is set to the end point of the bezier curve.Example:
path(
... [0.1, 0.2, 0.3, 0.4, 0.1, 0.2, 0.3], ... [0.1, 0.2, 0.0, 0.1, 0.1, -0.1, 0.0], ... "MCcS" ... )
This example will generate two bezier curves whose start and end points are each located at y=0.1. As the control points are equally spaced along the x-axis and the first is above and the second is below the start and end points this creates a wave-like shape for both bezier curves. The current position is set to (0.8, 0.1) at the end.
Ellipctical arc:
A
,a
Draws an elliptical arc starting at the current position. The major axis of the ellipse is aligned with the x-axis and the minor axis is aligned with the y-axis of the plot.
rx
andry
are the ellipses radii along the major and minor axis.a1
anda2
define the start and end angle of the arc in radians. The current position is set to the end point of the arc. Ifa2
is greater thana1
the arc is drawn counter-clockwise, otherwise it is drawn clockwise. Thea
andA
commands draw the same arc. The third coordinates of thex
andy
array are ignored and reserved for future use.Examples:
path([0.1, 0.2, -3.14159 / 2, 0.0], [0.1, 0.4, 3.14159 / 2, 0.0], "MAS")
This example draws an arc starting at (0.1, 0.1). As the start angle -pi/2 is smaller than the end angle pi/2 the arc is drawn counter-clockwise. In this case the right half of an ellipse with an x radius of 0.2 and a y radius of 0.4 is shown. Therefore the current position is set to (0.1, 0.9) at the end.
path([0.1, 0.2, 3.14159 / 2, 0.0], [0.9, 0.4, -3.14159 / 2, 0.0], "MAS")
This examples draws the same arc as the previous one. The only difference is that the starting point is now at (0.1, 0.9) and the start angle pi/2 is greater than the end angle -pi/2 so that the ellipse arc is drawn clockwise. Therefore the current position is set to (0.1, 0.1) at the end.
Close path:
Z
Closes the current path by connecting the current position to the target position of the last move command (
m
orM
) with a straight line. If no move to was performed in this path it connects the current position to (0, 0). When the path is stroked this line will also be drawn.
Stroke path:
S
,s
Strokes the path with the current border width and border color (set with :code:
gr.setborderwidth
and :code:gr.setbordercolorind
). In case ofs
the path is closed beforehand, which is equivalent toZS
.
Fill path:
F
,f
Fills the current path using the even-odd-rule using the current fill color. Filling a path implicitly closes the path. The fill color can be set using :code:
gr.setfillcolorind
. In case ofF
the path is also stroked using the current border width and color afterwards.
GR.polarcellarray
— Methodpolarcellarray(xorg::Real, yorg::Real, phimin::Real, phimax::Real, rmin::Real, rmax::Real, imphi::Int, dimr::Int, color)
Display a two dimensional color index array mapped to a disk using polar coordinates.
Parameters:
xorg
: X coordinate of the disk center in world coordinates yorg
: Y coordinate of the disk center in world coordinates phimin
: start angle of the disk sector in degrees phimax
: end angle of the disk sector in degrees rmin
: inner radius of the punctured disk in world coordinates rmax
: outer radius of the punctured disk in world coordinates dimiphi
, dimr
: Phi (X) and iR (Y) dimension of the color index array color
: Color index array
The two dimensional color index array is mapped to the resulting image by interpreting the X-axis of the array as the angle and the Y-axis as the radius. The center point of the resulting disk is located at xorg
, yorg
and the radius of the disk is rmax
.
GR.polyline
— Methodpolyline(x, y)
Draw a polyline using the current line attributes, starting from the first data point and ending at the last data point.
Parameters:
x
: A list containing the X coordinates y
: A list containing the Y coordinates
The values for x
and y
are in world coordinates. The attributes that control the appearance of a polyline are linetype, linewidth and color index.
GR.polyline3d
— Methodpolyline3d(px, py, pz)
Draw a 3D curve using the current line attributes, starting from the first data point and ending at the last data point.
Parameters:
x
: A list of length N containing the X coordinates y
: A list of length N containing the Y coordinates z
: A list of length N containing the Z coordinates
The values for x
, y
and z
are in world coordinates. The attributes that control the appearance of a polyline are linetype, linewidth and color index.
GR.polymarker
— Methodpolymarker(x, y)
Draw marker symbols centered at the given data points.
Parameters:
x
: A list containing the X coordinates y
: A list containing the Y coordinates
The values for x
and y
are in world coordinates. The attributes that control the appearance of a polymarker are marker type, marker size scale factor and color index.
GR.polymarker3d
— Methodpolymarker3d(px, py, pz)
Draw marker symbols centered at the given 3D data points.
Parameters:
x
: A list of length N containing the X coordinates y
: A list of length N containing the Y coordinates z
: A list of length N containing the Z coordinates
The values for x
, y
and z
are in world coordinates. The attributes that control the appearance of a polymarker are marker type, marker size scale factor and color index.
GR.selntran
— Methodselntran(transform::Int)
selntran
selects a predefined transformation from world coordinates to normalized device coordinates.
Parameters:
transform
: A normalization transformation number.
+------+----------------------------------------------------------------------------------------------------+
| 0|Selects the identity transformation in which both the window and viewport have the range of 0 to 1 |
+------+----------------------------------------------------------------------------------------------------+
| >= 1|Selects a normalization transformation as defined by `setwindow` and `setviewport` |
+------+----------------------------------------------------------------------------------------------------+
GR.setarrowsize
— Methodsetarrowsize(size::Real)
Set the arrow size to be used for subsequent arrow commands.
Parameters:
size
: The arrow size to be used
setarrowsize
defines the arrow size for subsequent arrow primitives. The default arrow size is 1.
GR.setarrowstyle
— Methodsetarrowstyle(style::Int)
Set the arrow style to be used for subsequent arrow commands.
Parameters:
style
: The arrow style to be used
setarrowstyle
defines the arrow style for subsequent arrow primitives. The default arrow style is 1.
+---+----------------------------------+
| 1|simple, single-ended |
+---+----------------------------------+
| 2|simple, single-ended, acute head |
+---+----------------------------------+
| 3|hollow, single-ended |
+---+----------------------------------+
| 4|filled, single-ended |
+---+----------------------------------+
| 5|triangle, single-ended |
+---+----------------------------------+
| 6|filled triangle, single-ended |
+---+----------------------------------+
| 7|kite, single-ended |
+---+----------------------------------+
| 8|filled kite, single-ended |
+---+----------------------------------+
| 9|simple, double-ended |
+---+----------------------------------+
| 10|simple, double-ended, acute head |
+---+----------------------------------+
| 11|hollow, double-ended |
+---+----------------------------------+
| 12|filled, double-ended |
+---+----------------------------------+
| 13|triangle, double-ended |
+---+----------------------------------+
| 14|filled triangle, double-ended |
+---+----------------------------------+
| 15|kite, double-ended |
+---+----------------------------------+
| 16|filled kite, double-ended |
+---+----------------------------------+
| 17|double line, single-ended |
+---+----------------------------------+
| 18|double line, double-ended |
+---+----------------------------------+
GR.setbordercolorind
— Methodsetbordercolorind(color::Int)
Define the color of subsequent path output primitives.
Parameters:
color
: The border color index (COLOR < 1256)
GR.setborderwidth
— Methodsetborderwidth(width::Real)
Define the border width of subsequent path output primitives.
Parameters:
width
: The border width scale factor
GR.setcharexpan
— Methodsetcharexpan(factor::Real)
Set the current character expansion factor (width to height ratio).
Parameters:
factor
: Text expansion factor applied to the nominal text width-to-height ratio
setcharexpan
defines the width of subsequent text output primitives. The expansion factor alters the width of the generated characters, but not their height. The default text expansion factor is 1, or one times the normal width-to-height ratio of the text.
GR.setcharheight
— Methodsetcharheight(height::Real)
Set the current character height.
Parameters:
height
: Text height value
setcharheight
defines the height of subsequent text output primitives. Text height is defined as a percentage of the default window. GR uses the default text height of 0.027 (2.7% of the height of the default window).
GR.setcharup
— Methodsetcharup(ux::Real, uy::Real)
Set the current character text angle up vector.
Parameters:
ux
, uy
: Text up vector
setcharup
defines the vertical rotation of subsequent text output primitives. The text up vector is initially set to (0, 1), horizontal to the baseline.
GR.setclip
— Methodsetclip(indicator::Int)
Set the clipping indicator.
Parameters:
indicator
: An indicator specifying whether clipping is on or off.
+----+---------------------------------------------------------------+
| 0|Clipping is off. Data outside of the window will be drawn. |
+----+---------------------------------------------------------------+
| 1|Clipping is on. Data outside of the window will not be drawn. |
+----+---------------------------------------------------------------+
setclip
enables or disables clipping of the image drawn in the current window. Clipping is defined as the removal of those portions of the graph that lie outside of the defined viewport. If clipping is on, GR does not draw generated output primitives past the viewport boundaries. If clipping is off, primitives may exceed the viewport boundaries, and they will be drawn to the edge of the workstation window. By default, clipping is on.
GR.setcolorrep
— Methodsetcolorrep(index::Int, red::Real, green::Real, blue::Real)
setcolorrep
allows to redefine an existing color index representation by specifying an RGB color triplet.
Parameters:
index
: Color index in the range 0 to 1256 red
: Red intensity in the range 0.0 to 1.0 green
: Green intensity in the range 0.0 to 1.0 blue
: Blue intensity in the range 0.0 to 1.0
GR.setcoordxform
— Methodsetcoordxform(mat)
Change the coordinate transformation according to the given matrix.
Parameters:
mat[3][2]
: 2D transformation matrix
GR.setfillcolorind
— Methodsetfillcolorind(color::Int)
Sets the current fill area color index.
Parameters:
color
: The fill area color index (COLOR < 1256)
setfillcolorind
defines the color of subsequent fill area output primitives. GR uses the default foreground color (black=1) for the default fill area color index.
GR.setfillintstyle
— Methodsetfillintstyle(style::Int)
Set the fill area interior style to be used for fill areas.
Parameters:
style
: The style of fill to be used
setfillintstyle
defines the interior style for subsequent fill area output primitives. The default interior style is HOLLOW.
+---------+---+--------------------------------------------------------------------------------+
|HOLLOW | 0|No filling. Just draw the bounding polyline |
+---------+---+--------------------------------------------------------------------------------+
|SOLID | 1|Fill the interior of the polygon using the fill color index |
+---------+---+--------------------------------------------------------------------------------+
|PATTERN | 2|Fill the interior of the polygon using the style index as a pattern index |
+---------+---+--------------------------------------------------------------------------------+
|HATCH | 3|Fill the interior of the polygon using the style index as a cross-hatched style |
+---------+---+--------------------------------------------------------------------------------+
GR.setfillstyle
— Methodsetfillstyle(index::Int)
Sets the fill style to be used for subsequent fill areas.
Parameters:
index
: The fill style index to be used
setfillstyle
specifies an index when PATTERN fill or HATCH fill is requested by the setfillintstyle
function. If the interior style is set to PATTERN, the fill style index points to a device-independent pattern table. If interior style is set to HATCH the fill style index indicates different hatch styles. If HOLLOW or SOLID is specified for the interior style, the fill style index is unused.
GR.setlinecolorind
— Methodsetlinecolorind(color::Int)
Define the color of subsequent polyline output primitives.
Parameters:
color
: The polyline color index (COLOR < 1256)
GR.setlinetype
— Methodsetlinetype(style::Int)
Specify the line style for polylines.
Parameters:
style
: The polyline line style
The available line types are:
+---------------------------+----+---------------------------------------------------+
|LINETYPE_SOLID | 1|Solid line |
+---------------------------+----+---------------------------------------------------+
|LINETYPE_DASHED | 2|Dashed line |
+---------------------------+----+---------------------------------------------------+
|LINETYPE_DOTTED | 3|Dotted line |
+---------------------------+----+---------------------------------------------------+
|LINETYPE_DASHED_DOTTED | 4|Dashed-dotted line |
+---------------------------+----+---------------------------------------------------+
|LINETYPE_DASH_2_DOT | -1|Sequence of one dash followed by two dots |
+---------------------------+----+---------------------------------------------------+
|LINETYPE_DASH_3_DOT | -2|Sequence of one dash followed by three dots |
+---------------------------+----+---------------------------------------------------+
|LINETYPE_LONG_DASH | -3|Sequence of long dashes |
+---------------------------+----+---------------------------------------------------+
|LINETYPE_LONG_SHORT_DASH | -4|Sequence of a long dash followed by a short dash |
+---------------------------+----+---------------------------------------------------+
|LINETYPE_SPACED_DASH | -5|Sequence of dashes double spaced |
+---------------------------+----+---------------------------------------------------+
|LINETYPE_SPACED_DOT | -6|Sequence of dots double spaced |
+---------------------------+----+---------------------------------------------------+
|LINETYPE_DOUBLE_DOT | -7|Sequence of pairs of dots |
+---------------------------+----+---------------------------------------------------+
|LINETYPE_TRIPLE_DOT | -8|Sequence of groups of three dots |
+---------------------------+----+---------------------------------------------------+
GR.setlinewidth
— Methodsetlinewidth(width::Real)
Define the line width of subsequent polyline output primitives.
Parameters:
width
: The polyline line width scale factor
The line width is calculated as the nominal line width generated on the workstation multiplied by the line width scale factor. This value is mapped by the workstation to the nearest available line width. The default line width is 1.0, or 1 times the line width generated on the graphics device.
GR.setmarkercolorind
— Methodsetmarkercolorind(color::Int)
Define the color of subsequent polymarker output primitives.
Parameters:
color
: The polymarker color index (COLOR < 1256)
GR.setmarkersize
— Methodsetmarkersize(mtype::Real)
Specify the marker size for polymarkers.
Parameters:
size
: Scale factor applied to the nominal marker size
The polymarker size is calculated as the nominal size generated on the graphics device multiplied by the marker size scale factor.
GR.setmarkertype
— Methodsetmarkertype(mtype::Int)
Specifiy the marker type for polymarkers.
Parameters:
style
: The polymarker marker type
The available marker types are:
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_DOT | 1|Smallest displayable dot |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_PLUS | 2|Plus sign |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_ASTERISK | 3|Asterisk |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_CIRCLE | 4|Hollow circle |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_DIAGONAL_CROSS | 5|Diagonal cross |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SOLID_CIRCLE | -1|Filled circle |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_TRIANGLE_UP | -2|Hollow triangle pointing upward |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SOLID_TRI_UP | -3|Filled triangle pointing upward |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_TRIANGLE_DOWN | -4|Hollow triangle pointing downward |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SOLID_TRI_DOWN | -5|Filled triangle pointing downward |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SQUARE | -6|Hollow square |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SOLID_SQUARE | -7|Filled square |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_BOWTIE | -8|Hollow bowtie |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SOLID_BOWTIE | -9|Filled bowtie |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_HGLASS | -10|Hollow hourglass |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SOLID_HGLASS | -11|Filled hourglass |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_DIAMOND | -12|Hollow diamond |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SOLID_DIAMOND | -13|Filled Diamond |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_STAR | -14|Hollow star |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SOLID_STAR | -15|Filled Star |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_TRI_UP_DOWN | -16|Hollow triangles pointing up and down overlaid |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SOLID_TRI_RIGHT | -17|Filled triangle point right |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SOLID_TRI_LEFT | -18|Filled triangle pointing left |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_HOLLOW PLUS | -19|Hollow plus sign |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_SOLID PLUS | -20|Solid plus sign |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_PENTAGON | -21|Pentagon |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_HEXAGON | -22|Hexagon |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_HEPTAGON | -23|Heptagon |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_OCTAGON | -24|Octagon |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_STAR_4 | -25|4-pointed star |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_STAR_5 | -26|5-pointed star (pentagram) |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_STAR_6 | -27|6-pointed star (hexagram) |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_STAR_7 | -28|7-pointed star (heptagram) |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_STAR_8 | -29|8-pointed star (octagram) |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_VLINE | -30|verical line |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_HLINE | -31|horizontal line |
+-----------------------------+-----+------------------------------------------------+
|MARKERTYPE_OMARK | -32|o-mark |
+-----------------------------+-----+------------------------------------------------+
Polymarkers appear centered over their specified coordinates.
GR.setscale
— Methodsetscale(options::Int)
setscale
sets the type of transformation to be used for subsequent GR output primitives.
Parameters:
options
: Scale specification (see Table below)
+---------------+--------------------+
|OPTION_X_LOG |Logarithmic X-axis |
+---------------+--------------------+
|OPTION_Y_LOG |Logarithmic Y-axis |
+---------------+--------------------+
|OPTION_Z_LOG |Logarithmic Z-axis |
+---------------+--------------------+
|OPTION_FLIP_X |Flip X-axis |
+---------------+--------------------+
|OPTION_FLIP_Y |Flip Y-axis |
+---------------+--------------------+
|OPTION_FLIP_Z |Flip Z-axis |
+---------------+--------------------+
|OPTION_X_LOG2 |log2 scaled X-axis |
+---------------+--------------------+
|OPTION_Y_LOG2 |log2 scaled Y-axis |
+---------------+--------------------+
|OPTION_Z_LOG2 |log2 scaled Z-axis |
+---------------+--------------------+
|OPTION_X_LN |ln scaled X-axis |
+---------------+--------------------+
|OPTION_Y_LN |ln scaled Y-axis |
+---------------+--------------------+
|OPTION_Z_LN |ln scaled Z-axis |
+---------------+--------------------+
setscale
defines the current transformation according to the given scale specification which may be or'ed together using any of the above options. GR uses these options for all subsequent output primitives until another value is provided. The scale options are used to transform points from an abstract logarithmic or semi-logarithmic coordinate system, which may be flipped along each axis, into the world coordinate system.
Note: When applying a logarithmic transformation to a specific axis, the system assumes that the axes limits are greater than zero.
GR.setshadow
— Methodsetshadow(offsetx::Real, offsety::Real, blur::Real)
setshadow
allows drawing of shadows, realized by images painted underneath, and offset from, graphics objects such that the shadow mimics the effect of a light source cast on the graphics objects.
Parameters:
offsetx
: An x-offset, which specifies how far in the horizontal direction the shadow is offset from the object offsety
: A y-offset, which specifies how far in the vertical direction the shadow is offset from the object blur
: A blur value, which specifies whether the object has a hard or a diffuse edge
GR.setspace
— Methodsetspace(zmin::Real, zmax::Real, rotation::Int, tilt::Int)
Set the abstract Z-space used for mapping three-dimensional output primitives into the current world coordinate space.
Parameters:
zmin
: Minimum value for the Z-axis. zmax
: Maximum value for the Z-axis. rotation
: Angle for the rotation of the X axis, in degrees. tilt
: Viewing angle of the Z axis in degrees.
setspace
establishes the limits of an abstract Z-axis and defines the angles for rotation and for the viewing angle (tilt) of a simulated three-dimensional graph, used for mapping corresponding output primitives into the current window. These settings are used for all subsequent three-dimensional output primitives until other values are specified. Angles of rotation and viewing angle must be specified between 0° and 90°.
GR.settextalign
— Methodsettextalign(horizontal::Int, vertical::Int)
Set the current horizontal and vertical alignment for text.
Parameters:
horizontal
: Horizontal text alignment (see the table below) vertical
: Vertical text alignment (see the table below)
settextalign
specifies how the characters in a text primitive will be aligned in horizontal and vertical space. The default text alignment indicates horizontal left alignment and vertical baseline alignment.
+-------------------------+---+----------------+
|TEXT_HALIGN_NORMAL | 0| |
+-------------------------+---+----------------+
|TEXT_HALIGN_LEFT | 1|Left justify |
+-------------------------+---+----------------+
|TEXT_HALIGN_CENTER | 2|Center justify |
+-------------------------+---+----------------+
|TEXT_HALIGN_RIGHT | 3|Right justify |
+-------------------------+---+----------------+
+-------------------------+---+------------------------------------------------+
|TEXT_VALIGN_NORMAL | 0| |
+-------------------------+---+------------------------------------------------+
|TEXT_VALIGN_TOP | 1|Align with the top of the characters |
+-------------------------+---+------------------------------------------------+
|TEXT_VALIGN_CAP | 2|Aligned with the cap of the characters |
+-------------------------+---+------------------------------------------------+
|TEXT_VALIGN_HALF | 3|Aligned with the half line of the characters |
+-------------------------+---+------------------------------------------------+
|TEXT_VALIGN_BASE | 4|Aligned with the base line of the characters |
+-------------------------+---+------------------------------------------------+
|TEXT_VALIGN_BOTTOM | 5|Aligned with the bottom line of the characters |
+-------------------------+---+------------------------------------------------+
GR.settextcolorind
— Methodsettextcolorind(color::Int)
Sets the current text color index.
Parameters:
color
: The text color index (COLOR < 1256)
settextcolorind
defines the color of subsequent text output primitives. GR uses the default foreground color (black=1) for the default text color index.
GR.settextfontprec
— Methodsettextfontprec(font::Int, precision::Int)
Specify the text font and precision for subsequent text output primitives.
Parameters:
font
: Text font (see tables below) precision
: Text precision (see table below)
The available text fonts are:
+--------------------------------------+-----+
|FONT_TIMES_ROMAN | 101|
+--------------------------------------+-----+
|FONT_TIMES_ITALIC | 102|
+--------------------------------------+-----+
|FONT_TIMES_BOLD | 103|
+--------------------------------------+-----+
|FONT_TIMES_BOLDITALIC | 104|
+--------------------------------------+-----+
|FONT_HELVETICA | 105|
+--------------------------------------+-----+
|FONT_HELVETICA_OBLIQUE | 106|
+--------------------------------------+-----+
|FONT_HELVETICA_BOLD | 107|
+--------------------------------------+-----+
|FONT_HELVETICA_BOLDOBLIQUE | 108|
+--------------------------------------+-----+
|FONT_COURIER | 109|
+--------------------------------------+-----+
|FONT_COURIER_OBLIQUE | 110|
+--------------------------------------+-----+
|FONT_COURIER_BOLD | 111|
+--------------------------------------+-----+
|FONT_COURIER_BOLDOBLIQUE | 112|
+--------------------------------------+-----+
|FONT_SYMBOL | 113|
+--------------------------------------+-----+
|FONT_BOOKMAN_LIGHT | 114|
+--------------------------------------+-----+
|FONT_BOOKMAN_LIGHTITALIC | 115|
+--------------------------------------+-----+
|FONT_BOOKMAN_DEMI | 116|
+--------------------------------------+-----+
|FONT_BOOKMAN_DEMIITALIC | 117|
+--------------------------------------+-----+
|FONT_NEWCENTURYSCHLBK_ROMAN | 118|
+--------------------------------------+-----+
|FONT_NEWCENTURYSCHLBK_ITALIC | 119|
+--------------------------------------+-----+
|FONT_NEWCENTURYSCHLBK_BOLD | 120|
+--------------------------------------+-----+
|FONT_NEWCENTURYSCHLBK_BOLDITALIC | 121|
+--------------------------------------+-----+
|FONT_AVANTGARDE_BOOK | 122|
+--------------------------------------+-----+
|FONT_AVANTGARDE_BOOKOBLIQUE | 123|
+--------------------------------------+-----+
|FONT_AVANTGARDE_DEMI | 124|
+--------------------------------------+-----+
|FONT_AVANTGARDE_DEMIOBLIQUE | 125|
+--------------------------------------+-----+
|FONT_PALATINO_ROMAN | 126|
+--------------------------------------+-----+
|FONT_PALATINO_ITALIC | 127|
+--------------------------------------+-----+
|FONT_PALATINO_BOLD | 128|
+--------------------------------------+-----+
|FONT_PALATINO_BOLDITALIC | 129|
+--------------------------------------+-----+
|FONT_ZAPFCHANCERY_MEDIUMITALIC | 130|
+--------------------------------------+-----+
|FONT_ZAPFDINGBATS | 131|
+--------------------------------------+-----+
The available text precisions are:
+---------------------------+---+--------------------------------------+
|TEXT_PRECISION_STRING | 0|String precision (higher quality) |
+---------------------------+---+--------------------------------------+
|TEXT_PRECISION_CHAR | 1|Character precision (medium quality) |
+---------------------------+---+--------------------------------------+
|TEXT_PRECISION_STROKE | 2|Stroke precision (lower quality) |
+---------------------------+---+--------------------------------------+
The appearance of a font depends on the text precision value specified. STRING, CHARACTER or STROKE precision allows for a greater or lesser realization of the text primitives, for efficiency. STRING is the default precision for GR and produces the highest quality output.
GR.settextpath
— Methodsettextpath(path::Int)
Define the current direction in which subsequent text will be drawn.
Parameters:
path
: Text path (see table below)
+----------------------+---+---------------+
|TEXT_PATH_RIGHT | 0|left-to-right |
+----------------------+---+---------------+
|TEXT_PATH_LEFT | 1|right-to-left |
+----------------------+---+---------------+
|TEXT_PATH_UP | 2|downside-up |
+----------------------+---+---------------+
|TEXT_PATH_DOWN | 3|upside-down |
+----------------------+---+---------------+
GR.settitles3d
— Methodsettitles3d(x_title, y_title, z_title)
Set axis titles to be displayed in subsequent axes calls.
Parameters:
x_title
, y_title
, z_title
: The text to be displayed on each axis
GR.settransparency
— Methodsettransparency(alpha::Real)
Set the value of the alpha component associated with GR colors.
Parameters:
alpha
: An alpha value (0.0 - 1.0)
GR.setviewport
— Methodsetviewport(xmin::Real, xmax::Real, ymin::Real, ymax::Real)
setviewport
establishes a rectangular subspace of normalized device coordinates.
Parameters:
xmin
: The left horizontal coordinate of the viewport. xmax
: The right horizontal coordinate of the viewport (0 <= xmin
< xmax
<= 1). ymin
: The bottom vertical coordinate of the viewport. ymax
: The top vertical coordinate of the viewport (0 <= ymin
< ymax
<= 1).
setviewport
defines the rectangular portion of the Normalized Device Coordinate (NDC) space to be associated with the specified normalization transformation. The NDC viewport and World Coordinate (WC) window define the normalization transformation through which all output primitives pass. The WC window is mapped onto the rectangular NDC viewport which is, in turn, mapped onto the display surface of the open and active workstation, in device coordinates.
GR.setwindow
— Methodsetwindow(xmin::Real, xmax::Real, ymin::Real, ymax::Real)
setwindow
establishes a window, or rectangular subspace, of world coordinates to be plotted. If you desire log scaling or mirror-imaging of axes, use the SETSCALE function.
Parameters:
xmin
: The left horizontal coordinate of the window (xmin
< xmax
). xmax
: The right horizontal coordinate of the window. ymin
: The bottom vertical coordinate of the window (ymin
< ymax
). ymax
: The top vertical coordinate of the window.
setwindow
defines the rectangular portion of the World Coordinate space (WC) to be associated with the specified normalization transformation. The WC window and the Normalized Device Coordinates (NDC) viewport define the normalization transformation through which all output primitives are mapped. The WC window is mapped onto the rectangular NDC viewport which is, in turn, mapped onto the display surface of the open and active workstation, in device coordinates. By default, GR uses the range [0,1] x [0,1], in world coordinates, as the normalization transformation window.
GR.setwsviewport
— Methodsetwsviewport(xmin::Real, xmax::Real, ymin::Real, ymax::Real)
Define the size of the workstation graphics window in meters.
Parameters:
xmin
: The left horizontal coordinate of the workstation viewport. xmax
: The right horizontal coordinate of the workstation viewport. ymin
: The bottom vertical coordinate of the workstation viewport. ymax
: The top vertical coordinate of the workstation viewport.
setwsviewport
places a workstation window on the display of the specified size in meters. This command allows the workstation window to be accurately sized for a display or hardcopy device, and is often useful for sizing graphs for desktop publishing applications.
GR.setwswindow
— Methodsetwswindow(xmin::Real, xmax::Real, ymin::Real, ymax::Real)
Set the area of the NDC viewport that is to be drawn in the workstation window.
Parameters:
xmin
: The left horizontal coordinate of the workstation window. xmax
: The right horizontal coordinate of the workstation window (0 <= xmin
< xmax
<= 1). ymin
: The bottom vertical coordinate of the workstation window. ymax
: The top vertical coordinate of the workstation window (0 <= ymin
< ymax
<= 1).
setwswindow
defines the rectangular area of the Normalized Device Coordinate space to be output to the device. By default, the workstation transformation will map the range [0,1] x [0,1] in NDC onto the largest square on the workstation’s display surface. The aspect ratio of the workstation window is maintained at 1 to 1.
GR.spline
— Methodspline(x, y, m, method)
Generate a cubic spline-fit, starting from the first data point and ending at the last data point.
Parameters:
x
: A list containing the X coordinates y
: A list containing the Y coordinates m
: The number of points in the polygon to be drawn (m
> len(x
)) method
: The smoothing method
The values for x
and y
are in world coordinates. The attributes that control the appearance of a spline-fit are linetype, linewidth and color index.
If method
is > 0, then a generalized cross-validated smoothing spline is calculated. If method
is 0, then an interpolating natural cubic spline is calculated. If method
is < -1, then a cubic B-spline is calculated.
GR.surface
— Methodsurface(px, py, pz, option::Int)
Draw a three-dimensional surface plot for the given data points.
Parameters:
x
: A list containing the X coordinates y
: A list containing the Y coordinates z
: A list of length len(x)
* len(y)
or an appropriately dimensioned array containing the Z coordinates option
: Surface display option (see table below)
x
and y
define a grid. z
is a singly dimensioned array containing at least nx
* ny
data points. Z describes the surface height at each point on the grid. Data is ordered as shown in the following table:
+------------------+--+--------------------------------------------------------------+
|LINES | 0|Use X Y polylines to denote the surface |
+------------------+--+--------------------------------------------------------------+
|MESH | 1|Use a wire grid to denote the surface |
+------------------+--+--------------------------------------------------------------+
|FILLED_MESH | 2|Applies an opaque grid to the surface |
+------------------+--+--------------------------------------------------------------+
|Z_SHADED_MESH | 3|Applies Z-value shading to the surface |
+------------------+--+--------------------------------------------------------------+
|COLORED_MESH | 4|Applies a colored grid to the surface |
+------------------+--+--------------------------------------------------------------+
|CELL_ARRAY | 5|Applies a grid of individually-colored cells to the surface |
+------------------+--+--------------------------------------------------------------+
|SHADED_MESH | 6|Applies light source shading to the 3-D surface |
+------------------+--+--------------------------------------------------------------+
GR.text
— Methodtext(x::Real, y::Real, string)
Draw a text at position x
, y
using the current text attributes.
Parameters:
x
: The X coordinate of starting position of the text string y
: The Y coordinate of starting position of the text string string
: The text to be drawn
The values for x
and y
are in normalized device coordinates. The attributes that control the appearance of text are text font and precision, character expansion factor, character spacing, text color index, character height, character up vector, text path and text alignment.
GR.textext
— Methodtextext(x::Real, y::Real, string)
Draw a text at position x
, y
using the current text attributes. Strings can be defined to create basic mathematical expressions and Greek letters.
Parameters:
x
: The X coordinate of starting position of the text string y
: The Y coordinate of starting position of the text string string
: The text to be drawn
The values for X and Y are in normalized device coordinates. The attributes that control the appearance of text are text font and precision, character expansion factor, character spacing, text color index, character height, character up vector, text path and text alignment.
The character string is interpreted to be a simple mathematical formula. The following notations apply:
Subscripts and superscripts: These are indicated by carets ('^') and underscores ('_'). If the sub/superscript contains more than one character, it must be enclosed in curly braces ('{}').
Fractions are typeset with A '/' B, where A stands for the numerator and B for the denominator.
To include a Greek letter you must specify the corresponding keyword after a backslash ('') character. The text translator produces uppercase or lowercase Greek letters depending on the case of the keyword.
+--------+---------+
|Letter |Keyword |
+--------+---------+
|Α α |alpha |
+--------+---------+
|Β β |beta |
+--------+---------+
|Γ γ |gamma |
+--------+---------+
|Δ δ |delta |
+--------+---------+
|Ε ε |epsilon |
+--------+---------+
|Ζ ζ |zeta |
+--------+---------+
|Η η |eta |
+--------+---------+
|Θ θ |theta |
+--------+---------+
|Ι ι |iota |
+--------+---------+
|Κ κ |kappa |
+--------+---------+
|Λ λ |lambda |
+--------+---------+
|Μ μ |mu |
+--------+---------+
|Ν ν |nu |
+--------+---------+
|Ξ ξ |xi |
+--------+---------+
|Ο ο |omicron |
+--------+---------+
|Π π |pi |
+--------+---------+
|Ρ ρ |rho |
+--------+---------+
|Σ σ |sigma |
+--------+---------+
|Τ τ |tau |
+--------+---------+
|Υ υ |upsilon |
+--------+---------+
|Φ φ |phi |
+--------+---------+
|Χ χ |chi |
+--------+---------+
|Ψ ψ |psi |
+--------+---------+
|Ω ω |omega |
+--------+---------+
For more sophisticated mathematical formulas, you should use the gr.mathtex
function.
GR.titles3d
— Methodtitles3d(x_title, y_title, z_title)
Display axis titles just outside of their respective axes.
Parameters:
x_title
, y_title
, z_title
: The text to be displayed on each axis
GR.tricontour
— Methodtricontour(x, y, z, levels)
Draw a contour plot for the given triangle mesh.
Parameters:
x
: A list containing the X coordinates y
: A list containing the Y coordinates z
: A list containing the Z coordinates levels
: A list containing the contour levels
GR.trisurface
— Methodtrisurface(x, y, z)
Draw a triangular surface plot for the given data points.
Parameters:
x
: A list containing the X coordinates y
: A list containing the Y coordinates z
: A list containing the Z coordinates
GR.verrorbars
— Methodverrorbars(px, py, e1, e2)
Draw a standard vertical error bar graph.
Parameters:
px
: A list of length N containing the X coordinates py
: A list of length N containing the Y coordinates e1
: The absolute values of the lower error bar data e2
: The absolute values of the upper error bar data