From bcb9ac550144fef76bac5927979b598f6d263163 Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Mon, 21 Sep 2015 17:29:51 -0400 Subject: [PATCH] readme --- README.md | 107 +++++++++++++++++++++++++++---------- docs/example_generation.jl | 48 +++++++++++++++-- docs/readme_template.md | 12 +++++ src/args.jl | 2 +- 4 files changed, 136 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 5f90abac..a254b379 100644 --- a/README.md +++ b/README.md @@ -159,34 +159,85 @@ Some keyword arguments you can set: Keyword | Default | Type | Aliases ---- | ---- | ---- | ---- -args | Any[] | Series | `:args`, `:argss` -axis | left | Series | `:axis`, `:axiss` -color | auto | Series | `:c`, `:color`, `:colors` -fillto | nothing | Series | `:area`, `:fill`, `:fillto`, `:filltos` -group | nothing | Series | `:g`, `:group`, `:groups` -heatmap_c | (0.15,0.5) | Series | `:heatmap_c`, `:heatmap_cs` -kwargs | Any[] | Series | `:kwargs`, `:kwargss` -label | AUTO | Series | `:lab`, `:label`, `:labels` -linestyle | solid | Series | `:linestyle`, `:linestyles`, `:ls`, `:s`, `:style` -linetype | path | Series | `:linetype`, `:linetypes`, `:lt`, `:t`, `:type` -marker | none | Series | `:m`, `:marker`, `:markers` -markercolor | match | Series | `:markercolor`, `:markercolors`, `:mc`, `:mcolor` -markersize | 6 | Series | `:markersize`, `:markersizes`, `:ms`, `:msize` -nbins | 100 | Series | `:nb`, `:nbin`, `:nbins`, `:nbinss` -reg | false | Series | `:reg`, `:regs` -ribbon | nothing | Series | `:r`, `:ribbon`, `:ribbons` -width | 1 | Series | `:linewidth`, `:w`, `:width`, `:widths` -background_color | RGB{Float64}(0.1,0.1,0.1) | Plot | `:background`, `:background_color`, `:bg`, `:bg_color`, `:bgcolor` -legend | true | Plot | `:leg`, `:legend` -show | false | Plot | `:display`, `:show` -size | (800,600) | Plot | `:size`, `:windowsize`, `:wsize` -title | | Plot | `:title` -windowtitle | Plots.jl | Plot | `:windowtitle`, `:wtitle` -xlabel | | Plot | `:xlab`, `:xlabel` -xticks | true | Plot | `:xticks` -ylabel | | Plot | `:ylab`, `:ylabel` -yrightlabel | | Plot | `:y2lab`, `:y2label`, `:ylab2`, `:ylabel2`, `:ylabelright`, `:ylabr`, `:yrightlabel`, `:yrlab` -yticks | true | Plot | `:yticks` +`:args` | `Any[]` | Series | `:argss` +`:axis` | `left` | Series | `:axiss` +`:color` | `auto` | Series | `:c`, `:colors` +`:fillto` | `nothing` | Series | `:area`, `:fill`, `:filltos` +`:group` | `nothing` | Series | `:g`, `:groups` +`:heatmap_c` | `(0.15,0.5)` | Series | `:heatmap_cs` +`:kwargs` | `Any[]` | Series | `:kwargss` +`:label` | `AUTO` | Series | `:lab`, `:labels` +`:linestyle` | `solid` | Series | `:linestyles`, `:ls`, `:s`, `:style` +`:linetype` | `path` | Series | `:linetypes`, `:lt`, `:t`, `:type` +`:marker` | `none` | Series | `:m`, `:markers` +`:markercolor` | `match` | Series | `:markercolors`, `:mc`, `:mcolor` +`:markersize` | `6` | Series | `:markersizes`, `:ms`, `:msize` +`:nbins` | `100` | Series | `:nb`, `:nbin`, `:nbinss` +`:reg` | `false` | Series | `:regs` +`:ribbon` | `nothing` | Series | `:r`, `:ribbons` +`:width` | `1` | Series | `:linewidth`, `:w`, `:widths` +`:background_color` | `RGB{U8}(1.0,1.0,1.0)` | Plot | `:background`, `:bg`, `:bg_color`, `:bgcolor` +`:legend` | `true` | Plot | `:leg` +`:show` | `false` | Plot | `:display` +`:size` | `(800,600)` | Plot | `:windowsize`, `:wsize` +`:title` | `` | Plot | `:` +`:windowtitle` | `Plots.jl` | Plot | `:wtitle` +`:xlabel` | `` | Plot | `:xlab` +`:xticks` | `true` | Plot | `:` +`:ylabel` | `` | Plot | `:ylab` +`:yrightlabel` | `` | Plot | `:y2lab`, `:y2label`, `:ylab2`, `:ylabel2`, `:ylabelright`, `:ylabr`, `:yrlab` +`:yticks` | `true` | Plot | `:` + + +Plot types: + +Type | Desc | Aliases +---- | ---- | ---- +`:none` | No line | `:n`, `:no` +`:line` | Lines with sorted x-axis | `:l` +`:path` | Lines | `:p` +`:steppre` | Step plot (vertical then horizontal) | `:stepinv`, `:stepinverted` +`:steppost` | Step plot (horizontal then vertical) | `:stair`, `:stairs`, `:step` +`:sticks` | Vertical lines | `:stem` +`:scatter` | Points, no lines | `:dots` +`:heatmap` | Colored regions by density | `:` +`:hexbin` | Similar to heatmap | `:` +`:hist` | Histogram (doesn't use x) | `:histogram` +`:bar` | Bar plot (centered on x values) | `:` +`:hline` | Horizontal line (doesn't use x) | `:` +`:vline` | Vertical line (doesn't use x) | `:` +`:ohlc` | Open/High/Low/Close chart (expects y is vector of 4-tuples) | `:` + + +Line styles: + +Type | Aliases +---- | ---- +`:auto` | `:a` +`:solid` | `:s` +`:dash` | `:d` +`:dot` | `:` +`:dashdot` | `:dd` +`:dashdotdot` | `:ddd` + + +Markers: + +Type | Aliases +---- | ---- +`:none` | `:n`, `:no` +`:auto` | `:a` +`:ellipse` | `:c`, `:circle` +`:rect` | `:r`, `:sq`, `:square` +`:diamond` | `:d` +`:utriangle` | `:^`, `:uptri`, `:uptriangle`, `:ut`, `:utri` +`:dtriangle` | `:V`, `:downtri`, `:downtriangle`, `:dt`, `:dtri`, `:v` +`:cross` | `:+`, `:plus` +`:xcross` | `:X`, `:x` +`:star1` | `:s`, `:star` +`:star2` | `:s2` +`:hexagon` | `:h`, `:hex` +`:octagon` | `:o`, `:oct` diff --git a/docs/example_generation.jl b/docs/example_generation.jl index 5f621405..707142cd 100644 --- a/docs/example_generation.jl +++ b/docs/example_generation.jl @@ -211,21 +211,61 @@ end # windowtitle # string or symbol, set the title of the enclosing windowtitle # screen # Integer, move enclosing window to this screen number (for multiscreen desktops) -const kwNotes = Dict( + + +const _ltdesc = Dict( + :none => "No line", + :line => "Lines with sorted x-axis", + :path => "Lines", + :steppre => "Step plot (vertical then horizontal)", + :steppost => "Step plot (horizontal then vertical)", + :sticks => "Vertical lines", + :scatter => "Points, no lines", + :heatmap => "Colored regions by density", + :hexbin => "Similar to heatmap", + :hist => "Histogram (doesn't use x)", + :bar => "Bar plot (centered on x values)", + :hline => "Horizontal line (doesn't use x)", + :vline => "Vertical line (doesn't use x)", + :ohlc => "Open/High/Low/Close chart (expects y is vector of 4-tuples)", ) function buildReadme() readme = readall("$DOCDIR/readme_template.md") # build keyword arg table - kwtable = "Keyword | Default | Type | Aliases \n---- | ---- | ---- | ----\n" + table = "Keyword | Default | Type | Aliases \n---- | ---- | ---- | ----\n" for d in (Plots._seriesDefaults, Plots._plotDefaults) for k in sort(collect(keys(d))) aliasstr = createStringOfMarkDownSymbols(aliases(Plots._keyAliases, k)) - kwtable = string(kwtable, "$k | $(d[k]) | $(d==Plots._seriesDefaults ? "Series" : "Plot") | $aliasstr \n") + table = string(table, "`:$k` | `$(d[k])` | $(d==Plots._seriesDefaults ? "Series" : "Plot") | $aliasstr \n") end end - readme = replace(readme, "[[KEYWORD_ARGS_TABLE]]", kwtable) + readme = replace(readme, "[[KEYWORD_ARGS_TABLE]]", table) + + # build linetypes table + table = "Type | Desc | Aliases\n---- | ---- | ----\n" + for lt in Plots._allTypes + aliasstr = createStringOfMarkDownSymbols(aliases(Plots._typeAliases, lt)) + table = string(table, "`:$lt` | $(_ltdesc[lt]) | $aliasstr \n") + end + readme = replace(readme, "[[LINETYPES_TABLE]]", table) + + # build linestyles table + table = "Type | Aliases\n---- | ----\n" + for s in Plots._allStyles + aliasstr = createStringOfMarkDownSymbols(aliases(Plots._styleAliases, s)) + table = string(table, "`:$s` | $aliasstr \n") + end + readme = replace(readme, "[[LINESTYLES_TABLE]]", table) + + # build markers table + table = "Type | Aliases\n---- | ----\n" + for s in Plots._allMarkers + aliasstr = createStringOfMarkDownSymbols(aliases(Plots._markerAliases, s)) + table = string(table, "`:$s` | $aliasstr \n") + end + readme = replace(readme, "[[MARKERS_TABLE]]", table) readme_fn = Pkg.dir("Plots") * "/README.md" f = open(readme_fn, "w") diff --git a/docs/readme_template.md b/docs/readme_template.md index 73525734..10f59404 100644 --- a/docs/readme_template.md +++ b/docs/readme_template.md @@ -159,6 +159,18 @@ Some keyword arguments you can set: [[KEYWORD_ARGS_TABLE]] +Plot types: + +[[LINETYPES_TABLE]] + +Line styles: + +[[LINESTYLES_TABLE]] + +Markers: + +[[MARKERS_TABLE]] + __Tip__: You can see the default value for a given argument with `plotDefault(arg::Symbol)`, and set the default value with `plotDefault!(arg::Symbol, value)` diff --git a/src/args.jl b/src/args.jl index 465f3cce..4172821c 100644 --- a/src/args.jl +++ b/src/args.jl @@ -114,7 +114,7 @@ _plotDefaults[:xlabel] = "" _plotDefaults[:ylabel] = "" _plotDefaults[:yrightlabel] = "" _plotDefaults[:legend] = true -_plotDefaults[:background_color] = RGB(0.1,0.1,0.1) # colorant"white" +_plotDefaults[:background_color] = colorant"white" _plotDefaults[:xticks] = true _plotDefaults[:yticks] = true _plotDefaults[:size] = (800,600)