Dear Dennis, I would like to thank you for your reply. I also checked the web sites that you gave me, it is hard to find everything about ggplot2 at one place with concrete examples that help you understand directly what you are plotting.
As you have already mentioned ggsave can save the image as I want to and that is what I am using now. One minor issue (as you have also mentioned is to remove they gray border between the x and y legend and the red and blue area. Thus I checked the website and tried by applying the options to remove it. Unfortunately I ended up with a full list of more arguments 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) , panel.background=theme_blank() , panel.margin=unit(100,"lines") , panel.grid.major=theme_line(size=0.1) , plot.margin=unit(c(0,0,0,0),"lines") ) + scale_x_continuous('km') + scale_y_continuous('km') ) so far I have not remove that extra space.. Do you have any suggestion of how I can remove it? I would like to thank all for their time. B.R Alex ________________________________ From: Dennis Murphy <djmu...@gmail.com> Cc: "R-help@r-project.org" <R-help@r-project.org> Sent: Wednesday, August 31, 2011 9:34 PM Subject: Re: [R] ggplot2 to create a "square" plot 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 > 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@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.