Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 824d502c37 | |||
| 36ff017c4f | |||
| 3ef9fe142c | |||
| 4bf0c496d8 | |||
| 9bf4bda852 | |||
| fa7f10a6e9 | |||
| 483e45db8a | |||
| e6097f4534 | |||
| 749f56084a | |||
| 2fa4a63f02 | |||
| 9b1249abce | |||
| bbfc0bc77a | |||
| 5a416e51d2 | |||
| dc5ae4ef96 |
+2
-2
@@ -1,7 +1,7 @@
|
||||
name = "Plots"
|
||||
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
|
||||
author = ["Tom Breloff (@tbreloff)"]
|
||||
version = "1.0.4"
|
||||
version = "1.0.6"
|
||||
|
||||
[deps]
|
||||
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
|
||||
@@ -46,7 +46,7 @@ RecipesBase = "1"
|
||||
Reexport = "0.2"
|
||||
Requires = "0.5, 1.0"
|
||||
Showoff = "0.3.1"
|
||||
StatsBase = "0.32"
|
||||
StatsBase = "0.32, 0.33"
|
||||
julia = "1"
|
||||
|
||||
[extras]
|
||||
|
||||
+4
-3
@@ -1424,8 +1424,9 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
end
|
||||
|
||||
# border
|
||||
intensity = sp[:framestyle] == :semi ? 0.5 : 1.0
|
||||
intensity = sp[:framestyle] == :semi ? 0.5 : 1
|
||||
if sp[:framestyle] in (:box, :semi)
|
||||
GR.setclip(0)
|
||||
gr_set_line(intensity, :solid, xaxis[:foreground_color_border])
|
||||
gr_set_transparency(xaxis[:foreground_color_border], intensity)
|
||||
gr_polyline(coords(xborder_segs)...)
|
||||
@@ -1808,7 +1809,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
if sp[:legend] == :inline && should_add_to_legend(series)
|
||||
gr_set_font(legendfont(sp))
|
||||
gr_set_textcolor(plot_color(sp[:legendfontcolor]))
|
||||
if sp[:yaxis][:mirror]
|
||||
if sp[:yaxis][:mirror]
|
||||
(_,i) = sp[:xaxis][:flip] ? findmax(x) : findmin(x)
|
||||
GR.settextalign(GR.TEXT_HALIGN_RIGHT, GR.TEXT_VALIGN_HALF)
|
||||
offset = -0.01
|
||||
@@ -1827,7 +1828,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
hascolorbar(sp) && gr_draw_colorbar(cbar, sp, get_clims(sp))
|
||||
|
||||
# add the legend
|
||||
if !(sp[:legend] in(:none, :inline))
|
||||
if !(sp[:legend] in(:none, :inline))
|
||||
GR.savestate()
|
||||
GR.selntran(0)
|
||||
GR.setscale(0)
|
||||
|
||||
+54
-21
@@ -180,9 +180,8 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
push!(axis_opt["legend style"], "at={($x, $y)}")
|
||||
else
|
||||
push!(
|
||||
axis_opt,
|
||||
"legend pos" =>
|
||||
get(_pgfplotsx_legend_pos, sp[:legend], "outer north east"),
|
||||
axis_opt["legend style"],
|
||||
get(_pgfplotsx_legend_pos, sp[:legend], ("at" => string((1.02, 1)), "anchor" => "north west"))...
|
||||
)
|
||||
end
|
||||
for letter in (:x, :y, :z)
|
||||
@@ -611,22 +610,22 @@ const _pgfplotsx_markers = KW(
|
||||
)
|
||||
|
||||
const _pgfplotsx_legend_pos = KW(
|
||||
:top => "north",
|
||||
:bottom => "south",
|
||||
:left => "west",
|
||||
:right => "east",
|
||||
:bottomleft => "south west",
|
||||
:bottomright => "south east",
|
||||
:topright => "north east",
|
||||
:topleft => "north west",
|
||||
:outertop => "north",
|
||||
:outerbottom => "outer south",
|
||||
:outerleft => "outer west",
|
||||
:outerright => "outer east",
|
||||
:outerbottomleft => "outer south west",
|
||||
:outerbottomright => "outer south east",
|
||||
:outertopright => "outer north east",
|
||||
:outertopleft => "outer north west",
|
||||
:top => ("at" => string((0.5, 0.98)), "anchor" => "north"),
|
||||
:bottom => ("at" => string((0.5, 0.02)), "anchor" => "south"),
|
||||
:left => ("at" => string((0.02, 0.5)), "anchor" => "west"),
|
||||
:right => ("at" => string((0.98, 0.5)), "anchor" => "east"),
|
||||
:bottomleft => ("at" => string((0.02, 0.02)), "anchor" => "south west"),
|
||||
:bottomright => ("at" => string((0.98, 0.02)), "anchor" => "south east"),
|
||||
:topright => ("at" => string((0.98, 0.98)), "anchor" => "north east"),
|
||||
:topleft => ("at" => string((-0.02, 0.98)), "anchor" => "north west"),
|
||||
:outertop => ("at" => string((0.5, 1.02)), "anchor" => "south"),
|
||||
:outerbottom => ("at" => string((0.5, -0.02)), "anchor" => "north"),
|
||||
:outerleft => ("at" => string((-0.02, 0.5)), "anchor" => "east"),
|
||||
:outerright => ("at" => string((1.02, 0.5)), "anchor" => "west"),
|
||||
:outerbottomleft => ("at" => string((-0.02, -0.02)), "anchor" => "north east"),
|
||||
:outerbottomright => ("at" => string((1.02, -0.02)), "anchor" => "north west"),
|
||||
:outertopright => ("at" => string((1.02, 1)), "anchor" => "north west"),
|
||||
:outertopleft => ("at" => string((-0.02, 1)), "anchor" => "north east"),
|
||||
)
|
||||
|
||||
const _pgfx_framestyles = [:box, :axes, :origin, :zerolines, :grid, :none]
|
||||
@@ -911,7 +910,7 @@ function pgfx_sanitize_string(s::AbstractString)
|
||||
s = replace(s, r"\\?\}" => "\\}")
|
||||
end
|
||||
@require LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" begin
|
||||
using LaTeXStrings
|
||||
using .LaTeXStrings
|
||||
function pgfx_sanitize_string(s::LaTeXString)
|
||||
s = replace(s, r"\\?\#" => "\\#")
|
||||
s = replace(s, r"\\?\%" => "\\%")
|
||||
@@ -1014,6 +1013,8 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
||||
# ticks on or off
|
||||
if axis[:ticks] in (nothing, false, :none) || framestyle == :none
|
||||
push!(opt, "$(letter)majorticks" => "false")
|
||||
elseif framestyle in (:grid, :zerolines)
|
||||
push!(opt, "$letter tick style" => PGFPlotsX.Options("draw" => "none"))
|
||||
end
|
||||
|
||||
# grid on or off
|
||||
@@ -1029,6 +1030,7 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
||||
push!(opt, string(letter, :min) => lims[1], string(letter, :max) => lims[2])
|
||||
|
||||
if !(axis[:ticks] in (nothing, false, :none, :native)) && framestyle != :none
|
||||
# ticks
|
||||
ticks = get_ticks(sp, axis)
|
||||
#pgf plot ignores ticks with angle below 90 when xmin = 90 so shift values
|
||||
tick_values =
|
||||
@@ -1094,6 +1096,37 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
||||
axis[:gridstyle],
|
||||
),
|
||||
)
|
||||
|
||||
# minor ticks
|
||||
# NOTE: PGFPlots would provide "minor x ticks num", but this only places minor ticks
|
||||
# between major ticks and not outside first and last tick to the axis limits.
|
||||
# Hence, we hack around with extra ticks. Unfortunately this conflicts with
|
||||
# `:zerolines` framestyle hack. So minor ticks are not working with
|
||||
# `:zerolines`.
|
||||
minor_ticks = get_minor_ticks(sp, axis, ticks)
|
||||
if minor_ticks !== nothing
|
||||
minor_ticks =
|
||||
ispolar(sp) && letter == :x ? [rad2deg.(minor_ticks)[3:end]..., 360, 405] :
|
||||
minor_ticks
|
||||
push!(
|
||||
opt,
|
||||
string("extra ", letter, " ticks") => string("{", join(minor_ticks, ","), "}"),
|
||||
)
|
||||
push!(opt, string("extra ", letter, " tick labels") => "")
|
||||
push!(
|
||||
opt,
|
||||
string("extra ", letter, " tick style") => PGFPlotsX.Options(
|
||||
"grid" => axis[:minorgrid] ? "major" : "none",
|
||||
string(letter, " grid style") => pgfx_linestyle(
|
||||
pgfx_thickness_scaling(sp) * axis[:minorgridlinewidth],
|
||||
axis[:foreground_color_minor_grid],
|
||||
axis[:minorgridalpha],
|
||||
axis[:minorgridstyle],
|
||||
),
|
||||
"major tick length" => axis[:minorticks] ? "0.1cm" : "0"
|
||||
),
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
# framestyle
|
||||
@@ -1115,7 +1148,7 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
||||
opt,
|
||||
string("extra ", letter, " tick style") => PGFPlotsX.Options(
|
||||
"grid" => "major",
|
||||
"major grid style" => pgfx_linestyle(
|
||||
string(letter, " grid style") => pgfx_linestyle(
|
||||
pgfx_thickness_scaling(sp),
|
||||
axis[:foreground_color_border],
|
||||
1.0,
|
||||
|
||||
@@ -43,7 +43,7 @@ _display(plt::Plot{PlotlyJSBackend}) = display(plotlyjs_syncplot(plt))
|
||||
@require WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29" begin
|
||||
function WebIO.render(plt::Plot{PlotlyJSBackend})
|
||||
plt_html = sprint(show, MIME("text/html"), plt)
|
||||
return WebIO.render(dom"div"(innerHTML=plt_html))
|
||||
return WebIO.render(WebIO.dom"div"(innerHTML=plt_html))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user