fix polar plots
This commit is contained in:
parent
242d8b290d
commit
1f14a4d4c6
@ -18,14 +18,18 @@ end
|
|||||||
function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||||
if !pgfx_plot.is_created
|
if !pgfx_plot.is_created
|
||||||
cols, rows = size(plt.layout.grid)
|
cols, rows = size(plt.layout.grid)
|
||||||
the_plot = PGFPlotsX.TikzPicture(PGFPlotsX.GroupPlot(
|
the_plot = PGFPlotsX.TikzPicture()
|
||||||
PGFPlotsX.Options(
|
# the combination of groupplot and polaraxis is broken in pgfplots
|
||||||
"group style" => PGFPlotsX.Options(
|
if !any( sp -> ispolar(sp), plt.subplots )
|
||||||
"group size" => string(cols)*" by "*string(rows)
|
push!( the_plot, PGFPlotsX.GroupPlot(
|
||||||
|
PGFPlotsX.Options(
|
||||||
|
"group style" => PGFPlotsX.Options(
|
||||||
|
"group size" => string(cols)*" by "*string(rows)
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))
|
end
|
||||||
|
|
||||||
pushed_colormap = false
|
pushed_colormap = false
|
||||||
for sp in plt.subplots
|
for sp in plt.subplots
|
||||||
bb = bbox(sp)
|
bb = bbox(sp)
|
||||||
@ -121,6 +125,9 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
st = series[:seriestype]
|
st = series[:seriestype]
|
||||||
|
series_opt = PGFPlotsX.Options(
|
||||||
|
"color" => opt[:linecolor],
|
||||||
|
)
|
||||||
# function args
|
# function args
|
||||||
args = if st == :contour
|
args = if st == :contour
|
||||||
opt[:z].surf, opt[:x], opt[:y]
|
opt[:z].surf, opt[:x], opt[:y]
|
||||||
@ -136,9 +143,6 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
else
|
else
|
||||||
opt[:x], opt[:y]
|
opt[:x], opt[:y]
|
||||||
end
|
end
|
||||||
series_opt = PGFPlotsX.Options(
|
|
||||||
"color" => opt[:linecolor],
|
|
||||||
)
|
|
||||||
if is3d(series)
|
if is3d(series)
|
||||||
series_func = PGFPlotsX.Plot3
|
series_func = PGFPlotsX.Plot3
|
||||||
else
|
else
|
||||||
@ -183,7 +187,12 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
pgfx_add_annotation!(series_plot, xi, yi, PlotText(str, fnt), pgfx_thickness_scaling(series))
|
pgfx_add_annotation!(series_plot, xi, yi, PlotText(str, fnt), pgfx_thickness_scaling(series))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
push!( the_plot.elements[1], axis )
|
if ispolar(sp)
|
||||||
|
axes = the_plot
|
||||||
|
else
|
||||||
|
axes = the_plot.elements[1]
|
||||||
|
end
|
||||||
|
push!( axes, axis )
|
||||||
if length(plt.o.the_plot.elements) > 0
|
if length(plt.o.the_plot.elements) > 0
|
||||||
plt.o.the_plot.elements[1] = the_plot
|
plt.o.the_plot.elements[1] = the_plot
|
||||||
else
|
else
|
||||||
@ -570,7 +579,7 @@ end
|
|||||||
|
|
||||||
function _show(io::IO, mime::MIME"application/x-tex", plt::Plot{PGFPlotsXBackend})
|
function _show(io::IO, mime::MIME"application/x-tex", plt::Plot{PGFPlotsXBackend})
|
||||||
_update_plot_object(plt)
|
_update_plot_object(plt)
|
||||||
PGFPlotsX.print_tex(plt.o.the_plot)
|
PGFPlotsX.print_tex(io, plt.o.the_plot)
|
||||||
end
|
end
|
||||||
|
|
||||||
function _display(plt::Plot{PGFPlotsXBackend})
|
function _display(plt::Plot{PGFPlotsXBackend})
|
||||||
|
|||||||
@ -65,7 +65,6 @@ end
|
|||||||
Θ = range(0, stop=1.5π, length=100)
|
Θ = range(0, stop=1.5π, length=100)
|
||||||
r = abs.(0.1 * randn(100) + sin.(3Θ))
|
r = abs.(0.1 * randn(100) + sin.(3Θ))
|
||||||
plot(Θ, r, proj=:polar, m=2)
|
plot(Θ, r, proj=:polar, m=2)
|
||||||
# TODO: handle polar plots
|
|
||||||
end # testset
|
end # testset
|
||||||
@testset "Histogram 2D" begin
|
@testset "Histogram 2D" begin
|
||||||
histogram2d(randn(10000), randn(10000), nbins=20)
|
histogram2d(randn(10000), randn(10000), nbins=20)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user