<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Plotting #4: Iterative Plotting Functions • scCustomize</title>
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.4.0/flatly/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css">
<script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><meta property="og:title" content="Plotting #4: Iterative Plotting Functions">
<meta property="og:description" content="scCustomize">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#toc">
    

    <div class="container template-article">
      <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
        <a class="navbar-link" href="../index.html">scCustomize</a>
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">2.1.2</span>
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
<li>
  <a href="../index.html">Getting Started</a>
</li>
<li>
  <a href="../articles/Installation.html">Install</a>
</li>
<li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    Vignettes
     
    <span class="caret"></span>
  </a>
  <ul class="dropdown-menu" role="menu">
<li class="dropdown-header">Plotting Vignettes</li>
    <li>
      <a href="../articles/Gene_Expression_Plotting.html">Plotting #1: General Analysis Plots</a>
    </li>
    <li>
      <a href="../articles/QC_Plots.html">Plotting #2: QC Plots</a>
    </li>
    <li>
      <a href="../articles/Sequencing_QC_Plots.html">Plotting #3: Sequencing QC Plots/Analysis</a>
    </li>
    <li>
      <a href="../articles/Iterative_Plotting.html">Plotting #4: Iterative Plotting Functions</a>
    </li>
    <li>
      <a href="../articles/Color_Palettes.html">Customized Color Palettes &amp; Themes</a>
    </li>
    <li class="divider">
    </li>
<li class="dropdown-header">Helpers &amp; Utilities</li>
    <li>
      <a href="../articles/Helpers_and_Utilities.html">General Helpers &amp; Utilities</a>
    </li>
    <li>
      <a href="../articles/Read_and_Write_Functions.html">Read &amp; Write Data Functions</a>
    </li>
    <li>
      <a href="../articles/Object_Conversion.html">Object/Assay Format Conversion</a>
    </li>
    <li>
      <a href="../articles/Markers_and_Cluster_Annotation.html">Marker Identification &amp; Cluster Annotation Helpers</a>
    </li>
    <li>
      <a href="../articles/Statistics.html">Statistics Functions</a>
    </li>
    <li>
      <a href="../articles/Update_Gene_Symbols.html">Updating Gene Symbols</a>
    </li>
    <li>
      <a href="../articles/Misc_Functions.html">Misc Functions</a>
    </li>
    <li class="divider">
    </li>
<li class="dropdown-header">Other Package Interactivity/Functions</li>
    <li>
      <a href="../articles/LIGER_Functions.html">LIGER Plotting &amp; Functionality</a>
    </li>
    <li>
      <a href="../articles/Cell_Bender_Functions.html">Cell Bender Functionality &amp; Plotting</a>
    </li>
  </ul>
</li>
<li>
  <a href="../news/index.html">News/Changelog</a>
</li>
<li>
  <a href="../reference/index.html">Reference</a>
</li>
<li>
  <a href="../articles/FAQ.html">FAQ</a>
</li>
      </ul>
<ul class="nav navbar-nav navbar-right">
<li>
  <a href="https://github.com/samuel-marsh/scCustomize/" class="external-link">
    <span class="fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul>
</div>
<!--/.nav-collapse -->
  </div>
<!--/.container -->
</div>
<!--/.navbar -->

      

      </header><div class="row">
  <div class="col-md-9 contents">
    <div class="page-header toc-ignore">
      <h1 data-toc-skip>Plotting #4: Iterative Plotting Functions</h1>
            
            <h4 data-toc-skip class="date">Compiled: February 28,
2024</h4>
      
      <small class="dont-index">Source: <a href="https://github.com/samuel-marsh/scCustomize/blob/HEAD/vignettes/articles/Iterative_Plotting.Rmd" class="external-link"><code>vignettes/articles/Iterative_Plotting.Rmd</code></a></small>
      <div class="hidden name"><code>Iterative_Plotting.Rmd</code></div>

    </div>

    
    
