View source: R/plot-piechart.R
plotPieChart | R Documentation |
Producing a Pie Chart
plotPieChart(
data = NULL,
metaData = NULL,
dataMapping = NULL,
colorPalette = NULL,
start = NULL,
clockwiseDirection = NULL,
plotConfiguration = NULL,
plotObject = NULL
)
data |
A data.frame to use for plot. |
metaData |
A named list of information about |
dataMapping |
A |
colorPalette |
color palette property from |
start |
Offset of starting point from 12 o'clock in radians. Offset is applied clockwise or anticlockwise depending on value of direction |
clockwiseDirection |
logical defining if values are displayed in clockwise order |
plotConfiguration |
An optional |
plotObject |
An optional |
A ggplot
object
Other molecule plots:
plotBoxWhisker()
,
plotCumulativeTimeProfile()
,
plotDDIRatio()
,
plotGrid()
,
plotHistogram()
,
plotObsVsPred()
,
plotObservedTimeProfile()
,
plotPKRatio()
,
plotQQ()
,
plotResVsPred()
,
plotResVsTime()
,
plotSimulatedTimeProfile()
,
plotTimeProfile()
,
plotTornado()
# Data for the pie chart
values <- runif(5)
data <- data.frame(
values = values,
text = paste0(round(100 * values / sum(values)), "%"),
legend = letters[1:5]
)
# Plot pie chart with its legend
plotPieChart(
data = data,
dataMapping = PieChartDataMapping$new(x = "values", fill = "legend")
)
# Plot pie chart with text within pie
plotPieChart(
data = data,
dataMapping = PieChartDataMapping$new(x = "values", y = "text", fill = "legend")
)
# Reverse direction of pie chart
plotPieChart(
data = data,
dataMapping = PieChartDataMapping$new(x = "values", y = "text", fill = "legend"),
clockwiseDirection = FALSE
)
# Start first slice of pie at 90 degrees
plotPieChart(
data = data,
dataMapping = PieChartDataMapping$new(x = "values", y = "text", fill = "legend"),
start = pi / 2
)
# Leverages ggplot color palettes
plotPieChart(
data = data,
dataMapping = PieChartDataMapping$new(x = "values", y = "text", fill = "legend"),
colorPalette = ColorPalettes$Set1
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.