diff --git a/docs/pyplot_examples.md b/docs/pyplot_examples.md index 6d8219bc..0926ca0e 100644 --- a/docs/pyplot_examples.md +++ b/docs/pyplot_examples.md @@ -1,6 +1,6 @@ # Examples for backend: pyplot -- Supported arguments: `annotation`, `axis`, `background_color`, `color`, `color_palette`, `fillrange`, `fillcolor`, `foreground_color`, `group`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `linewidth`, `markershape`, `markercolor`, `markersize`, `n`, `nbins`, `nc`, `nr`, `show`, `size`, `title`, `windowtitle`, `x`, `xlabel`, `xlims`, `xticks`, `y`, `ylabel`, `ylims`, `yrightlabel`, `yticks`, `xscale`, `yscale`, `xflip`, `yflip`, `z` +- Supported arguments: `annotation`, `axis`, `background_color`, `color`, `color_palette`, `fillrange`, `fillcolor`, `foreground_color`, `group`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `linewidth`, `markershape`, `markercolor`, `markersize`, `n`, `nbins`, `nc`, `nr`, `show`, `size`, `title`, `windowtitle`, `x`, `xlabel`, `xlims`, `xticks`, `y`, `ylabel`, `ylims`, `yrightlabel`, `yticks`, `xscale`, `yscale`, `xflip`, `yflip`, `z`, `tickfont`, `guidefont`, `legendfont` - Supported values for axis: `:auto`, `:left`, `:right` - Supported values for linetype: `:none`, `:line`, `:path`, `:steppre`, `:steppost`, `:sticks`, `:scatter`, `:heatmap`, `:hexbin`, `:hist`, `:bar`, `:hline`, `:vline` - Supported values for linestyle: `:auto`, `:solid`, `:dash`, `:dot`, `:dashdot` diff --git a/img/pyplot/pyplot_example_1.png b/img/pyplot/pyplot_example_1.png index 7fbdc433..c280be39 100644 Binary files a/img/pyplot/pyplot_example_1.png and b/img/pyplot/pyplot_example_1.png differ diff --git a/img/pyplot/pyplot_example_10.png b/img/pyplot/pyplot_example_10.png index 63314a21..7eb5851f 100644 Binary files a/img/pyplot/pyplot_example_10.png and b/img/pyplot/pyplot_example_10.png differ diff --git a/img/pyplot/pyplot_example_11.png b/img/pyplot/pyplot_example_11.png index 7a6d99f9..2a8e95b2 100644 Binary files a/img/pyplot/pyplot_example_11.png and b/img/pyplot/pyplot_example_11.png differ diff --git a/img/pyplot/pyplot_example_12.png b/img/pyplot/pyplot_example_12.png index d79e8469..9c1729f1 100644 Binary files a/img/pyplot/pyplot_example_12.png and b/img/pyplot/pyplot_example_12.png differ diff --git a/img/pyplot/pyplot_example_13.png b/img/pyplot/pyplot_example_13.png index 18262398..58aa85a3 100644 Binary files a/img/pyplot/pyplot_example_13.png and b/img/pyplot/pyplot_example_13.png differ diff --git a/img/pyplot/pyplot_example_14.png b/img/pyplot/pyplot_example_14.png index c89558e4..2d0917ae 100644 Binary files a/img/pyplot/pyplot_example_14.png and b/img/pyplot/pyplot_example_14.png differ diff --git a/img/pyplot/pyplot_example_15.png b/img/pyplot/pyplot_example_15.png index c3917c00..00fd2e3e 100644 Binary files a/img/pyplot/pyplot_example_15.png and b/img/pyplot/pyplot_example_15.png differ diff --git a/img/pyplot/pyplot_example_16.png b/img/pyplot/pyplot_example_16.png index 23a60282..9e2b5f9d 100644 Binary files a/img/pyplot/pyplot_example_16.png and b/img/pyplot/pyplot_example_16.png differ diff --git a/img/pyplot/pyplot_example_17.png b/img/pyplot/pyplot_example_17.png index 95c4427d..ba9ffef5 100644 Binary files a/img/pyplot/pyplot_example_17.png and b/img/pyplot/pyplot_example_17.png differ diff --git a/img/pyplot/pyplot_example_18.png b/img/pyplot/pyplot_example_18.png index 6bff91e8..742c1c77 100644 Binary files a/img/pyplot/pyplot_example_18.png and b/img/pyplot/pyplot_example_18.png differ diff --git a/img/pyplot/pyplot_example_2.gif b/img/pyplot/pyplot_example_2.gif index 90b5b64f..19385605 100644 Binary files a/img/pyplot/pyplot_example_2.gif and b/img/pyplot/pyplot_example_2.gif differ diff --git a/img/pyplot/pyplot_example_20.png b/img/pyplot/pyplot_example_20.png index 293d3131..9bdde1fb 100644 Binary files a/img/pyplot/pyplot_example_20.png and b/img/pyplot/pyplot_example_20.png differ diff --git a/img/pyplot/pyplot_example_3.png b/img/pyplot/pyplot_example_3.png index 9d594608..77f7bbc2 100644 Binary files a/img/pyplot/pyplot_example_3.png and b/img/pyplot/pyplot_example_3.png differ diff --git a/img/pyplot/pyplot_example_4.png b/img/pyplot/pyplot_example_4.png index e61e2669..831f7198 100644 Binary files a/img/pyplot/pyplot_example_4.png and b/img/pyplot/pyplot_example_4.png differ diff --git a/img/pyplot/pyplot_example_5.png b/img/pyplot/pyplot_example_5.png index ac0d029c..0ef1e14a 100644 Binary files a/img/pyplot/pyplot_example_5.png and b/img/pyplot/pyplot_example_5.png differ diff --git a/img/pyplot/pyplot_example_6.png b/img/pyplot/pyplot_example_6.png index 41d4ebe2..148457f5 100644 Binary files a/img/pyplot/pyplot_example_6.png and b/img/pyplot/pyplot_example_6.png differ diff --git a/img/pyplot/pyplot_example_7.png b/img/pyplot/pyplot_example_7.png index db4cdddf..cec820e9 100644 Binary files a/img/pyplot/pyplot_example_7.png and b/img/pyplot/pyplot_example_7.png differ diff --git a/img/pyplot/pyplot_example_8.png b/img/pyplot/pyplot_example_8.png index 185218f6..89295b1a 100644 Binary files a/img/pyplot/pyplot_example_8.png and b/img/pyplot/pyplot_example_8.png differ diff --git a/img/pyplot/pyplot_example_9.png b/img/pyplot/pyplot_example_9.png index cab84480..7d46f95c 100644 Binary files a/img/pyplot/pyplot_example_9.png and b/img/pyplot/pyplot_example_9.png differ diff --git a/src/Plots.jl b/src/Plots.jl index 4db151a5..30e735ef 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -60,8 +60,8 @@ export dataframes, Shape, - PlotText, text, + font, OHLC, colorscheme, diff --git a/src/args.jl b/src/args.jl index faabf9d6..a069ae0f 100644 --- a/src/args.jl +++ b/src/args.jl @@ -121,7 +121,7 @@ _seriesDefaults[:fillopacity] = nothing # _seriesDefaults[:ribbon] = nothing # _seriesDefaults[:ribboncolor] = :match _seriesDefaults[:nbins] = 100 # number of bins for heatmaps and hists -_seriesDefaults[:heatmap_c] = (0.15, 0.5) # TODO: this should be replaced with a ColorGradient +# _seriesDefaults[:heatmap_c] = (0.15, 0.5) # TODO: this should be replaced with a ColorGradient # _seriesDefaults[:fill] = nothing # fills in the area _seriesDefaults[:smooth] = false # regression line? _seriesDefaults[:group] = nothing # groupby vector @@ -163,9 +163,9 @@ _plotDefaults[:link] = false _plotDefaults[:linkx] = false _plotDefaults[:linky] = false _plotDefaults[:linkfunc] = nothing -_plotDefaults[:tickfont] = font(11) -_plotDefaults[:guidefont] = font(14) -_plotDefaults[:legendfont] = font(9) +_plotDefaults[:tickfont] = font(8) +_plotDefaults[:guidefont] = font(11) +_plotDefaults[:legendfont] = font(8) _plotDefaults[:grid] = true @@ -180,7 +180,7 @@ supportedArgs() = supportedArgs(backend()) @compat const _argNotes = Dict( :color => "Series color. To have different marker and/or fill colors, optionally set the markercolor and fillcolor args.", :z => "Determines the depth. For color gradients, we expect 0 ≤ z ≤ 1.", - :heatmap_c => "For Qwt heatmaps only... will be deprecated eventually.", + # :heatmap_c => "For Qwt heatmaps only... will be deprecated eventually.", ) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 583ac6e6..2b8a8f8f 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -55,9 +55,9 @@ supportedArgs(::PyPlotPackage) = [ :xflip, :yflip, :z, - # :tickfont, - # :guidefont, - # :legendfont, + :tickfont, + :guidefont, + :legendfont, # :grid, ] supportedAxes(::PyPlotPackage) = _allAxes @@ -376,6 +376,8 @@ function addPyPlotTicks(ax, ticks, isx::Bool) end end +usingRightAxis(plt::Plot{PyPlotPackage}) = any(args -> args[:axis] in (:right,:auto), plt.seriesargs) + function updatePlotItems(plt::Plot{PyPlotPackage}, d::Dict) figorax = plt.o ax = getLeftAxis(figorax) @@ -387,7 +389,7 @@ function updatePlotItems(plt::Plot{PyPlotPackage}, d::Dict) if haskey(d, :ylabel) ax[:set_ylabel](d[:ylabel]) end - if haskey(d, :yrightlabel) + if usingRightAxis(plt) && get(d, :yrightlabel, "") != "" rightax = getRightAxis(figorax) rightax[:set_ylabel](d[:yrightlabel]) end @@ -409,6 +411,31 @@ function updatePlotItems(plt::Plot{PyPlotPackage}, d::Dict) ax[:invert_yaxis]() end + axes = [getLeftAxis(figorax)] + if usingRightAxis(plt) + push!(axes, getRightAxis(figorax)) + end + + # font sizes + for ax in axes + # haskey(d, :yrightlabel) || continue + + + # guides + sz = get(d, :guidefont, plt.initargs[:guidefont]).pointsize + ax[:title][:set_fontsize](sz) + ax[:xaxis][:label][:set_fontsize](sz) + ax[:yaxis][:label][:set_fontsize](sz) + + # ticks + sz = get(d, :tickfont, plt.initargs[:tickfont]).pointsize + for sym in (:get_xticklabels, :get_yticklabels) + for lab in ax[sym]() + lab[:set_fontsize](sz) + end + end + end + end function applyPyPlotScale(ax, scaleType::Symbol, isx::Bool) diff --git a/src/backends/qwt.jl b/src/backends/qwt.jl index 57df5eea..2ec971d8 100644 --- a/src/backends/qwt.jl +++ b/src/backends/qwt.jl @@ -18,7 +18,7 @@ supportedArgs(::QwtPackage) = [ :fillcolor, :foreground_color, :group, - :heatmap_c, + # :heatmap_c, # :kwargs, :label, :layout,