<hr>
<style>
p.caption {
  font-size: 0.9em;
}
</style>
<div class="section level2">
<h2 id="iterative-plotting-functions">Iterative Plotting Functions<a class="anchor" aria-label="anchor" href="#iterative-plotting-functions"></a>
</h2>
<p>Often times creating large numbers of plots (either as individual
files or in single PDF) is part of normal workflow. This process can be
simplified by creating the plots in looping functions.</p>
<p>scCustomize simplifies this process by allowing for the creation of
many plots in multiple formats with self-contained loop functions.</p>
<div class="section level3">
<h3 id="iterative-functions-available-are">Iterative functions available are:<a class="anchor" aria-label="anchor" href="#iterative-functions-available-are"></a>
</h3>
<ul>
<li>
<code><a href="../reference/Iterate_PC_Loading_Plots.html">Iterate_PC_Loading_Plots()</a></code>: Plots PC Heatmap and Top
Loading Genes for specified number of PCs.</li>
<li>
<code><a href="../reference/Iterate_FeaturePlot_scCustom.html">Iterate_FeaturePlot_scCustom()</a></code>:
<code><a href="../reference/FeaturePlot_scCustom.html">FeaturePlot_scCustom()</a></code> for all genes in gene list. See <a href="https://samuel-marsh.github.io/scCustomize/articles/Markers_and_Cluster_Annotation.html#extract-the-top-n-marker-genes-per-cluster-identity-treatment-etc-1">Marker
Identification Vignette</a> for special use case with named vector gene
lists.</li>
<li>
<code><a href="../reference/Iterate_VlnPlot_scCustom.html">Iterate_VlnPlot_scCustom()</a></code>: Plots
<code><a href="../reference/VlnPlot_scCustom.html">VlnPlot_scCustom()</a></code> for all genes in gene list.</li>
<li>
<code><a href="../reference/Iterate_Plot_Density_Custom.html">Iterate_Plot_Density_Custom()</a></code> Plots single gene density
plots for all genes in gene list.</li>
<li>
<code><a href="../reference/Iterate_Plot_Density_Joint.html">Iterate_Plot_Density_Joint()</a></code> Plots the joint density
plots for all vectors of genes from a list of vectors.</li>
<li>
<code><a href="../reference/Iterate_DimPlot_bySample.html">Iterate_DimPlot_bySample()</a></code>: Plots
<code><a href="https://satijalab.org/seurat/reference/DimPlot.html" class="external-link">DimPlot()</a></code> one sample at a time.</li>
<li>
<code><a href="../reference/Iterate_Cluster_Highlight_Plot.html">Iterate_Cluster_Highlight_Plot()</a></code>: Plots
<code><a href="../reference/Cluster_Highlight_Plot.html">Cluster_Highlight_Plot()</a></code> for all clusters in given
object.</li>
<li>
<code><a href="../reference/Iterate_Meta_Highlight_Plot.html">Iterate_Meta_Highlight_Plot()</a></code> Plots
<code><a href="../reference/Meta_Highlight_Plot.html">Meta_Highlight_Plot()</a></code> for all levels within given meta data
column.</li>
</ul>
</div>
<div class="section level3">
<h3 id="required-parameters">Required Parameters<a class="anchor" aria-label="anchor" href="#required-parameters"></a>
</h3>
<p>Most functions that begin with <code>Iterate_</code> have shared
parameters that are used to dictate file location, file name, and file
type. *The exception is <code><a href="../reference/Iterate_PC_Loading_Plots.html">Iterate_PC_Loading_Plots()</a></code> which is
slightly different (see manual entry for more info.)</p>
<ul>
<li>
<code>file_path</code>: path to directory to save file (can also
include file prefix if desired)</li>
<li>
<code>file_name</code>: file name (if saving as single file) or
suffix to add to file name (if saving individual files the meta data
variable or gene will be part of file name automatically)</li>
<li>
<code>file_type</code>: accepts one of following options: “.pdf”,
“.png”, “.tiff”, “.jpeg”, “.svg”.</li>
<li>
<code>single_pdf</code>: logical. Whether or not to save all plots
to single PDF file vs. one file per variable/gene.</li>
<li>
<code>dpi</code>: Dots per inch (only relevant for non-vector based
file formats).</li>
</ul>
</div>
<div class="section level3">
<h3 id="added-functionality">Added functionality<a class="anchor" aria-label="anchor" href="#added-functionality"></a>
</h3>
<p><code><a href="../reference/Iterate_FeaturePlot_scCustom.html">Iterate_FeaturePlot_scCustom()</a></code> has an additional helpful
feature when the list of features provided is named. See <a href="https://samuel-marsh.github.io/scCustomize/articles/Markers_and_Cluster_Annotation.html#extract-the-top-n-marker-genes-per-cluster-identity-treatment-etc-1">Marker
Identification &amp; Cluster Annotation Vignette</a>.</p>
<p>When provided with named vector such as the output from
<code><a href="../reference/Extract_Top_Markers.html">Extract_Top_Markers()</a></code> then
<code><a href="../reference/Iterate_FeaturePlot_scCustom.html">Iterate_FeaturePlot_scCustom()</a></code> can detect the names and add
them either to the title of the plot (if <code>single_pdf = TRUE</code>)
or the file names if <code>FALSE</code>.</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/Iterate_FeaturePlot_scCustom.html">Iterate_FeaturePlot_scCustom</a></span><span class="op">(</span>seurat_object <span class="op">=</span> <span class="va">pbmc</span>, gene_list <span class="op">=</span> <span class="va">top_5_presto</span>, single_pdf <span class="op">=</span> <span class="cn">T</span><span class="op">)</span></span></code></pre></div>
<center>
<p><img src="../reference/figures/assets/Iterate_named_plots.png" width="49%"></p>
<em>Example plot showing the gene name and additional name of the
plot.</em>
</center>
</div>
<div class="section level3">
<h3 id="optional-parameters">Optional Parameters<a class="anchor" aria-label="anchor" href="#optional-parameters"></a>
</h3>
<p>Remaining parameters for each function are similar or identical to
their non-iterative counterparts.</p>
</div>
<div class="section level3">
<h3 id="more-information">More Information<a class="anchor" aria-label="anchor" href="#more-information"></a>
</h3>
<p>For more info on each functions and optional parameters check out the
manual entry using <code>?Function_Name</code> or browsing the <a href="https://samuel-marsh.github.io/scCustomize/reference/index.html#section-iterative-plotting-functions">Reference
Manual</a></p>
</div>
</div>
  </div>

  <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">

        <nav id="toc" data-toggle="toc"><h2 data-toc-skip>Contents</h2>
    </nav>
</div>

</div>



      <footer><div class="copyright">
  <p></p>
<p>Developed by Samuel Marsh.</p>
</div>

<div class="pkgdown">
  <p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>

      </footer>
</div>

  


  

  </body>
</html>
