View source: R/plot.sample.size.R
plot.sample.size | R Documentation |
Plotting method for objects of the class "stylo.results"
, produced by
the function samplesize.penalize
. It can be used to show the behavior
of short samples in text classification. See the help page of
samplesize.penalize
for further details.
## S3 method for class 'sample.size'
plot(x, target = NULL, variable = "diversity",
trendline = TRUE, observations = FALSE,
grayscale = FALSE, legend = TRUE,
legend_pos = "bottomright", main = "default", ...)
x |
an object of class |
target |
the number of the text to be plotted, or its name as
stored in the |
variable |
choose either |
trendline |
since all the observations represented in the plot might be
difficult to read, one can use a trendline instead (default). The
trendlines are produced using the generic |
observations |
particular observations and a trendline (see above) can
be combined. Switch this option on, to do so (default: |
grayscale |
using this option, you can switch off colors. |
legend |
do you want to have the trendlines and/or observations explained? Switch this option on (which is default). |
legend_pos |
position of the legend: choose between
|
main |
title of the plot; use it as if it was a regular option
of the function |
... |
further arguments to be passed to |
An object generated by the samplesize.penalize
function can be of course
split into its parts and plotted using any other routine. The method discussed
in this document is a simple shortcut: rather than refine your plot parameters
from scratch, you can get acceptable results by using one single generic
function plot
; see a few examples below.
Maciej Eder
samplesize.penalize
## Not run:
# provided that there exists a text collection (text files)
# in the subdirectory 'corpus', perform a test for sample size:
results = samplesize.penalize(corpus.dir = "corpus")
# then plot the first text's classification accuracy:
plot(results)
# plot the results, e.g. for the 5th text:
plot(results, target = 5)
# the 'target' parameter can be set via the text's name,
# to see which texts are available in the results, type:
results$test.texts
# plot Simpson's diversity index for the text named 'Woolf_Years_1937':
plot(results_classic, target = "Woolf_Years_1937", variable = "diversity")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.