Make radial axis vertical.

This commit is contained in:
Andrew Palugniok 2017-11-03 19:45:17 +00:00
parent 12aa43ff5f
commit f0ad851aa7
3 changed files with 9 additions and 4 deletions

View File

@ -306,7 +306,8 @@ function pgf_axis(sp::Subplot, letter)
if !(axis[:ticks] in (nothing, false, :none)) && framestyle != :none
ticks = get_ticks(axis)
tick_values = ispolar(sp) && letter == :x ? rad2deg.(ticks[1]) : ticks[1]
#pgf plot ignores ticks with angle below 90 when xmin = 90 so shift values
tick_values = ispolar(sp) && letter == :x ? [rad2deg.(ticks[1])[3:end]..., 360, 415] : ticks[1]
push!(style, string(letter, "tick = {", join(tick_values,","), "}"))
if axis[:showaxis] && axis[:scale] in (:ln, :log2, :log10) && axis[:ticks] == :auto
# wrap the power part of label with }
@ -317,7 +318,8 @@ function pgf_axis(sp::Subplot, letter)
end for label in ticks[2]]
push!(style, string(letter, "ticklabels = {\$", join(tick_labels,"\$,\$"), "\$}"))
elseif axis[:showaxis]
push!(style, string(letter, "ticklabels = {", join(ticks[2],","), "}"))
tick_labels = ispolar(sp) && letter == :x ? [ticks[2][3:end]..., "0", "45"] : ticks[2]
push!(style, string(letter, "ticklabels = {", join(tick_labels,","), "}"))
else
push!(style, string(letter, "ticklabels = {}"))
end
@ -405,6 +407,9 @@ function _update_plot_object(plt::Plot{PGFPlotsBackend})
axisf = PGFPlots.Axis
if sp[:projection] == :polar
axisf = PGFPlots.PolarAxis
#make radial axis vertical
kw[:xmin] = 90
kw[:xmax] = 450
end
# Search series for any gradient. In case one series uses a gradient set

View File

@ -301,7 +301,7 @@ function plotly_polaraxis(axis::Axis)
ax[:range] = rad2deg.(axis_limits(axis))
else
ax[:range] = axis_limits(axis)
ax[:orientation] = 0
ax[:orientation] = -90
end
ax

View File

@ -1055,7 +1055,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
py_set_scale(ax, axis)
py_set_lims(ax, axis)
if ispolar(sp) && letter == :y
ax[:set_rlabel_position](0)
ax[:set_rlabel_position](90)
end
ticks = sp[:framestyle] == :none ? nothing : get_ticks(axis)
# don't show the 0 tick label for the origin framestyle