Re: [R] Setting fixed size for segement plot using stars() (axes size vs print size)

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Fri, 08 Aug 2008 12:30:13 -0600

You could use the symbols function instead of the stars function. This allows you to set the size of the stars in inches and that will not change based on the number of stars. The drawback is that you will have to set the positioning yourself and may need to suppress the axes and add the label and legend manually. You can also look at the my.symbols function in the TeachingDemos package if you want even more control of the individual stars.

You could also add additional rows of 0's to your smaller datasets so that the stars function still creates the same number of stars with the later ones just being points rather than whole stars.

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow_at_imail.org
(801) 408-8111




> -----Original Message-----
> From: r-help-bounces_at_r-project.org
> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Jay Douillard
> Sent: Wednesday, July 30, 2008 1:04 PM
> To: r-help_at_r-project.org
> Subject: [R] Setting fixed size for segement plot using
> stars() (axes size vs print size)
>
>
> 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")
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
______________________________________________ R-help_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Received on Fri 08 Aug 2008 - 18:39:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Aug 2008 - 19:33:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive