Title: | Mini Bubble Plots for Comparison of Discrete Data with 'ggplot2' |
---|---|
Description: | When comparing discrete data mini bubble plots allow displaying more information than traditional bubble plots via colour, shape or labels. Exact overlapping coordinates will be transformed so they surround the original point circularly without overlapping. This is implemented as a position_surround() function for 'ggplot2'. |
Authors: | Thomas Schwarzl [aut, cre] |
Maintainer: | Thomas Schwarzl <[email protected]> |
License: | LGPL (>= 3) |
Version: | 0.1.4 |
Built: | 2024-12-04 07:16:47 UTC |
Source: | CRAN |
each side has several layers, with a number of positions in the layer
calc_offset(position, layer, side, offset_x = 0.1, offset_y = 0.1)
calc_offset(position, layer, side, offset_x = 0.1, offset_y = 0.1)
position |
number for position at the particular side on the layer |
layer |
number of layer |
side |
side for offset 1 - top 2 - right 3 - bottom 4 - left |
offset_x |
offset for x axis |
offset_y |
offset for y axis |
integer vector of length 2 position 1 is new x value, position y is new y value
Calculates offset table for number of maximum overlapping positions
get_offset_table(max_positions, offset_x, offset_y)
get_offset_table(max_positions, offset_x, offset_y)
max_positions |
number of maximal exact overlaps |
offset_x |
offset for positon distance |
offset_y |
offset for in-between layer distance |
data frame with position, offsets_x and offsets_y
Tibble of what genre they are interested in, what instrument they play and what level the play their instrument at (1 = beginner, 2 = intermediate, 3 = experienced, 4 = very experienced, 5 = pro). Also there is an ID for the musician.
data(MusicianInterests)
data(MusicianInterests)
An object of class "data.frame"
;
library(ggBubbles) data(MusicianInterests) head(MusicianInterests)
library(ggBubbles) data(MusicianInterests) head(MusicianInterests)
Data.frame of what genre they are interested in, what instrument they play and what level the play their instrument at.
data(MusicianInterestsSmall)
data(MusicianInterestsSmall)
An object of class "data.frame"
;
library(ggBubbles) data(MusicianInterestsSmall) head(MusicianInterestsSmall)
library(ggBubbles) data(MusicianInterestsSmall) head(MusicianInterestsSmall)
Bubble plots sometimes can be hard to interpret, especially if you want to overlay an additional feature. Instead of having to colour one blob with this function you can plot the individuals contributing to the bubble and colour them accordingly.
position_surround(offset = 0.1)
position_surround(offset = 0.1)
offset |
setting offset for x and y axis added to the points surrounding the exact position. Default is 0.1 |
ggproto
library(ggplot2) library(ggBubbles) data(MusicianInterestsSmall) ggplot(data = MusicianInterestsSmall, aes(x = Instrument, y = Genre, col = Level)) + geom_point(position = position_surround(), size = 4) + scale_colour_manual(values = c("#333333", "#666666", "#999999", "#CCCCCC")) + theme_bw()
library(ggplot2) library(ggBubbles) data(MusicianInterestsSmall) ggplot(data = MusicianInterestsSmall, aes(x = Instrument, y = Genre, col = Level)) + geom_point(position = position_surround(), size = 4) + scale_colour_manual(values = c("#333333", "#666666", "#999999", "#CCCCCC")) + theme_bw()