[R] Setting fixed size for segement plot using stars() (axes size vs print size)
Jay Douillard
jay.douillard at ubc.ca
Wed Jul 30 21:04:11 CEST 2008
I have been making some segment plots with five variables. They work great, especially when I used a different scale function, which scaled them by area of the circle rather than radius
scale <- function(x, Mr = 1 , Mx = 100) { ((x/Mx)^.5)*Mr}
Where x is the the value, Mr is the Maximum radius, and Mx is the maximum data value. You could change the exponent .5 to .57 if you wanted Flannery compensation.
My problem is that I want the print size of these proportional symbols to be the same regardless of the number of data points
as in this example, where exporting these two plots as PDF(which have been scaled) will produce different size symbols for the same value, when compared side by side.I've tried manually setting the ncol and nrow attributes, and it still produces different results for the data sets.
stars(large[2:6], draw.segments = TRUE, labels = large$size,scale = FALSE, flip.labels = TRUE, axes = TRUE,)
stars(small[2:6], draw.segments = TRUE, labels = small$size,scale = FALSE, flip.labels = TRUE, axes = TRUE,)
Thanks!
small <-
structure(list(size = c(5, 10, 15, 20, 25, 30, 50), one = c(0.223606797749979,
0.316227766016838, 0.387298334620742, 0.447213595499958, 0.5,
0.547722557505166, 0.707106781186548), two = c(0.223606797749979,
0.316227766016838, 0.387298334620742, 0.447213595499958, 0.5,
0.547722557505166, 0.707106781186548), three = c(0.223606797749979,
0.316227766016838, 0.387298334620742, 0.447213595499958, 0.5,
0.547722557505166, 0.707106781186548), four = c(0.223606797749979,
0.316227766016838, 0.387298334620742, 0.447213595499958, 0.5,
0.547722557505166, 0.707106781186548), five = c(0.223606797749979,
0.316227766016838, 0.387298334620742, 0.447213595499958, 0.5,
0.547722557505166, 0.707106781186548)), .Names = c("size", "one",
"two", "three", "four", "five"), row.names = c(NA, 7L), class = "data.frame")
large <-
structure(list(size = c(5L, 10L, 15L, 20L, 25L, 30L, 50L, 5L,
10L, 15L, 20L, 25L, 30L, 50L, 5L, 10L, 15L, 20L, 25L, 30L, 50L,
5L, 10L, 15L, 20L, 25L, 30L, 50L), one = c(0.223606797749979,
0.316227766016838, 0.387298334620742, 0.447213595499958, 0.5,
0.547722557505166, 0.707106781186548, 0.223606797749979, 0.316227766016838,
0.387298334620742, 0.447213595499958, 0.5, 0.547722557505166,
0.707106781186548, 0.223606797749979, 0.316227766016838, 0.387298334620742,
0.447213595499958, 0.5, 0.547722557505166, 0.707106781186548,
0.223606797749979, 0.316227766016838, 0.387298334620742, 0.447213595499958,
0.5, 0.547722557505166, 0.707106781186548), two = c(0.223606797749979,
0.316227766016838, 0.387298334620742, 0.447213595499958, 0.5,
0.547722557505166, 0.707106781186548, 0.223606797749979, 0.316227766016838,
0.387298334620742, 0.447213595499958, 0.5, 0.547722557505166,
0.707106781186548, 0.223606797749979, 0.316227766016838, 0.387298334620742,
0.447213595499958, 0.5, 0.547722557505166, 0.707106781186548,
0.223606797749979, 0.316227766016838, 0.387298334620742, 0.447213595499958,
0.5, 0.547722557505166, 0.707106781186548), three = c(0.223606797749979,
0.316227766016838, 0.387298334620742, 0.447213595499958, 0.5,
0.547722557505166, 0.707106781186548, 0.223606797749979, 0.316227766016838,
0.387298334620742, 0.447213595499958, 0.5, 0.547722557505166,
0.707106781186548, 0.223606797749979, 0.316227766016838, 0.387298334620742,
0.447213595499958, 0.5, 0.547722557505166, 0.707106781186548,
0.223606797749979, 0.316227766016838, 0.387298334620742, 0.447213595499958,
0.5, 0.547722557505166, 0.707106781186548), four = c(0.223606797749979,
0.316227766016838, 0.387298334620742, 0.447213595499958, 0.5,
0.547722557505166, 0.707106781186548, 0.223606797749979, 0.316227766016838,
0.387298334620742, 0.447213595499958, 0.5, 0.547722557505166,
0.707106781186548, 0.223606797749979, 0.316227766016838, 0.387298334620742,
0.447213595499958, 0.5, 0.547722557505166, 0.707106781186548,
0.223606797749979, 0.316227766016838, 0.387298334620742, 0.447213595499958,
0.5, 0.547722557505166, 0.707106781186548), five = c(0.223606797749979,
0.316227766016838, 0.387298334620742, 0.447213595499958, 0.5,
0.547722557505166, 0.707106781186548, 0.223606797749979, 0.316227766016838,
0.387298334620742, 0.447213595499958, 0.5, 0.547722557505166,
0.707106781186548, 0.223606797749979, 0.316227766016838, 0.387298334620742,
0.447213595499958, 0.5, 0.547722557505166, 0.707106781186548,
0.223606797749979, 0.316227766016838, 0.387298334620742, 0.447213595499958,
0.5, 0.547722557505166, 0.707106781186548)), .Names = c("size",
"one", "two", "three", "four", "five"), row.names = c(NA, -28L
), class = "data.frame")
More information about the R-help
mailing list