0

I am trying to plot a table in R and I am trying to format it so that is visually attractive for presentations.

I am trying to make it look like:

            2000-01-01    2000-03-01   2000-06-01 ...
Revenue       3.5           4.6            7.9

Cost          2.3           2.7            5.6 

And have the boxes that encapsulate the words, numbers, be the right size such that the column header dates and row labels are not squished . How do I do that??

plot.table(t(z))

z <- structure(c(68.2, 66.1, 64.7, 31.8, 30.9, 25.4, 36.1, 38.3, 38.3, 
42.2, 43.3, 40.2, 41.9, 47.7, 50.8, 46.7, 48.2, 55.2, 58.2, 55.3, 
58.2, 62.5, 62.2, 59.5, 59.3, 59.4, 58.7, 68.2, 64.9, 94.7, 75.7, 
72, 73.5, 77.9, 83.8, 82.6, 83.8, 88.8, 91.5, 91.8, 92.6, 103.4, 
100.5, 110.8, 105.4, 113.5, 110, 110.2, 118.9, 125.5, 122.5, 
121.4, 122.6, 122.6, 127.4, 133.8, 131.5, 137.6, 142.7, 133, 
39.8, 46.3, 38.2, 16.6, 14.5, 17.4, 17.7, 19.1, 19, 21.2, 20.9, 
21.2, 19.9, 23.5, 25.2, 25.3, 23.3, 27.9, 29.3, 28.1, 29.6, 32.4, 
31.3, 31.1, 31.3, 31.3, 31.5, 36, 36.9, 40.1, 39, 37.4, 38.1, 
41.1, 43.1, 42.3, 42.4, 45.3, 46.4, 47.3, 48.2, 54.1, 51.6, 57.8, 
54.3, 59.7, 56.1, 56.1, 60.9, 65.8, 62.8, 62.8, 62.1, 63.8, 65.5, 
68.2, 66.7, 72.1, 75.1, 71.6), .Dim = c(60L, 2L), .Dimnames = list(
    c("11323", "11413", "11504", "11596", "11688", "11778", "11869", 
    "11961", "12053", "12143", "12234", "12326", "12418", "12509", 
    "12600", "12692", "12784", "12874", "12965", "13057", "13149", 
    "13239", "13330", "13422", "13514", "13604", "13695", "13787", 
    "13879", "13970", "14061", "14153", "14245", "14335", "14426", 
    "14518", "14610", "14700", "14791", "14883", "14975", "15065", 
    "15156", "15248", "15340", "15431", "15522", "15614", "15706", 
    "15796", "15887", "15979", "16071", "16161", "16252", "16344", 
    "16436", "16526", "16617", "16709"), c("revenue", "cost")))
Amir
  • 10,600
  • 9
  • 48
  • 75
jessica
  • 1,325
  • 2
  • 21
  • 35
  • 1
    Possible duplicate of [R data.frame to table image for presentation](http://stackoverflow.com/questions/21558266/r-data-frame-to-table-image-for-presentation) –  Jan 14 '16 at 03:54
  • Well I know how to print the table into a visual table. My problem is how do I get the boxes to be the right size. When I try to plot the data, the box around each box is very large therefore only a handful of datapoints appear. – jessica Jan 14 '16 at 04:21
  • How are you presenting your table? `knitr`? `knitr::kable(z)` looks decent, but I'm not sure what you want. – alistaire Jan 14 '16 at 04:38
  • Where does plot.table come from? This was online: # load Systematic Investor Toolbox setInternet2(TRUE) source(gzcon(url('https://github.com/systematicinvestor/SIT/raw/master/sit.gz', 'rb'))) – lawyeR Jan 14 '16 at 11:07

0 Answers0