Title: | Get You to Your Desired Plot Faster |
---|---|
Description: | Streamlines the creation of common charts by taking care of a lot of data preprocessing and plot customization for the user. Provides a high-level interface for creating plots using 'ggplot2'. |
Authors: | Thomas Neitmann [aut, cre, cph], Julia Silge [ctb, cph], David Robinson [ctb, cph], Rafael Silva [ctb], IBM [cph] (IBM Plex Sans), Google [cph] (Open Sans), Cooper Hewitt Smithsonian Design Museum [cph] (Cooper Hewitt) |
Maintainer: | Thomas Neitmann <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.1 |
Built: | 2024-11-09 04:08:09 UTC |
Source: | https://github.com/thomas-neitmann/ggcharts |
Easily create a bar chart
bar_chart( data, x, y, facet = NULL, ..., bar_color = "auto", highlight = NULL, sort = TRUE, horizontal = TRUE, top_n = NULL, threshold = NULL, other = FALSE, limit = NULL ) column_chart( data, x, y, facet = NULL, ..., bar_color = "auto", highlight = NULL, sort = NULL, horizontal = FALSE, top_n = NULL, threshold = NULL, limit = NULL )
bar_chart( data, x, y, facet = NULL, ..., bar_color = "auto", highlight = NULL, sort = TRUE, horizontal = TRUE, top_n = NULL, threshold = NULL, other = FALSE, limit = NULL ) column_chart( data, x, y, facet = NULL, ..., bar_color = "auto", highlight = NULL, sort = NULL, horizontal = FALSE, top_n = NULL, threshold = NULL, limit = NULL )
data |
Dataset to use for the bar chart |
x |
|
y |
|
facet |
|
... |
Additional arguments passed to |
bar_color |
|
highlight |
|
sort |
|
horizontal |
|
top_n |
|
threshold |
|
other |
|
limit |
Deprecated. use |
Both top_n
and threshold
only work when sort = TRUE
.
Attempting to use them when sort = FALSE
will result in an error.
Furthermore, only top_n
or threshold
can be used at a time.
Providing a value for both top_n
and threshold
will result in
an error as well.
column_chart()
is a shortcut for bar_chart()
with
horizontal = FALSE
and sort = FALSE
if x
is
numeric
.
An object of class ggplot
Thomas Neitmann
For more details have a look at these vignettes:
vignette("highlight", package = "ggcharts")
vignette("customize", package = "ggcharts")
data(biomedicalrevenue) revenue2018 <- biomedicalrevenue[biomedicalrevenue$year == 2018, ] revenue_roche <- biomedicalrevenue[biomedicalrevenue$company == "Roche", ] ## By default bar_chart() creates a horizontal and sorted plot bar_chart(revenue2018, company, revenue) ## If the `y` argument is missing the count of each value in `x` is displayed bar_chart(mtcars, cyl) ## Create a vertical, non-sorted bar chart bar_chart(revenue_roche, year, revenue, horizontal = FALSE, sort = FALSE) ## column_chart() is a shortcut for the above column_chart(revenue_roche, year, revenue) ## Limit the number of bars to the top 10 bar_chart(revenue2018, company, revenue, top_n = 10) ## Display only companies with revenue > 40B. bar_chart(revenue2018, company, revenue, threshold = 40) ## Change the bar color bar_chart(revenue2018, company, revenue, bar_color = "purple") ## Highlight a single bar bar_chart(revenue2018, company, revenue, top_n = 10, highlight = "Roche") ## Use facets to show the top 5 companies over the years bar_chart(biomedicalrevenue, company, revenue, facet = year, top_n = 5)
data(biomedicalrevenue) revenue2018 <- biomedicalrevenue[biomedicalrevenue$year == 2018, ] revenue_roche <- biomedicalrevenue[biomedicalrevenue$company == "Roche", ] ## By default bar_chart() creates a horizontal and sorted plot bar_chart(revenue2018, company, revenue) ## If the `y` argument is missing the count of each value in `x` is displayed bar_chart(mtcars, cyl) ## Create a vertical, non-sorted bar chart bar_chart(revenue_roche, year, revenue, horizontal = FALSE, sort = FALSE) ## column_chart() is a shortcut for the above column_chart(revenue_roche, year, revenue) ## Limit the number of bars to the top 10 bar_chart(revenue2018, company, revenue, top_n = 10) ## Display only companies with revenue > 40B. bar_chart(revenue2018, company, revenue, threshold = 40) ## Change the bar color bar_chart(revenue2018, company, revenue, bar_color = "purple") ## Highlight a single bar bar_chart(revenue2018, company, revenue, top_n = 10, highlight = "Roche") ## Use facets to show the top 5 companies over the years bar_chart(biomedicalrevenue, company, revenue, facet = year, top_n = 5)
Annual revenues of top biomedical companies from 2011 to 2018
biomedicalrevenue
biomedicalrevenue
A data frame with 224 rows and 3 variables:
Name of the company
Fiscal year
Revenue in billion USD
https://en.wikipedia.org/wiki/List_of_largest_biomedical_companies_by_revenue
Easily create a diverging bar chart
diverging_bar_chart( data, x, y, bar_colors = c("#1F77B4", "#FF7F0E"), text_color = "auto", text_size = 10 )
diverging_bar_chart( data, x, y, bar_colors = c("#1F77B4", "#FF7F0E"), text_color = "auto", text_size = 10 )
data |
Dataset to use for the diverging bar chart |
x |
|
y |
|
bar_colors |
A |
text_color |
|
text_size |
|
An object of class ggplot
Thomas Neitmann
To learn how to further customize this plot have a look at the 'customize' vignette:
vignette("customize", package = "ggcharts")
if (requireNamespace("tidyr")) { library(magrittr) data(biomedicalrevenue) biomedicalrevenue %>% dplyr::filter(year > 2016) %>% tidyr::pivot_wider( values_from = revenue, names_from = year, names_prefix = "revenue_" ) %>% dplyr::mutate(diff = revenue_2018 - revenue_2017) %>% diverging_bar_chart(company, diff) } data(mtcars) mtcars_z <- dplyr::transmute( .data = mtcars, model = row.names(mtcars), hpz = scale(hp) ) diverging_bar_chart(mtcars_z, model, hpz) ## Change the colors diverging_bar_chart(mtcars_z, model, hpz, bar_color = c("darkgreen", "darkred")) ## Decrease the axis label font size diverging_bar_chart(mtcars_z, model, hpz, text_size = 8) ## Display the axis label text in the same color as the bars diverging_bar_chart(mtcars_z, model, hpz, text_color = c("#1F77B4", "#FF7F0E"))
if (requireNamespace("tidyr")) { library(magrittr) data(biomedicalrevenue) biomedicalrevenue %>% dplyr::filter(year > 2016) %>% tidyr::pivot_wider( values_from = revenue, names_from = year, names_prefix = "revenue_" ) %>% dplyr::mutate(diff = revenue_2018 - revenue_2017) %>% diverging_bar_chart(company, diff) } data(mtcars) mtcars_z <- dplyr::transmute( .data = mtcars, model = row.names(mtcars), hpz = scale(hp) ) diverging_bar_chart(mtcars_z, model, hpz) ## Change the colors diverging_bar_chart(mtcars_z, model, hpz, bar_color = c("darkgreen", "darkred")) ## Decrease the axis label font size diverging_bar_chart(mtcars_z, model, hpz, text_size = 8) ## Display the axis label text in the same color as the bars diverging_bar_chart(mtcars_z, model, hpz, text_color = c("#1F77B4", "#FF7F0E"))
Easily create a diverging lollipop chart
diverging_lollipop_chart( data, x, y, lollipop_colors = c("#1F77B4", "#FF7F0E"), line_size = 0.75, point_size = 3, text_color = "auto", text_size = 10 )
diverging_lollipop_chart( data, x, y, lollipop_colors = c("#1F77B4", "#FF7F0E"), line_size = 0.75, point_size = 3, text_color = "auto", text_size = 10 )
data |
Dataset to use for the diverging lollipop chart |
x |
|
y |
|
lollipop_colors |
A |
line_size |
|
point_size |
|
text_color |
|
text_size |
|
An object of class ggplot
Thomas Neitmann
To learn how to further customize this plot have a look at the 'customize' vignette:
vignette("customize", package = "ggcharts")
if (requireNamespace("tidyr")) { library(magrittr) data(biomedicalrevenue) biomedicalrevenue %>% dplyr::filter(year > 2016) %>% tidyr::pivot_wider( values_from = revenue, names_from = year, names_prefix = "revenue_" ) %>% dplyr::mutate(diff = revenue_2018 - revenue_2017) %>% diverging_lollipop_chart(company, diff) } data(mtcars) mtcars_z <- dplyr::transmute( .data = mtcars, model = row.names(mtcars), hpz = scale(hp) ) diverging_lollipop_chart(mtcars_z, model, hpz) ## Change the colors diverging_lollipop_chart(mtcars_z, model, hpz, lollipop_colors = c("darkgreen", "darkred")) ## Decrease the axis label font size diverging_lollipop_chart(mtcars_z, model, hpz, text_size = 8) ## Display the axis label text in the same color as the bars diverging_lollipop_chart(mtcars_z, model, hpz, text_color = c("#1F77B4", "#FF7F0E"))
if (requireNamespace("tidyr")) { library(magrittr) data(biomedicalrevenue) biomedicalrevenue %>% dplyr::filter(year > 2016) %>% tidyr::pivot_wider( values_from = revenue, names_from = year, names_prefix = "revenue_" ) %>% dplyr::mutate(diff = revenue_2018 - revenue_2017) %>% diverging_lollipop_chart(company, diff) } data(mtcars) mtcars_z <- dplyr::transmute( .data = mtcars, model = row.names(mtcars), hpz = scale(hp) ) diverging_lollipop_chart(mtcars_z, model, hpz) ## Change the colors diverging_lollipop_chart(mtcars_z, model, hpz, lollipop_colors = c("darkgreen", "darkred")) ## Decrease the axis label font size diverging_lollipop_chart(mtcars_z, model, hpz, text_size = 8) ## Display the axis label text in the same color as the bars diverging_lollipop_chart(mtcars_z, model, hpz, text_color = c("#1F77B4", "#FF7F0E"))
Easily create a dumbbell chart
dumbbell_chart( data, x, y1, y2, line_size = 1.5, line_color = "lightgray", point_size = 4, point_colors = c("#1F77B4", "#FF7F0E"), sort = TRUE, horizontal = TRUE, top_n = NULL, legend = TRUE, legend_labels = waiver(), limit = NULL )
dumbbell_chart( data, x, y1, y2, line_size = 1.5, line_color = "lightgray", point_size = 4, point_colors = c("#1F77B4", "#FF7F0E"), sort = TRUE, horizontal = TRUE, top_n = NULL, legend = TRUE, legend_labels = waiver(), limit = NULL )
data |
Dataset to use for the dumbbell chart |
x |
|
y1 |
|
y2 |
|
line_size |
|
line_color |
|
point_size |
|
point_colors |
|
sort |
|
horizontal |
|
top_n |
|
legend |
|
legend_labels |
|
limit |
Deprecated. use |
An object of class ggplot
Thomas Neitmann
To learn how to further customize this plot have a look at the 'customize' vignette:
vignette("customize", package = "ggcharts")
data(popeurope) dumbbell_chart(popeurope, country, pop1952, pop2007) # Display only the top 10 countries in terms of population in 2007 dumbbell_chart(popeurope, country, pop1952, pop2007, top_n = 10) # Change line and point color dumbbell_chart(popeurope, country, pop1952, pop2007, top_n = 10, line_color = "lightgray", point_color = c("lightgray", "black")) # Add custom legend labels dumbbell_chart(popeurope, country, pop1952, pop2007, top_n = 10, legend_labels = c("1952", "2007")) # Increase line width and point size dumbbell_chart(popeurope, country, pop1952, pop2007, top_n = 10, line_size = 2, point_size = 5)
data(popeurope) dumbbell_chart(popeurope, country, pop1952, pop2007) # Display only the top 10 countries in terms of population in 2007 dumbbell_chart(popeurope, country, pop1952, pop2007, top_n = 10) # Change line and point color dumbbell_chart(popeurope, country, pop1952, pop2007, top_n = 10, line_color = "lightgray", point_color = c("lightgray", "black")) # Add custom legend labels dumbbell_chart(popeurope, country, pop1952, pop2007, top_n = 10, legend_labels = c("1952", "2007")) # Increase line width and point size dumbbell_chart(popeurope, country, pop1952, pop2007, top_n = 10, line_size = 2, point_size = 5)
Retrieve the color used by default for a given ggcharts
theme
ggcharts_get_default_color(theme)
ggcharts_get_default_color(theme)
theme |
|
The default color for the given theme as a character
Thomas Neitmann
ggcharts_get_default_color("theme_hermit") ggcharts_get_default_color("theme_ng")
ggcharts_get_default_color("theme_hermit") ggcharts_get_default_color("theme_ng")
The current theme is automatically applied to any plot created with
ggcharts
. It does not affect plots created with ggplot2
.
ggcharts_get_theme() ggcharts_set_theme(theme, ...)
ggcharts_get_theme() ggcharts_set_theme(theme, ...)
theme |
|
... |
Additional argument passed onto the specified |
ggchart_set_theme
invisibly returns the name of the previously active
theme as a character
. ggchart_get_theme
returns the name of the
currently active theme as a character
.
Thomas Neitmann
data("diamonds", package = "ggplot2") ## By default `theme_ggcharts()` is used ggcharts_get_theme() bar_chart(diamonds, cut) ggcharts_set_theme("theme_hermit") bar_chart(diamonds, cut) ggcharts_set_theme("theme_ng") bar_chart(diamonds, cut) ggcharts_set_theme("theme_nightblue", base_size = 18, base_family = "serif") bar_chart(diamonds, cut) ## Restore the default ggcharts_set_theme("theme_ggcharts")
data("diamonds", package = "ggplot2") ## By default `theme_ggcharts()` is used ggcharts_get_theme() bar_chart(diamonds, cut) ggcharts_set_theme("theme_hermit") bar_chart(diamonds, cut) ggcharts_set_theme("theme_ng") bar_chart(diamonds, cut) ggcharts_set_theme("theme_nightblue", base_size = 18, base_family = "serif") bar_chart(diamonds, cut) ## Restore the default ggcharts_set_theme("theme_ggcharts")
Create a highlight specification to pass on to a chart function
highlight_spec(what, highlight_color = NULL, other_color = NULL)
highlight_spec(what, highlight_color = NULL, other_color = NULL)
what |
|
highlight_color |
|
other_color |
|
highlight_color
must be of length 1 or the same length as what
. If it is of
length 1 then all values in what
are highlighted with the same color.
If highlight_color
is NULL
(the default) then it is set to the default
color of the currently active ggcharts
theme, i.e. ggcharts_get_default_color(ggcharts_get_theme())
.
If other_color
is NULL
is is automatically determined from the background
color of the currently active ggcharts
theme.
An object of class ggcharts_highlight_spec
Thomas Neitmann
data("biomedicalrevenue") revenue2018 <- biomedicalrevenue[biomedicalrevenue$year == 2018, ] spec <- highlight_spec("Bayer") bar_chart(revenue2018, company, revenue, highlight = spec) spec <- highlight_spec("Bayer", "black", "gray") bar_chart(revenue2018, company, revenue, highlight = spec) spec <- highlight_spec(c("Bayer", "Novartis")) bar_chart(revenue2018, company, revenue, highlight = spec) spec <- highlight_spec(c("Bayer", "AstraZeneca"), c("darkgreen", "darkorange")) bar_chart(revenue2018, company, revenue, highlight = spec) ggcharts_set_theme("theme_ng") spec <- highlight_spec("Novartis") lollipop_chart(revenue2018, company, revenue, highlight = spec)
data("biomedicalrevenue") revenue2018 <- biomedicalrevenue[biomedicalrevenue$year == 2018, ] spec <- highlight_spec("Bayer") bar_chart(revenue2018, company, revenue, highlight = spec) spec <- highlight_spec("Bayer", "black", "gray") bar_chart(revenue2018, company, revenue, highlight = spec) spec <- highlight_spec(c("Bayer", "Novartis")) bar_chart(revenue2018, company, revenue, highlight = spec) spec <- highlight_spec(c("Bayer", "AstraZeneca"), c("darkgreen", "darkorange")) bar_chart(revenue2018, company, revenue, highlight = spec) ggcharts_set_theme("theme_ng") spec <- highlight_spec("Novartis") lollipop_chart(revenue2018, company, revenue, highlight = spec)
Easily create a line chart
line_chart(data, x, y, group, line_color = "auto", line_size = 1)
line_chart(data, x, y, group, line_color = "auto", line_size = 1)
data |
Dataset used for the line chart |
x |
|
y |
|
group |
|
line_color |
|
line_size |
|
For plotting multiple lines line_chart()
can handle data in long or wide format.
If the data is in long format pass the variable that identifies individual lines
to the group
argument. If the data is in wide format pass a selection of variables
to the y
argument.
An object of class ggplot
Thomas Neitmann
library(dplyr, warn.conflicts = FALSE) data("biomedicalrevenue") data("revenue_wide") line_chart(revenue_wide, year, Roche) line_chart(revenue_wide, year, Roche, line_size = 1.5) line_chart(revenue_wide, year, Roche, line_color = "darkorange") ## Plot multiple lines (data is in long format) biomedicalrevenue %>% filter(company %in% c("Roche", "Novartis", "Bayer")) %>% line_chart(year, revenue, group = company) ## Plot multiple lines (data in wide format, i.e. one column per line) ## Select multiple columns with `c()` line_chart(revenue_wide, year, c(Roche, Novartis, Bayer)) ## Select all columns from Novartis to Sanofi suing `:` line_chart(revenue_wide, year, Novartis:Sanofi) ## Select all columns starting with "B" line_chart(revenue_wide, year, starts_with("B"))
library(dplyr, warn.conflicts = FALSE) data("biomedicalrevenue") data("revenue_wide") line_chart(revenue_wide, year, Roche) line_chart(revenue_wide, year, Roche, line_size = 1.5) line_chart(revenue_wide, year, Roche, line_color = "darkorange") ## Plot multiple lines (data is in long format) biomedicalrevenue %>% filter(company %in% c("Roche", "Novartis", "Bayer")) %>% line_chart(year, revenue, group = company) ## Plot multiple lines (data in wide format, i.e. one column per line) ## Select multiple columns with `c()` line_chart(revenue_wide, year, c(Roche, Novartis, Bayer)) ## Select all columns from Novartis to Sanofi suing `:` line_chart(revenue_wide, year, Novartis:Sanofi) ## Select all columns starting with "B" line_chart(revenue_wide, year, starts_with("B"))
Easily create a lollipop chart
lollipop_chart( data, x, y, facet = NULL, ..., line_size = 0.75, line_color = "auto", point_size = 4, point_color = line_color, highlight = NULL, sort = TRUE, horizontal = TRUE, top_n = NULL, threshold = NULL, other = FALSE, limit = NULL )
lollipop_chart( data, x, y, facet = NULL, ..., line_size = 0.75, line_color = "auto", point_size = 4, point_color = line_color, highlight = NULL, sort = TRUE, horizontal = TRUE, top_n = NULL, threshold = NULL, other = FALSE, limit = NULL )
data |
Dataset to use for the bar chart |
x |
|
y |
|
facet |
|
... |
Additional arguments passed to |
line_size |
|
line_color |
|
point_size |
|
point_color |
|
highlight |
|
sort |
|
horizontal |
|
top_n |
|
threshold |
|
other |
|
limit |
Deprecated. use |
Both top_n
and threshold
only work when sort = TRUE
.
Attempting to use them when sort = FALSE
will result in an error.
Furthermore, only top_n
or threshold
can be used at a time.
Providing a value for both top_n
and threshold
will result in
an error as well.
An object of class ggplot
Thomas Neitmann
For more details have a look at these vignettes:
vignette("highlight", package = "ggcharts")
vignette("customize", package = "ggcharts")
data(biomedicalrevenue) revenue2016 <- biomedicalrevenue[biomedicalrevenue$year == 2016, ] revenue_bayer <- biomedicalrevenue[biomedicalrevenue$company == "Bayer", ] ## By default lollipop_chart() creates a horizontal and sorted plot lollipop_chart(revenue2016, company, revenue) ## If the `y` argument is missing the count of each value in `x` is displayed lollipop_chart(mtcars, cyl) ## Create a vertical, non-sorted lollipop chart lollipop_chart(revenue_bayer, year, revenue, horizontal = FALSE, sort = FALSE) ## Limit the number of lollipops to the top 15 lollipop_chart(revenue2016, company, revenue, top_n = 15) ## Display only companies with revenue > 50B. lollipop_chart(revenue2016, company, revenue, threshold = 50) ## Change the color of the whole lollipop lollipop_chart(revenue2016, company, revenue, line_color = "purple") ## Change the color of the lollipop stick and head individually lollipop_chart(revenue2016, company, revenue, point_color = "darkgreen", line_color = "gray") ## Decrease the lollipop head size lollipop_chart(revenue2016, company, revenue, point_size = 2.5) ## Highlight a single lollipop lollipop_chart(revenue2016, company, revenue, top_n = 15, highlight = "Roche") ## Use facets to show the top 10 companies over the years lollipop_chart(biomedicalrevenue, company, revenue, facet = year, top_n = 10)
data(biomedicalrevenue) revenue2016 <- biomedicalrevenue[biomedicalrevenue$year == 2016, ] revenue_bayer <- biomedicalrevenue[biomedicalrevenue$company == "Bayer", ] ## By default lollipop_chart() creates a horizontal and sorted plot lollipop_chart(revenue2016, company, revenue) ## If the `y` argument is missing the count of each value in `x` is displayed lollipop_chart(mtcars, cyl) ## Create a vertical, non-sorted lollipop chart lollipop_chart(revenue_bayer, year, revenue, horizontal = FALSE, sort = FALSE) ## Limit the number of lollipops to the top 15 lollipop_chart(revenue2016, company, revenue, top_n = 15) ## Display only companies with revenue > 50B. lollipop_chart(revenue2016, company, revenue, threshold = 50) ## Change the color of the whole lollipop lollipop_chart(revenue2016, company, revenue, line_color = "purple") ## Change the color of the lollipop stick and head individually lollipop_chart(revenue2016, company, revenue, point_color = "darkgreen", line_color = "gray") ## Decrease the lollipop head size lollipop_chart(revenue2016, company, revenue, point_size = 2.5) ## Highlight a single lollipop lollipop_chart(revenue2016, company, revenue, top_n = 15, highlight = "Roche") ## Use facets to show the top 10 companies over the years lollipop_chart(biomedicalrevenue, company, revenue, facet = year, top_n = 10)
Swiss population in 2020 by five-year age groups
popch
popch
A data frame with 42 rows and 3 variables:
Five-year age group
Sex
Population
US Census International Data Base
Population of European countries in 1952 and 2007
popeurope
popeurope
A data frame with 30 rows and 3 variables:
Name of the country
Population in 1952 (in millions)
Population in 2007 (in millions)
http://www.gapminder.org/data/
Easily create a pyramid chart
pyramid_chart( data, x, y, group, bar_colors = c("#1F77B4", "#FF7F0E"), sort = "no", xlab = NULL, title = NULL )
pyramid_chart( data, x, y, group, bar_colors = c("#1F77B4", "#FF7F0E"), sort = "no", xlab = NULL, title = NULL )
data |
Dataset to use for the pyramid chart |
x |
|
y |
|
group |
|
bar_colors |
|
sort |
|
xlab |
|
title |
|
An object of class ggplot
Thomas Neitmann
data(popch) pyramid_chart(popch, age, pop, sex) ## Change bar colors pyramid_chart(popch, age, pop, sex, bar_colors = c("darkgreen", "darkorange")) ## Change x axis label and add title pyramid_chart(popch, age, pop, sex, xlab = "Population", title = "Switzerland 2020")
data(popch) pyramid_chart(popch, age, pop, sex) ## Change bar colors pyramid_chart(popch, age, pop, sex, bar_colors = c("darkgreen", "darkorange")) ## Change x axis label and add title pyramid_chart(popch, age, pop, sex, xlab = "Population", title = "Switzerland 2020")
Annual revenues of top biomedical companies from 2011 to 2018 in wide format
revenue_wide
revenue_wide
A data frame with 8 rows and 29 variables:
Fiscal year
Revenue of Johnson & Johnson in billion USD
Revenue of Roche in billion USD
Revenue of Pfizer in billion USD
Revenue of Novartis in billion USD
Revenue of Bayer in billion USD
Revenue of GlaxoSmithKline in billion USD
Revenue of Merck & Co. in billion USD
Revenue of Sanofi in billion USD
Revenue of AbbVie in billion USD
Revenue of Abbott Laboratories in billion USD
Revenue of Eli Lilly & Co in billion USD
Revenue of Amgen in billion USD
Revenue of Bristol-Myers Squibb in billion USD
Revenue of Gilead Sciences in billion USD
Revenue of AstraZeneca in billion USD
Revenue of / Teva Pharmaceutical Industries in billion USD
Revenue of Boehringer Ingelheim in billion USD
Revenue of Takeda Pharmaceutical in billion USD
Revenue of Merck Group in billion USD
Revenue of Novo Nordisk in billion USD
Revenue of Allergan plc in billion USD
Revenue of Danaher Corporation in billion USD
Revenue of Celgene in billion USD
Revenue of Biogen in billion USD
Revenue of Astellas Pharma in billion USD
Revenue of Labcorp in billion USD
Revenue of Baxter International in billion USD
Revenue of Mylan in billion USD
https://en.wikipedia.org/wiki/List_of_largest_biomedical_companies_by_revenue
A theme inspired by coffee
theme_coffee( base_size = 13, base_family = "Cooper Hewitt", header_family = "Cooper Hewitt", axis = "", ticks = "", grid = "" )
theme_coffee( base_size = 13, base_family = "Cooper Hewitt", header_family = "Cooper Hewitt", axis = "", ticks = "", grid = "" )
base_size |
|
base_family |
|
header_family |
|
axis |
|
ticks |
|
grid |
|
An object of class theme
Thomas Neitmann
For more details see the 'theme' vignette:
vignette("theme", package = "ggcharts")
library(ggplot2) library(dplyr) scatter <- ggplot(mtcars, aes(hp, mpg)) + geom_point(color = "#F4C95D") scatter + theme_coffee() scatter + theme_coffee(grid = "XY") scatter + theme_coffee(axis = "xy", ticks = "xy") bar_chart(ggplot2::diamonds, cut, bar_color = "#F4C95D") + theme_coffee(axis = "y", grid = "Y") column_chart(ggplot2::diamonds, cut, bar_color = "#F4C95D") + theme_coffee(axis = "x", grid = "X") ggcharts::biomedicalrevenue %>% filter(company == "Roche") %>% ggplot(aes(year, revenue)) + geom_line(color = "#F4C95D", size = 1) + scale_y_continuous(expand = expand_scale(c(0, .05))) + theme_coffee(grid = "X", axis = "x", ticks = "x")
library(ggplot2) library(dplyr) scatter <- ggplot(mtcars, aes(hp, mpg)) + geom_point(color = "#F4C95D") scatter + theme_coffee() scatter + theme_coffee(grid = "XY") scatter + theme_coffee(axis = "xy", ticks = "xy") bar_chart(ggplot2::diamonds, cut, bar_color = "#F4C95D") + theme_coffee(axis = "y", grid = "Y") column_chart(ggplot2::diamonds, cut, bar_color = "#F4C95D") + theme_coffee(axis = "x", grid = "X") ggcharts::biomedicalrevenue %>% filter(company == "Roche") %>% ggplot(aes(year, revenue)) + geom_line(color = "#F4C95D", size = 1) + scale_y_continuous(expand = expand_scale(c(0, .05))) + theme_coffee(grid = "X", axis = "x", ticks = "x")
The default ggcharts theme
theme_ggcharts( base_size = 13, base_family = "Cooper Hewitt", header_family = "Cooper Hewitt", axis = "", ticks = "", grid = "" )
theme_ggcharts( base_size = 13, base_family = "Cooper Hewitt", header_family = "Cooper Hewitt", axis = "", ticks = "", grid = "" )
base_size |
|
base_family |
|
header_family |
|
axis |
|
ticks |
|
grid |
|
theme_ggcharts
is the default theme used when creating any plot with
ggcharts
.
An object of class theme
Thomas Neitmann
For more details see the 'theme' vignette:
vignette("theme", package = "ggcharts")
library(ggplot2) library(dplyr) scatter <- ggplot(mtcars, aes(hp, mpg)) + geom_point(color = "steelblue") scatter + theme_ggcharts() scatter + theme_ggcharts(grid = "XY") scatter + theme_ggcharts(axis = "xy", ticks = "xy") bar_chart(ggplot2::diamonds, cut) + theme_ggcharts(axis = "y", grid = "Y") column_chart(ggplot2::diamonds, cut) + theme_ggcharts(axis = "x", grid = "X") ggcharts::biomedicalrevenue %>% filter(company == "Roche") %>% ggplot(aes(year, revenue)) + geom_line(color = "steelblue", size = 1) + scale_y_continuous(expand = expand_scale(c(0, .05))) + theme_ggcharts(grid = "X", axis = "x", ticks = "x")
library(ggplot2) library(dplyr) scatter <- ggplot(mtcars, aes(hp, mpg)) + geom_point(color = "steelblue") scatter + theme_ggcharts() scatter + theme_ggcharts(grid = "XY") scatter + theme_ggcharts(axis = "xy", ticks = "xy") bar_chart(ggplot2::diamonds, cut) + theme_ggcharts(axis = "y", grid = "Y") column_chart(ggplot2::diamonds, cut) + theme_ggcharts(axis = "x", grid = "X") ggcharts::biomedicalrevenue %>% filter(company == "Roche") %>% ggplot(aes(year, revenue)) + geom_line(color = "steelblue", size = 1) + scale_y_continuous(expand = expand_scale(c(0, .05))) + theme_ggcharts(grid = "X", axis = "x", ticks = "x")
A ggplot2 theme inspired by the 'hermit' Hugo theme
theme_hermit( base_size = 13, base_family = "Cooper Hewitt", header_family = "Cooper Hewitt", axis = "", ticks = "", grid = "" )
theme_hermit( base_size = 13, base_family = "Cooper Hewitt", header_family = "Cooper Hewitt", axis = "", ticks = "", grid = "" )
base_size |
|
base_family |
|
header_family |
|
axis |
|
ticks |
|
grid |
|
An object of class theme
Thomas Neitmann
For more details see the 'theme' vignette:
vignette("theme", package = "ggcharts")
library(ggplot2) library(dplyr) scatter <- ggplot(mtcars, aes(hp, mpg)) + geom_point(color = "yellow") scatter + theme_hermit() scatter + theme_hermit(grid = "XY") scatter + theme_hermit(axis = "xy", ticks = "xy") bar_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_hermit(axis = "y", grid = "Y") column_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_hermit(axis = "x", grid = "X") ggcharts::biomedicalrevenue %>% filter(company == "Roche") %>% ggplot(aes(year, revenue)) + geom_line(color = "yellow", size = 1) + scale_y_continuous(expand = expand_scale(c(0, .05))) + theme_hermit(grid = "X", axis = "x", ticks = "x")
library(ggplot2) library(dplyr) scatter <- ggplot(mtcars, aes(hp, mpg)) + geom_point(color = "yellow") scatter + theme_hermit() scatter + theme_hermit(grid = "XY") scatter + theme_hermit(axis = "xy", ticks = "xy") bar_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_hermit(axis = "y", grid = "Y") column_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_hermit(axis = "x", grid = "X") ggcharts::biomedicalrevenue %>% filter(company == "Roche") %>% ggplot(aes(year, revenue)) + geom_line(color = "yellow", size = 1) + scale_y_continuous(expand = expand_scale(c(0, .05))) + theme_hermit(grid = "X", axis = "x", ticks = "x")
A ggplot2 theme inspired with the 'hello friend ng' Hugo theme
theme_ng( base_size = 13, base_family = "Cooper Hewitt", header_family = "Cooper Hewitt", axis = "", ticks = "", grid = "" )
theme_ng( base_size = 13, base_family = "Cooper Hewitt", header_family = "Cooper Hewitt", axis = "", ticks = "", grid = "" )
base_size |
|
base_family |
|
header_family |
|
axis |
|
ticks |
|
grid |
|
An object of class theme
Thomas Neitmann
For more details see the 'theme' vignette:
vignette("theme", package = "ggcharts")
library(ggplot2) library(dplyr) scatter <- ggplot(mtcars, aes(hp, mpg)) + geom_point(color = "yellow") scatter + theme_ng() scatter + theme_ng(grid = "XY") scatter + theme_ng(axis = "xy", ticks = "xy") bar_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_ng(axis = "y", grid = "Y") column_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_ng(axis = "x", grid = "X") ggcharts::biomedicalrevenue %>% filter(company == "Roche") %>% ggplot(aes(year, revenue)) + geom_line(color = "yellow", size = 1) + scale_y_continuous(expand = expand_scale(c(0, .05))) + theme_ng(grid = "X", axis = "x", ticks = "x")
library(ggplot2) library(dplyr) scatter <- ggplot(mtcars, aes(hp, mpg)) + geom_point(color = "yellow") scatter + theme_ng() scatter + theme_ng(grid = "XY") scatter + theme_ng(axis = "xy", ticks = "xy") bar_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_ng(axis = "y", grid = "Y") column_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_ng(axis = "x", grid = "X") ggcharts::biomedicalrevenue %>% filter(company == "Roche") %>% ggplot(aes(year, revenue)) + geom_line(color = "yellow", size = 1) + scale_y_continuous(expand = expand_scale(c(0, .05))) + theme_ng(grid = "X", axis = "x", ticks = "x")
A theme inspired by the RStudio 'Tomorrow Night Blue' editor theme
theme_nightblue( base_size = 13, base_family = "Cooper Hewitt", header_family = "Cooper Hewitt", axis = "", ticks = "", grid = "" )
theme_nightblue( base_size = 13, base_family = "Cooper Hewitt", header_family = "Cooper Hewitt", axis = "", ticks = "", grid = "" )
base_size |
|
base_family |
|
header_family |
|
axis |
|
ticks |
|
grid |
|
An object of class theme
Thomas Neitmann
For more details see the 'theme' vignette:
vignette("theme", package = "ggcharts")
library(ggplot2) library(dplyr) scatter <- ggplot(mtcars, aes(hp, mpg)) + geom_point(color = "#EBBBFF") scatter + theme_nightblue() scatter + theme_nightblue(grid = "XY") scatter + theme_nightblue(axis = "xy", ticks = "xy") bar_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_nightblue(axis = "y", grid = "Y") column_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_nightblue(axis = "x", grid = "X") ggcharts::biomedicalrevenue %>% filter(company == "Roche") %>% ggplot(aes(year, revenue)) + geom_line(color = "yellow", size = 1) + scale_y_continuous(expand = expand_scale(c(0, .05))) + theme_nightblue(grid = "X", axis = "x", ticks = "x")
library(ggplot2) library(dplyr) scatter <- ggplot(mtcars, aes(hp, mpg)) + geom_point(color = "#EBBBFF") scatter + theme_nightblue() scatter + theme_nightblue(grid = "XY") scatter + theme_nightblue(axis = "xy", ticks = "xy") bar_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_nightblue(axis = "y", grid = "Y") column_chart(ggplot2::diamonds, cut, bar_color = "darkorange") + theme_nightblue(axis = "x", grid = "X") ggcharts::biomedicalrevenue %>% filter(company == "Roche") %>% ggplot(aes(year, revenue)) + geom_line(color = "yellow", size = 1) + scale_y_continuous(expand = expand_scale(c(0, .05))) + theme_nightblue(grid = "X", axis = "x", ticks = "x")