x/y/z ticklabel rotation; new supported graphs using heatmap
This commit is contained in:
parent
00f3d450f9
commit
3c09921cbd
@ -180,6 +180,9 @@ _plotDefaults[:zticks] = :auto
|
|||||||
_plotDefaults[:xscale] = :identity
|
_plotDefaults[:xscale] = :identity
|
||||||
_plotDefaults[:yscale] = :identity
|
_plotDefaults[:yscale] = :identity
|
||||||
_plotDefaults[:zscale] = :identity
|
_plotDefaults[:zscale] = :identity
|
||||||
|
_plotDefaults[:xrotation] = 0
|
||||||
|
_plotDefaults[:yrotation] = 0
|
||||||
|
_plotDefaults[:zrotation] = 0
|
||||||
_plotDefaults[:xflip] = false
|
_plotDefaults[:xflip] = false
|
||||||
_plotDefaults[:yflip] = false
|
_plotDefaults[:yflip] = false
|
||||||
_plotDefaults[:zflip] = false
|
_plotDefaults[:zflip] = false
|
||||||
@ -304,15 +307,18 @@ add_aliases(:annotation, :ann, :anns, :annotate, :annotations)
|
|||||||
add_aliases(:xlabel, :xlab, :xl)
|
add_aliases(:xlabel, :xlab, :xl)
|
||||||
add_aliases(:xlims, :xlim, :xlimit, :xlimits)
|
add_aliases(:xlims, :xlim, :xlimit, :xlimits)
|
||||||
add_aliases(:xticks, :xtick)
|
add_aliases(:xticks, :xtick)
|
||||||
|
add_aliases(:xrotation, :xrot, :xr)
|
||||||
add_aliases(:ylabel, :ylab, :yl)
|
add_aliases(:ylabel, :ylab, :yl)
|
||||||
add_aliases(:ylims, :ylim, :ylimit, :ylimits)
|
add_aliases(:ylims, :ylim, :ylimit, :ylimits)
|
||||||
add_aliases(:yticks, :ytick)
|
add_aliases(:yticks, :ytick)
|
||||||
add_aliases(:yrightlabel, :yrlab, :yrl, :ylabel2, :y2label, :ylab2, :y2lab, :ylabr, :ylabelright)
|
add_aliases(:yrightlabel, :yrlab, :yrl, :ylabel2, :y2label, :ylab2, :y2lab, :ylabr, :ylabelright)
|
||||||
add_aliases(:yrightlims, :yrlim, :yrlimit, :yrlimits)
|
add_aliases(:yrightlims, :yrlim, :yrlimit, :yrlimits)
|
||||||
add_aliases(:yrightticks, :yrtick)
|
add_aliases(:yrightticks, :yrtick)
|
||||||
|
add_aliases(:yrotation, :yrot, :yr)
|
||||||
add_aliases(:zlabel, :zlab, :zl)
|
add_aliases(:zlabel, :zlab, :zl)
|
||||||
add_aliases(:zlims, :zlim, :zlimit, :zlimits)
|
add_aliases(:zlims, :zlim, :zlimit, :zlimits)
|
||||||
add_aliases(:zticks, :ztick)
|
add_aliases(:zticks, :ztick)
|
||||||
|
add_aliases(:zrotation, :zrot, :zr)
|
||||||
add_aliases(:legend, :leg, :key)
|
add_aliases(:legend, :leg, :key)
|
||||||
add_aliases(:colorbar, :cb, :cbar, :colorkey)
|
add_aliases(:colorbar, :cb, :cbar, :colorkey)
|
||||||
add_aliases(:smooth, :regression, :reg)
|
add_aliases(:smooth, :regression, :reg)
|
||||||
|
|||||||
@ -20,10 +20,10 @@ supportedArgs(::PyPlotBackend) = [
|
|||||||
:n, :nc, :nr, :layout,
|
:n, :nc, :nr, :layout,
|
||||||
:smooth,
|
:smooth,
|
||||||
:title, :windowtitle, :show, :size,
|
:title, :windowtitle, :show, :size,
|
||||||
:x, :xlabel, :xlims, :xticks, :xscale, :xflip,
|
:x, :xlabel, :xlims, :xticks, :xscale, :xflip, :xrotation,
|
||||||
:y, :ylabel, :ylims, :yticks, :yscale, :yflip,
|
:y, :ylabel, :ylims, :yticks, :yscale, :yflip, :yrotation,
|
||||||
:axis, :yrightlabel,
|
:axis, :yrightlabel,
|
||||||
:z, :zlabel, :zlims, :zticks, :zscale, :zflip,
|
:z, :zlabel, :zlims, :zticks, :zscale, :zflip, :zrotation,
|
||||||
:z,
|
:z,
|
||||||
:tickfont, :guidefont, :legendfont,
|
:tickfont, :guidefont, :legendfont,
|
||||||
:grid, :legend, :colorbar,
|
:grid, :legend, :colorbar,
|
||||||
@ -885,7 +885,8 @@ function _update_plot(plt::Plot{PyPlotBackend}, d::KW)
|
|||||||
|
|
||||||
# handle each axis in turn
|
# handle each axis in turn
|
||||||
for letter in ("x", "y", "z")
|
for letter in ("x", "y", "z")
|
||||||
axis, scale, lims, ticks, flip, lab = axis_symbols(letter, "axis", "scale", "lims", "ticks", "flip", "label")
|
axis, scale, lims, ticks, flip, lab, rotation =
|
||||||
|
axis_symbols(letter, "axis", "scale", "lims", "ticks", "flip", "label", "rotation")
|
||||||
haskey(ax, axis) || continue
|
haskey(ax, axis) || continue
|
||||||
haskey(d, scale) && applyPyPlotScale(ax, d[scale], letter)
|
haskey(d, scale) && applyPyPlotScale(ax, d[scale], letter)
|
||||||
haskey(d, lims) && addPyPlotLims(ax, d[lims], letter)
|
haskey(d, lims) && addPyPlotLims(ax, d[lims], letter)
|
||||||
@ -898,6 +899,7 @@ function _update_plot(plt::Plot{PyPlotBackend}, d::KW)
|
|||||||
tmpax[axis][:label][:set_fontsize](guidesz)
|
tmpax[axis][:label][:set_fontsize](guidesz)
|
||||||
for lab in tmpax[symbol("get_", letter, "ticklabels")]()
|
for lab in tmpax[symbol("get_", letter, "ticklabels")]()
|
||||||
lab[:set_fontsize](ticksz)
|
lab[:set_fontsize](ticksz)
|
||||||
|
haskey(d, rotation) && lab[:set_rotation](d[rotation])
|
||||||
end
|
end
|
||||||
if get(d, :grid, false)
|
if get(d, :grid, false)
|
||||||
fgcolor = getPyPlotColor(plt.plotargs[:foreground_color_grid])
|
fgcolor = getPyPlotColor(plt.plotargs[:foreground_color_grid])
|
||||||
|
|||||||
@ -109,7 +109,7 @@ function plot!(plt::Plot, args...; kw...)
|
|||||||
|
|
||||||
# add title, axis labels, ticks, etc
|
# add title, axis labels, ticks, etc
|
||||||
if !haskey(d, :subplot)
|
if !haskey(d, :subplot)
|
||||||
# merge!(plt.plotargs, d)
|
merge!(plt.plotargs, d)
|
||||||
# handlePlotColors(plt.backend, plt.plotargs)
|
# handlePlotColors(plt.backend, plt.plotargs)
|
||||||
dumpdict(plt.plotargs, "Updating plot items")
|
dumpdict(plt.plotargs, "Updating plot items")
|
||||||
_update_plot(plt, plt.plotargs)
|
_update_plot(plt, plt.plotargs)
|
||||||
|
|||||||
29
src/utils.jl
29
src/utils.jl
@ -542,19 +542,22 @@ end
|
|||||||
function supportGraph(allvals, func)
|
function supportGraph(allvals, func)
|
||||||
vals = reverse(sort(allvals))
|
vals = reverse(sort(allvals))
|
||||||
bs = sort(backends())
|
bs = sort(backends())
|
||||||
x = ASCIIString[]
|
x, y = map(string, bs), map(string, vals)
|
||||||
y = ASCIIString[]
|
nx, ny = map(length, (x,y))
|
||||||
for val in vals
|
z = zeros(nx, ny)
|
||||||
for b in bs
|
for i=1:nx, j=1:ny
|
||||||
supported = func(Plots._backend_instance(b))
|
supported = func(Plots._backend_instance(bs[i]))
|
||||||
if val in supported
|
z[i,j] = float(vals[j] in supported) * (0.4i/nx+0.6)
|
||||||
push!(x, string(b))
|
|
||||||
push!(y, string(val))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
n = length(vals)
|
heatmap(x, y, z,
|
||||||
scatter(x, y, m=:rect, ms=10, size=(300,100+18*n), leg=false)
|
color = ColorGradient([:white, :darkblue]),
|
||||||
|
line = (1, :black),
|
||||||
|
leg = false,
|
||||||
|
size = (50nx+50, 35ny+100),
|
||||||
|
xlim = (0.5, nx+0.5),
|
||||||
|
ylim = (0.5, ny+0.5),
|
||||||
|
xrotation = 60,
|
||||||
|
aspect_ratio = :equal)
|
||||||
end
|
end
|
||||||
|
|
||||||
supportGraphArgs() = supportGraph(_allArgs, supportedArgs)
|
supportGraphArgs() = supportGraph(_allArgs, supportedArgs)
|
||||||
@ -568,7 +571,7 @@ function dumpSupportGraphs()
|
|||||||
for func in (supportGraphArgs, supportGraphTypes, supportGraphStyles,
|
for func in (supportGraphArgs, supportGraphTypes, supportGraphStyles,
|
||||||
supportGraphMarkers, supportGraphScales, supportGraphAxes)
|
supportGraphMarkers, supportGraphScales, supportGraphAxes)
|
||||||
plt = func()
|
plt = func()
|
||||||
png(joinpath(Pkg.dir("ExamplePlots"), "docs", "examples", "img", "supported", "$(string(func))"))
|
png(Pkg.dir("ExamplePlots", "docs", "examples", "img", "supported", "$(string(func))"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user