Plots.jl/examples/iris.ipynb
2015-09-28 14:58:56 -04:00

246 lines
5.1 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
"INFO: Recompiling stale cache file /Users/tom/.julia/lib/v0.4/Plots.ji for module Plots.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Plots.jl] Default backend: immerse"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: Base.None is deprecated, use Union{} instead.\n",
"WARNING: Base.None is deprecated, use Union{} instead.\n",
"WARNING: Base.None is deprecated, use Union{} instead.\n"
]
}
],
"source": [
"using RDatasets, Plots; dataframes()\n",
"iris = dataset(\"datasets\", \"iris\");\n",
"default(size=(600,400));"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": false
},
"outputs": [],
"source": [
"gadfly();\n",
"scatter(iris, :SepalLength, :SepalWidth, group=:Species, ms=12, m=[:+,:h,:s])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": false
},
"outputs": [],
"source": [
"\n",
"plot!(u->6+2*sin(u), u->3+cos(u), 0, 2π, lab=\"an oval\", fill=3)\n",
"plot!(Any[[6],[3]], t=[:vline,:hline], w=4, c=RGB(1,0,0))\n",
"title(\"Playing around with series\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"scatter(iris, :SepalLength, [:PetalLength,:PetalWidth,:SepalWidth], m=:auto, ms=10, gui=false)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"species = iris[:Species]\n",
"split(species)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"using StatsBase\n",
"methods(svd)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"arr = Array(iris[[:SepalLength,:SepalWidth]])\n",
"pca(arr)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"Pkg.update()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": false
},
"outputs": [],
"source": [
"scatter([0,0],ms=40,m=:s)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ticks = ASCIIString[\"setosa\",\"versicolor\",\"virginica\"]"
]
},
{
"ename": "MethodError",
"evalue": "MethodError: `isless` has no method matching isless(::ASCIIString, ::Float64)\nClosest candidates are:\n isless(!Matched::Float64, ::Float64)\n isless(!Matched::AbstractFloat, ::AbstractFloat)\n isless(!Matched::Real, ::AbstractFloat)\n ...",
"output_type": "error",
"traceback": [
"MethodError: `isless` has no method matching isless(::ASCIIString, ::Float64)\nClosest candidates are:\n isless(!Matched::Float64, ::Float64)\n isless(!Matched::AbstractFloat, ::AbstractFloat)\n isless(!Matched::Real, ::AbstractFloat)\n ...",
""
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"bar(iris, :Species, :SepalLength)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"bar(iris, :SepalLength, :Species)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"findnext([1,2,1],1,4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"d = Dict(); get(d,:xticks,:auto)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"issubtype(ASCIIString,ASCIIString)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 0.4.0-rc2",
"language": "julia",
"name": "julia-0.4"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "0.4.0"
}
},
"nbformat": 4,
"nbformat_minor": 0
}