<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/visualization-of-tumor-response-spider-plots/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://designdatadecisions.wordpress.com/2018/08/28/visualization-of-tumor-response-spider-plots/"> R – Design Data Decisions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>A collection of some commonly used and some newly developed methods for the visualization of outcomes in oncology studies include Kaplan-Meier curves, forest plots, funnel plots, violin plots, waterfall plots, spider plots, swimmer plot, heatmaps, circos plots, transit map diagrams and network analysis diagrams (reviewed <a rel="nofollow" href="https://www.ncbi.nlm.nih.gov/pubmed/27245079" target="_blank">here</a>). Previous articles in this blog presented an introduction to <a rel="nofollow" href="https://designdatadecisions.wordpress.com/2016/07/02/forest-plot-with-horizontal-bands/" target="_blank">forest plots</a>,Â <a rel="nofollow" href="https://designdatadecisions.wordpress.com/2015/06/09/graphs-in-r-overlaying-data-summaries-in-dotplots/" target="_blank">violin plots</a> and <a rel="nofollow" href="https://designdatadecisions.wordpress.com/2015/07/23/waterfall-plots-what-and-how/" target="_blank"> waterfall plots</a> as well as provided some R code for the generation of these plots. As a continuation of the series, the current article provides an introduction to spider plots for the visualization of tumor response and generation of the same using R.</p>
<p>Spider plots in oncology are used to depict changes in tumor measurements over time, relative to the baseline measurement. The resulting graph looks like the legs of a spider and hence the name. Additional information can be incorporated into the plot by varying the color and shape of points as well as the color and style of the lines. <a rel="nofollow" href="https://blogs.sas.com/content/graphicallyspeaking/2016/10/24/clinical-graphs-spider-plot/" target="_blank">Here</a> is a post on the creation of spider plots using SAS.</p>
<p>In domains other than medical/oncology, <a rel="nofollow" href="https://en.wikipedia.org/wiki/Radar_chart" target="_blank">radar charts</a> are sometimes also called spider plots. To clarify to readers, this post is not about the generation of radar charts.</p>
<p>To illustrate the generation of spider plot in R, we use as example data, the sample dataset provided along with the tumgr R package. This dataset is a sample of control arm data from a phase 3, randomized, open-label study evaluating DN-101 in combination with Docetaxel in androgen-independent prostate cancer (AIPC) (ASCENT-2). However, to illustrate the incorporation of treatment information into the plot, the subjects in this dataset were randomly placed into control and drug treatment arms. Also, the follow-up time was restricted to 240 days (8 months).</p>
<p>The spider plot is generated with R version 3.5.0 using package ggplot2 (version 3.0.0).</p>
<pre>

library(tumgr) ## For the example dataset
library(ggplot2)

set.seed(1234)
tumorgrowth &lt;- sampleData
tumorgrowth &lt;- do.call(rbind,
by(tumorgrowth, tumorgrowth$name,
     function(subset) within(subset,
              { treatment &lt;- ifelse(rbinom(1,1,0.5), &quot;Drug&quot;,&quot;Control&quot;) Â  ## subjects are randomly placed in control or drug treatment arms
                o &lt;- order(date)
                date &lt;- date[o]
                size &lt;- size[o]
                baseline &lt;- size[1]
                percentChange &lt;- 100*(size-baseline)/baseline
                time &lt;- ifelse(date > 240, 240, date) ## data censored at 240 days
                cstatus &lt;- factor(ifelse(date > 240, 0, 1))
              })))
rownames(tumorgrowth) &lt;- NULL

## Save plot in file
png(filename = &quot;C:\\Path\\To\\SpiderPlot\\SpiderPlot.png&quot;, width = 640, height = 640)

## Plot settings
p &lt;- ggplot(tumorgrowth, aes(x=time, y=percentChange, group=name)) +
      theme_bw(base_size=14) +
      theme(axis.title.x = element_text(face=&quot;bold&quot;), axis.text.x = element_text(face=&quot;bold&quot;)) +
      theme(axis.title.y = element_text(face=&quot;bold&quot;), axis.text.y = element_text(face=&quot;bold&quot;)) +
      theme(plot.title = element_text(size=18, hjust=0.5)) +
      labs(list(title = &quot;Spider Plot&quot;, x = &quot;Time (in days)&quot;, y = &quot;Change from baseline (%)&quot;))
## Now plot
p &lt;- p + geom_line(aes(color=treatment)) +
      geom_point(aes(shape=cstatus, color=treatment), show.legend=FALSE) +
      scale_colour_discrete(name=&quot;Treatment&quot;, labels=c(&quot;Control&quot;, &quot;Drug&quot;)) +
      scale_shape_manual(name = &quot;cstatus&quot;, values = c(&quot;0&quot;=3, &quot;1&quot;=16)) +
      coord_cartesian(xlim=c(0, 240))
print(p)
dev.off()
</pre>
<p>Here is the resulting spider plot. The + symbols represent censored observations.</p>
<p><img data-orig-file="https://designdatadecisions.files.wordpress.com/2018/08/spiderplot.png?w=456" data-orig-size="640,640" data-medium-file="https://designdatadecisions.files.wordpress.com/2018/08/spiderplot.png?w=456?w=300" data-attachment-id="272" data-image-meta="{" data-image-description="" src="https://designdatadecisions.files.wordpress.com/2018/08/spiderplot.png?w=456" data-permalink="https://designdatadecisions.wordpress.com/2018/08/28/visualization-of-tumor-response-spider-plots/spiderplot/#main" data-large-file="https://designdatadecisions.files.wordpress.com/2018/08/spiderplot.png?w=456?w=640" alt="" data-image-title="SpiderPlot" sizes="(max-width: 640px) 100vw, 640px" data-comments-opened="1" class="wp-image-272" data-recalc-dims="1"></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://designdatadecisions.wordpress.com/2018/08/28/visualization-of-tumor-response-spider-plots/"> R – Design Data Decisions</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/DZiiMi1OKO0" height="1"></a></div>