[R] ggplot2 to create a "square" plot
Dennis Murphy
djmuser at gmail.com
Wed Aug 31 21:34:24 CEST 2011
Hi:
I'd suggest using ggsave(); in particular, see its height = and width
= arguments. If you have some time, you could look at some examples of
ggplot2 themes:
https://github.com/hadley/ggplot2/wiki/themes
and some examples of how to use various opts():
https://github.com/hadley/ggplot2/wiki/%2Bopts%28%29-List
These can be useful if you need to reduce the amount of space around
the plot or reposition the legend to the top or bottom to get more
horizontal space for the plot. This sometimes is a germane issue when
the plot is intended to be square.
HTH,
Dennis
On Wed, Aug 31, 2011 at 10:18 AM, Alaios <alaios at yahoo.com> wrote:
> Dear all,
> I am using ggplot with geom_tile to print as an image a matrix I have. My matrix is a squared one of 512*512 cells.
>
> The code that does that is written below
>
>
>> print(v + geom_tile(aes(fill=dB))+ opts(axis.text.x=theme_text(size=20),axis.text.y=theme_text(size=20), axis.title.x=theme_text(size=25) , axis.title.y=theme_text(size=25), legend.title=theme_text(size=25,hjust=-0.4) , legend.text=theme_text(size=20)) + scale_x_continuous('km') + scale_y_continuous('km') )
>
>
>
> as you can see from the picture below
>
> http://imageshack.us/photo/my-images/171/backupf.jpg/
>
> this squared matrix is printed a bit squeezed with the height being bigger than the width. Would be possible somehow to print that plot by keeping the square-look of the matrix in the plot? Of course the other elements like axis and legend will make the over all plot to not be square but I do not care as the blue and red region forms a square.
>
> I would like to thank you in advance for your help
> B.R
> Alex
>
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>
>
More information about the R-help
mailing list