A barplot shows the relationship between a numeric and a categoric variable. Each entity of the categoric variable is represented as a bar. The size of the bar represents its numeric value. Barplot is sometimes described as a boring way to visualize information. However it is probably the most efficient way to show this kind of data. Ordering bars and providing good annotation are often necessary.
<!-- Include the CanvasXpress library in your HTML file --> <link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/> <script src="https://www.canvasxpress.org/canvasXpress.min.js"></script> <!-- Create a canvas element for the chart with the desired dimensions --> <div> <canvas id="canvasId" width="600" height="600"</canvas> </div> <!-- Create a script to initialize the chart --> <script> <!-- Create the data for the graph --> var data = { "x" : { "Drug Sensitivity" : ["Sensitive","Sensitive","Sensitive","Sensitive","Sensitive","Resistant","Resistant","Resistant"], "IC50" : [0.08,0.07,0.06,0.05,0.04,0.03,0.02,0.01] }, "y" : { "data" : [ [10,15,20,30,40,70,80,90] ], "desc" : ["Intensity"], "smps" : ["S1","S2","S3","S4","S5","S6","S7","S8"], "vars" : ["V1"] } } <-- Create the configuration for the graph --> var config = { "axisTitleFontStyle":"italic", "colorBy":"IC50", "decorations":{ "line":[ { "align":"left", "color":"rgb(255,0,0)", "label":"Cutoff", "value":50, "width":2 } ] }, "decorationsTextScaleFontFactor":1.3, "graphOrientation":"vertical", "graphType":"Bar", "smpOverlays":[ "Drug Sensitivity" ], "smpTitle":"Cell Lines", "smpTitleFontStyle":"bold", "theme":"CanvasXpress", "title":"Random data set", "xAxis2Show":"false" } <!-- Call the CanvasXpress function to create the graph --> var cX = new CanvasXpress("canvasId", data, config); </script>
library(canvasXpress) y=read.table("https://www.canvasxpress.org/data/cX-simple-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) x=read.table("https://www.canvasxpress.org/data/cX-simple-smp.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) canvasXpress( data=y, smpAnnot=x, axisTitleFontStyle="italic", colorBy="IC50", decorations=list(line=list(list(align="left", color="rgb(255,0,0)", label="Cutoff", value=50, width=2))), decorationsTextScaleFontFactor=1.3, graphOrientation="vertical", graphType="Bar", smpOverlays=list("Drug Sensitivity"), smpTitle="Cell Lines", smpTitleFontStyle="bold", theme="CanvasXpress", title="Random data set", xAxis2Show=FALSE )