Title: | Make 'ggplot2' Look Like 'gnuplot' |
---|---|
Description: | Provides a theme, a discrete color palette, and continuous scales to make 'ggplot2' look like 'gnuplot'. This may be helpful if you use both 'ggplot2' and 'gnuplot' in one project. |
Authors: | Hannes Riebl [aut, cre] |
Maintainer: | Hannes Riebl <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2025-02-11 03:11:05 UTC |
Source: | https://github.com/hriebl/ggnuplot |
These functions provide gnuplot's default color palette.
Use scale_color_gnuplot()
and scale_fill_gnuplot()
with ggplot2,
and gnupalette()
or the vector gnucolors
otherwise.
scale_color_gnuplot(..., na.value = "gray50", aesthetics = "color") scale_fill_gnuplot(..., na.value = "gray50", aesthetics = "fill") gnupalette(n)
scale_color_gnuplot(..., na.value = "gray50", aesthetics = "color") scale_fill_gnuplot(..., na.value = "gray50", aesthetics = "fill") gnupalette(n)
... |
Arguments passed on to
|
na.value |
Colour to use for missing values |
aesthetics |
Character string or vector of character strings listing the
name(s) of the aesthetic(s) that this scale works with. This can be useful, for
example, to apply colour settings to the |
n |
The number of colors to return |
library(ggplot2) ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) + geom_point() + scale_color_gnuplot() + scale_x_gnuplot() + scale_y_gnuplot() + theme_gnuplot() gnupalette(3) gnucolors[1:3]
library(ggplot2) ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) + geom_point() + scale_color_gnuplot() + scale_x_gnuplot() + scale_y_gnuplot() + theme_gnuplot() gnupalette(3) gnucolors[1:3]
These functions set up gnuplot-like secondary axes. They also try to choose pretty breaks/ticks for continuous data. Your mileage with the breaks/ticks may vary, so be sure to try different settings.
scale_x_gnuplot(breaks = gnubreaks(), sec.axis = gnuaxis(), ...) scale_y_gnuplot(breaks = gnubreaks(), sec.axis = gnuaxis(), ...) gnubreaks(n = 5, padding = 0.1)
scale_x_gnuplot(breaks = gnubreaks(), sec.axis = gnuaxis(), ...) scale_y_gnuplot(breaks = gnubreaks(), sec.axis = gnuaxis(), ...) gnubreaks(n = 5, padding = 0.1)
breaks |
One of:
|
sec.axis |
|
... |
Other arguments passed on to |
n |
The number of breaks/ticks to return |
padding |
The amount of space between the outermost breaks/ticks and the axis limits relative to the axis range. A number between 0 and 0.5. |
The labeling package for alternative
break/tick functions, and ggplot2::dup_axis()
,
for which gnuaxis()
is an alias
library(ggplot2) ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) + geom_point() + scale_color_gnuplot() + scale_x_gnuplot() + scale_y_gnuplot() + theme_gnuplot()
library(ggplot2) ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) + geom_point() + scale_color_gnuplot() + scale_x_gnuplot() + scale_y_gnuplot() + theme_gnuplot()
This theme makes ggplot2 look like gnuplot.
It is based on ggplot2::theme_linedraw()
and has inward ticks.
theme_gnuplot( base_size = 11, base_family = "", base_line_size = base_size/22, base_rect_size = base_size/22 )
theme_gnuplot( base_size = 11, base_family = "", base_line_size = base_size/22, base_rect_size = base_size/22 )
base_size |
base font size |
base_family |
base font family |
base_line_size |
base size for line elements |
base_rect_size |
base size for rect elements |
The default ggplot2 themes and ggplot2::theme()
library(ggplot2) ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) + geom_point() + scale_color_gnuplot() + scale_x_gnuplot() + scale_y_gnuplot() + theme_gnuplot()
library(ggplot2) ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) + geom_point() + scale_color_gnuplot() + scale_x_gnuplot() + scale_y_gnuplot() + theme_gnuplot()