Would the image() function do what you need?

n = sample(1:50,25);
g = gray(n/max(n)) # set up color palate
g = rev(g) # reverse so max is black instead of white
image(as.matrix(n),col=g) # Requires a matrix input

I think you should be able to handle axes/ labels/ etc as normal:

image(as.matrix(n),col=g,xaxt="n",yaxt="n",main="Very Important Data")

If you adjust the aspect ratio, you can get your desired bar shape/size.

Michael Weylandt

On Mon, Aug 8, 2011 at 5:10 PM, Justin Fincher <finc...@cs.fsu.edu> wrote:

> Howdy,
>   I am trying to make a simple monochrome heatmap from 1 row of data.
>  Essentially, I just want a long bar where black represents the max value
> in
> the data, white is the minimum, and all values in between are interpolated
> appropriately.  I have tried using heatmap and heatmap.2, but both have
> issues. heatmap seems to be restricted to only drawing a square plot, and
> this data requires a long, thin plot (e.g. 50px tall by 3000 px wide). For
> heatmap.2, the plots will draw the dimensions I prefer, but when I do a
> small sample the coloring seems to not correlate with the data even though
> I
> have Rowv and Colv both set to FALSE.  Any recommendations about the best
> way to make a clean, simple heatmap from a single array of positive
> integers
> would be greatly appreciated.
>
> - Fincher
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to