% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gspace-methods.R
\docType{methods}
\name{plotGraphSpace,GraphSpace-method}
\alias{plotGraphSpace,GraphSpace-method}
\alias{plotGraphSpace}
\alias{plotGraphSpace,igraph-method}
\title{Wrapper function to plot GraphSpace objects in ggplot2}
\usage{
\S4method{plotGraphSpace}{GraphSpace}(
  gs,
  theme = "th0",
  xlab = "Graph coordinates 1",
  ylab = "Graph coordinates 2",
  font.size = 1,
  bg.color = "grey95",
  add.labels = FALSE,
  node.labels = NULL,
  label.size = 3,
  label.color = "grey20",
  add.image = FALSE,
  raster = FALSE,
  dpi = 300,
  dev = "cairo_png"
)

\S4method{plotGraphSpace}{igraph}(gs, ...)
}
\arguments{
\item{gs}{Either an \code{igraph} or \linkS4class{GraphSpace} class object.
If \code{gs} is an \code{igraph}, then it must include \code{x}, \code{y},
and \code{name}  vertex attributes (see \code{\link{GraphSpace}}).}

\item{theme}{Name of a custom RGraphSpace theme. These themes
(from 'th0' to 'th3') consist of preconfigured ggplot settings,
which can subsequently refine using \code{\link[ggplot2]{ggplot2}}.}

\item{xlab}{The title for the 'x' axis of a 2D-image space.}

\item{ylab}{The title for the 'y' axis of a 2D-image space.}

\item{font.size}{A single numeric value passed to ggplot themes.}

\item{bg.color}{A single color for background.}

\item{add.labels}{A logical value indicating whether to plot vertex labels.}

\item{node.labels}{A vector of vertex names to be highlighted in the graph
space. This argument overrides 'add.labels'.}

\item{label.size}{A size argument passed to \code{\link[ggplot2]{geom_text}}.}

\item{label.color}{A color passed to \code{\link[ggplot2]{geom_text}}.}

\item{add.image}{A logical value indicating whether to add a background
image, when one is available (see \code{\link{GraphSpace}}).}

\item{raster}{A logical value indicating whether to rasterize the main plot.
See \code{\link[ggrastr]{rasterise}} for further specifications.}

\item{dpi}{Raster resolution, in dots per inch.}

\item{dev}{Device used in the \code{\link[ggrastr]{rasterise}} call.}

\item{...}{Additional arguments passed to the
\code{\link{plotGraphSpace}} function.}
}
\value{
A ggplot-class object.
}
\description{
\code{plotGraphSpace()} is a High-level plotting interface that translates
\code{igraph} and \code{GraphSpace} data objects into \code{ggplot2} layers.
}
\examples{
library(igraph)

# Load a demo igraph
data('gtoy1', package = 'RGraphSpace')

# Generate a ggplot for gtoy1
plotGraphSpace(gtoy1)

# Create a star graph
gtoy_star <- make_full_graph(15)

# Example of setting node and edge attributes
V(gtoy_star)$nodeSize <- 5
E(gtoy_star)$edgeLineColor <- "red"
E(gtoy_star)$arrowType <- "<->"

# Create a GraphSpace object
gs_star <- GraphSpace(gtoy_star)

# Normalize graph coordinates
gs_star <- normalizeGraphSpace(gs_star)

# Generate a ggplot for gs_star
plotGraphSpace(gs_star)

}
\seealso{
\code{\link{GraphSpace}}
}
\author{
Sysbiolab.
}
