Description Usage Arguments Details References See Also Examples
Plot methods for bv (bivariate) and tv (trivariate) objects.
Note that you can use the standard plot function.
Also, note that the misc3d package needs to be installed and loaded, in order to plot the trivariate normal distribution.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | ########################################
#discrete uniform
########################################
## S3 method for class 'DUBVPMF'
bv.plotf(f, in3d=TRUE, ..., xlim, ylim, all=FALSE)
## S3 method for class 'DUBVCDF'
bv.plotf(F, in3d=TRUE, ..., xlim, ylim)
########################################
#binomial
########################################
## S3 method for class 'BNBVPMF'
bv.plotf(f, in3d=TRUE, ..., xlim, ylim, all=FALSE)
## S3 method for class 'BNBVCDF'
bv.plotf(F, in3d=TRUE, ..., xlim, ylim)
########################################
#poisson
########################################
## S3 method for class 'PBVPMF'
bv.plotf(f, in3d=TRUE, ..., xlim, ylim, all=FALSE)
## S3 method for class 'PBVCDF'
bv.plotf(F, in3d=TRUE, ..., xlim, ylim)
########################################
#continuous uniform
########################################
## S3 method for class 'CUBVPDF'
bv.plotf(f, in3d=TRUE, ..., all=FALSE, n=20)
## S3 method for class 'CUBVCDF'
bv.plotf(F, in3d=TRUE, ..., n=20)
########################################
#normal
#(bivariate and trivariate)
########################################
## S3 method for class 'NBVPDF'
bv.plotf(f, in3d=TRUE, ..., xlim, ylim, all=FALSE, n=30)
## S3 method for class 'NBVCDF'
bv.plotf(F, in3d=TRUE, ..., xlim, ylim, n=30)
## S3 method for class 'NTVPDF'
bv.plotf(f, iso=TRUE, ..., xlim, ylim, zlim)
########################################
#bimodal
########################################
## S3 method for class 'BMBVPDF'
bv.plotf(f, in3d=TRUE, ..., xlim, ylim, all=FALSE, n=40)
## S3 method for class 'BMBVCDF'
bv.plotf(F, in3d=TRUE, ..., xlim, ylim, n=40)
########################################
#categorical, dirichlet, kernel, ecdf
########################################
## S3 method for class 'GBVPMF'
bv.plotf(f, in3d=TRUE, data, ...)
## S3 method for class 'DTVPDF'
bv.plotf(f, in3d=TRUE, ..., log=FALSE, n=30)
## S3 method for class 'KBVPDF'
bv.plotf(fh, in3d=TRUE, data = (fh@n <= 2000), ...,
xlim, ylim, n=30, point.color="#00000030")
## S3 method for class 'EBVCDF'
bv.plotf(Fh, in3d=TRUE, ..., reg = (Fh@n > 40) )
########################################
#additional plotting functions
#(called by the ebvcdf method, above)
########################################
ebvcdf_plot_reg (Fh, in3d=TRUE, ..., xlim, ylim, n=30)
ebvcdf_plot_step_2d (Fh, data=TRUE, steps=data, ...,
point.color="#00000030", line.color="#000000", border.color="#808080",
main.colff = st.litmus.fit (theme), rim.colff=rim.litmus.fit,
theme)
ebvcdf_plot_step_3d (Fh, ...,
top.color = st.top.color (theme), side.color = st.side.color (theme),
rim.color="#D0D0D0",
theme)
|
f, F, fh, Fh |
A function representing a PMF/PDF or CDF, from this package. |
in3d |
Logical value, if true, a 3d plot, if false, a 2d plot. |
xlim, ylim, zlim |
The x, y and z ranges for the plot. |
all |
Logical value, if true, plot a two by two array of both the PMF/PDF and CDF using both 2d and 3d plots. |
n |
Integer vector of length one or two, the number of grid bins/points in each x and y direction. |
iso |
Logical value, if true, plot isosurfaces. |
log |
Logical value, if true, plot the log density. |
reg |
Logical value, if true, plot the probability distribution as a continuous surface, evaluated over a regularly-spaced grid. |
data |
Logical value, if true, plot the data points/labels. |
steps |
Logical value, if true, plot the steps. |
point.color, line.color, border.color |
String, the color for points, lines and borders. |
top.color, side.color, rim.color |
Strings, giving the bar top, bar side and rim bar colors. |
main.colff, rim.colff |
Litmus-fitting functions. |
theme |
Refer to barsurf package. |
... |
Other arguments for plotting functions in the barsurf package. |
You can use the standard plot function.
i.e. Calling plot will call the bv.plotf function.
GENERAL INFORMATION
These functions call functions in the barsurf package:
2d plotting functions call plot_dfield, plot_cfield or plot_tricontour.
(The categorical method, calls plot_matrix, which calls plot_dfield).
3d plotting functions call plot_bar, plot_surface or plot_trisurface.
Except for the trivariate normal method, which calls plotf_isosurface or plotf_cfield3.
Re-iterating, the misc3d package needs to be installed and loaded, in order to plot the trivariate normal distribution.
The barsurf package is built on top of the base graphics system, but uses a different color system.
You will need to refer to the documentation for that package to change surface and heatmap colors.
DEFAULTS
As of bivariate version 0.6.0, 3d plots are the default.
By default, 3d plots use reference arrows.
(This can be changed by first calling set.bs.options with ref.arrows=FALSE).
By default, 3d PMFs/PDFs have no z axis markup, but 3d CDFs do.
(This can be changed by setting the z.axis argument to true or false).
By default, 3d PMFs/PDFs have zlim equal to c (0, zmax).
And by default, 3d CDFs have zlim equal to c (0, 1).
Where in general, zmax will be the maximum value of the PMF/PDF, within the evaluation window.
Exceptions include uniform distributions (which use zero to one, if the maximum function value is less than or equal to one) and Dirichlet distributions (which vertically center the surface, if all alpha parameters are equal to one).
By default, 2d PMFs/PDFs have unlabelled contour lines, and 2d CDFs have labelled contour lines at 0.2, 0.4, 0.6 and 0.8.
(The ncontours, contour.labels, fb and clabs arguments, can be used to change this).
CATEGORICAL DISTRIBUTIONS
Note that the 2d plot has a different orientation to other 2d plots in this package.
For optimal results, you should update the plot margins, before and after the calling the plot method.
(This can be done, using the matrix.margins function, from the barsurf package).
EMPIRICAL CUMULATIVE DISTRIBUTION FUNCTIONS
The plot method for ebvcdf objects calls either plot_ebvcdf_reg, plot_ebvcdf_step_2d or plot_ebvcdf_step_3d, depending on the in3d and reg arguments.
The plot_ebvcdf_step_2d and plot_ebvcdf_step_3d functions plot the ECDF as a step function.
(This could be regarded as an exact representation).
The plot_ebvcdf_reg function plots the ECDF as a continuous surface, evaluated over a regularly-spaced grid.
(This could be regarded as an approximation).
Note that setting reg=FALSE for large sample sizes, is probably a bad idea.
(But the continuous approximation improves as the sample size increases).
Refer to the vignette for an overview, references, theoretical background and better examples.
Uniform
For uniform distributions.
Binomial, Poisson and Categorical
For other probability distributions of discrete random variables.
Normal, Bimodal, Dirichlet and Nonparametric
For other probability distributions of continuous random variables.
Density Matrices
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ########################################
#PDF
########################################
f <- nbvpdf ()
plot (f)
plot (f, z.axis=TRUE, ref.arrows=FALSE)
plot (f, grid=FALSE, n=60)
plot (f, FALSE)
plot (f, FALSE, hcv=TRUE)
########################################
#CDF
########################################
F <- nbvcdf ()
plot (F)
plot (F, FALSE)
plot (F, FALSE, fb=0.5)
tempff <- function (x)
barsurf::hot.and.cold.fit (x, t = c (0.45, 0.55) )
plot (F, gradient.shading=FALSE, colff=tempff, n=60)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.