This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(RPostgreSQL) | |
drv <- dbDriver("PostgreSQL") | |
con = dbConnect(drv, dbname = 'dbname', host = 'postgres', user = 'user', password = 'password') | |
query <- 'select * from your_table' | |
res <- dbSendQuery(con, query) | |
data_from_db <- fetch(res, n = -1) # n = -1 means all results will be returned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plot_heat_tree(heatmap_file, tree_file, output_file=None): | |
''' | |
Plot heatmap next to a tree. The order of the heatmap **MUST** be the same, | |
as order of the leafs on the tree. The tree must be in the Newick format. If | |
*output_file* is specified, then heat-tree will be rendered as a PNG, | |
otherwise interactive browser will pop-up with your heat-tree. | |
Parameters | |
---------- | |
heatmap_file: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install.packages('ggplot2') | |
library(ggplot2) | |
## simple histogram | |
data <- read.delim("path/to/data") | |
ggplot(data, aes(x = data$V1)) + geom_histogram(binwidth = 30000) | |
## more complex - with axis labels and custom scaling - more info http://www.cookbook-r.com/Graphs/Plotting_distributions_(ggplot2)/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1996 2 | |
1999 1 | |
2001 1 | |
2002 4 | |
2003 13 | |
2004 3 | |
2005 2 | |
2006 9 | |
2007 59 | |
2008 37 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1995 1 | |
1996 3 | |
1999 4 | |
1998 1 | |
2002 13 | |
2003 10 | |
2000 31 | |
2001 2 | |
2006 21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:dd3f380620371d7def93011e81b190a7a8f796fba0551a284b06626a6757a641" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:dd3f380620371d7def93011e81b190a7a8f796fba0551a284b06626a6757a641" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:b5d9c057e15441865c84a9422297988c0e93d5961f3da2e00ebd3be695766282" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
NewerOlder