Skip to content
Prev 246161 / 398503 Next

Plot symbols: How to plot (and save) a graphic symbols originating from a table

On Jan 1, 2011, at 2:15 PM, Victor F Seabra wrote:

            
I would say it has very little to do with the data structure and  
everything to do with the encodings, font conventions of console  
output, and the defaults for graphical devices. (I'm using a Mac in an  
English locale, and you have not provided any of the requested  
information about your setup.)
No. You are more likely seeing how R presents what it did with \u2264  
with its default method for printing to the console. I see:

 > table1
   ypos animal          var1         var2
1    5    cat gina <=  lady gina ?  lady
2    7    dog  bill >= tony  bill ? tony
3    9   fish   dude <= bro   dude ? bro

Subject, of course, to how emailers handle the \u2264 character.

 > str(table1)
'data.frame':	3 obs. of  4 variables:
  $ ypos  : num  5 7 9
  $ animal: Factor w/ 3 levels "cat","dog","fish": 1 2 3
  $ var1  : Factor w/ 3 levels "bill >= tony",..: 3 1 2
  $ var2  : Factor w/ 3 levels "bill ? tony",..: 3 1 2
I'm confused. You are starting with a factor variable whose levels  
have some higher order numbers in the character vector, and then you  
didn't assign the results of the fix() operation to an R object. Why  
should that do _anything_?
That must be the glyph for that number in the default font for your  
pdf device (as it is for mine once I change the width settings so it  
can be seen after conversion to pdf.)

?Encoding  # might be a useful place to start, followed by...
?Devices
?ps.options
To accomplish what end? You have not described what you are trying to  
actually do. Is this text supposed to be plotted inside the plotting  
area or are you going to be using it as axis labels? There is a  
variety of approaches (especially the plotmath expression option) that  
can be used depending on the ultimate objective.

?plotmath

Compare:
  plot(NULL, xlim=c(0,1), ylim=c(0,1))
  text(0.5,0.5, as.expression(as.character(table1$var2[1])) )
  text(0.5,0.6, label=expression(gina <= lady) )