diff --git a/debug.tex b/debug.tex new file mode 100644 index 00000000..fc73d925 --- /dev/null +++ b/debug.tex @@ -0,0 +1,26 @@ +\begin{tikzpicture}[/tikz/background rectangle/.style={fill={rgb,1:red,1.0;green,1.0;blue,1.0}, draw opacity={1.0}}, show background rectangle] +\begin{axis}[title={Line}, title style={at={{(0.5,1)}}, font={{\fontsize{14 pt}{18.2 pt}\selectfont}}, color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, rotate={0.0}}, legend style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, line width={1}, solid, fill={rgb,1:red,1.0;green,1.0;blue,1.0}, fill opacity={1.0}, text opacity={1.0}, font={{\fontsize{8 pt}{10.4 pt}\selectfont}}, at={(1.02, 1)}, anchor={north west}}, axis background/.style={fill={rgb,1:red,1.0;green,1.0;blue,1.0}, opacity={1.0}}, anchor={north west}, xshift={1.0mm}, yshift={-1.0mm}, width={69.2mm}, height={99.6mm}, scaled x ticks={false}, xlabel={}, x tick style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, opacity={1.0}}, x tick label style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, opacity={1.0}, rotate={0}}, xlabel style={, font={{\fontsize{11 pt}{14.3 pt}\selectfont}}, color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, rotate={0.0}}, xmajorgrids={true}, xmin={0.88}, xmax={5.12}, xtick={{1.0,2.0,3.0,4.0,5.0}}, xticklabels={{$1$,$2$,$3$,$4$,$5$}}, xtick align={inside}, xticklabel style={font={{\fontsize{8 pt}{10.4 pt}\selectfont}}, color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, rotate={0.0}}, x grid style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={0.1}, line width={0.5}, solid}, axis x line*={left}, x axis line style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, line width={1}, solid}, scaled y ticks={false}, ylabel={}, y tick style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, opacity={1.0}}, y tick label style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, opacity={1.0}, rotate={0}}, ylabel style={, font={{\fontsize{11 pt}{14.3 pt}\selectfont}}, color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, rotate={0.0}}, ymajorgrids={true}, ymin={0.88}, ymax={5.12}, ytick={{1.0,2.0,3.0,4.0,5.0}}, yticklabels={{$1$,$2$,$3$,$4$,$5$}}, ytick align={inside}, yticklabel style={font={{\fontsize{8 pt}{10.4 pt}\selectfont}}, color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, rotate={0.0}}, y grid style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={0.1}, line width={0.5}, solid}, axis y line*={left}, y axis line style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, line width={1}, solid}, colorbar style={title={}}, point meta max={nan}, point meta min={nan}] + \addplot[color={rgb,1:red,0.0;green,0.6056;blue,0.9787}, name path={07c9a36d-057e-4edb-9eab-7bc5bb7dde97}, axis line shift={10pt}, \node at (1,1) {Plot types};, draw opacity={1.0}, line width={1}, solid] + coordinates { + (1,1) + (2,2) + (3,3) + (4,4) + (5,5) + } + ; + \addlegendentry {y1} +\end{axis} +\begin{axis}[title={Scatter}, title style={at={{(0.5,1)}}, font={{\fontsize{14 pt}{18.2 pt}\selectfont}}, color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, rotate={0.0}}, legend style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, line width={1}, solid, fill={rgb,1:red,1.0;green,1.0;blue,1.0}, fill opacity={1.0}, text opacity={1.0}, font={{\fontsize{8 pt}{10.4 pt}\selectfont}}, at={(1.02, 1)}, anchor={north west}}, axis background/.style={fill={rgb,1:red,1.0;green,1.0;blue,1.0}, opacity={1.0}}, anchor={north west}, xshift={77.2mm}, yshift={-1.0mm}, width={69.2mm}, height={99.6mm}, scaled x ticks={false}, xlabel={}, x tick style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, opacity={1.0}}, x tick label style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, opacity={1.0}, rotate={0}}, xlabel style={, font={{\fontsize{11 pt}{14.3 pt}\selectfont}}, color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, rotate={0.0}}, xmajorgrids={true}, xmin={0.88}, xmax={5.12}, xtick={{1.0,2.0,3.0,4.0,5.0}}, xticklabels={{$1$,$2$,$3$,$4$,$5$}}, xtick align={inside}, xticklabel style={font={{\fontsize{8 pt}{10.4 pt}\selectfont}}, color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, rotate={0.0}}, x grid style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={0.1}, line width={0.5}, solid}, axis x line*={left}, x axis line style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, line width={1}, solid}, scaled y ticks={false}, ylabel={}, y tick style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, opacity={1.0}}, y tick label style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, opacity={1.0}, rotate={0}}, ylabel style={, font={{\fontsize{11 pt}{14.3 pt}\selectfont}}, color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, rotate={0.0}}, ymajorgrids={true}, ymin={0.88}, ymax={5.12}, ytick={{1.0,2.0,3.0,4.0,5.0}}, yticklabels={{$1$,$2$,$3$,$4$,$5$}}, ytick align={inside}, yticklabel style={font={{\fontsize{8 pt}{10.4 pt}\selectfont}}, color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, rotate={0.0}}, y grid style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={0.1}, line width={0.5}, solid}, axis y line*={left}, y axis line style={color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, line width={1}, solid}, colorbar style={title={}}, point meta max={nan}, point meta min={nan}] + \addplot[color={rgb,1:red,0.0;green,0.6056;blue,0.9787}, name path={30b69258-83e9-4e54-a4e5-5f0cb924a7f0}, axis line shift={10pt}, \node at (1,1) {Plot types};, draw opacity={1.0}, line width={0}, solid, mark={*}, mark size={3.0 pt}, mark options={color={rgb,1:red,0.0;green,0.0;blue,0.0}, draw opacity={1.0}, fill={rgb,1:red,0.0;green,0.6056;blue,0.9787}, fill opacity={1.0}, line width={0.75}, rotate={0}, solid}, only marks] + coordinates { + (1,1) + (2,2) + (3,3) + (4,4) + (5,5) + } + ; + \addlegendentry {y1} +\end{axis} +\end{tikzpicture} diff --git a/src/args.jl b/src/args.jl index 447de838..86abf9ab 100644 --- a/src/args.jl +++ b/src/args.jl @@ -281,7 +281,7 @@ const _series_defaults = KW( # one logical series to be broken up (path and markers, for example) :hover => nothing, # text to display when hovering over the data points :stride => (1,1), # array stride for wireframe/surface, the first element is the row stride and the second is the column stride. - :extra_kwargs => KW() + :extra_kwargs => Dict() ) @@ -293,7 +293,7 @@ const _plot_defaults = KW( :fontfamily => "sans-serif", :size => (600,400), :pos => (0,0), - :window_title => "Plots.jl", + :window_title => "Plots.jl", :show => false, :layout => 1, :link => :none, @@ -305,7 +305,7 @@ const _plot_defaults = KW( :dpi => DPI, # dots per inch for images, etc :thickness_scaling => 1, :display_type => :auto, - :extra_plot_kwargs => KW(), + :extra_plot_kwargs => Dict(), :extra_kwargs => :series # directs collection of extra_kwargs ) @@ -355,7 +355,7 @@ const _subplot_defaults = KW( :colorbar_title => "", :framestyle => :axes, :camera => (30,30), - :extra_kwargs => KW() + :extra_kwargs => Dict() ) const _axis_defaults = KW( diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index a752a4d5..658b1536 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -87,7 +87,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend}) if !pgfx_plot.is_created || pgfx_plot.was_shown pgfx_sanitize_plot!(plt) # extract extra kwargs - extra_plot_opt = PGFPlotsX.Options(plt[:extra_kwargs][:plot]...) + extra_plot_opt = PGFPlotsX.Options(plt[:extra_plot_kwargs]...) the_plot = PGFPlotsX.TikzPicture(extra_plot_opt) bgc = plt.attr[:background_color_outside] == :match ? plt.attr[:background_color] : plt.attr[:background_color_outside] @@ -128,7 +128,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend}) title_loc = sp[:titlelocation] bgc_inside = plot_color(sp[:background_color_inside]) bgc_inside_a = alpha(bgc_inside) - extra_sp_opt = PGFPlotsX.Options(plt[:extra_kwargs][:subplot]...) + extra_sp_opt = PGFPlotsX.Options(sp[:extra_kwargs]...) axis_opt = PGFPlotsX.Options( "title" => sp[:title], "title style" => PGFPlotsX.Options( @@ -246,7 +246,8 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend}) else PGFPlotsX.Axis end - axis = axisf(axis_opt) + @show extra_sp_opt + axis = axisf(merge(axis_opt, extra_sp_opt)) if sp[:legendtitle] !== nothing push!(axis, PGFPlotsX.Options("\\addlegendimage{empty legend}" => nothing)) push!( @@ -264,12 +265,12 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend}) opt = series.plotattributes st = series[:seriestype] sf = series[:fillrange] - extra_series_opt = PGFPlotsX.Options(plt[:extra_kwargs][:series]...) + extra_series_opt = PGFPlotsX.Options(series[:extra_kwargs]...) series_opt = PGFPlotsX.Options( "color" => single_color(opt[:linecolor]), "name path" => string(series_id), - extra_series_opt... ) + series_opt = merge(series_opt, extra_series_opt) if RecipesPipeline.is3d(series) || st == :heatmap series_func = PGFPlotsX.Plot3 else diff --git a/src/pipeline.jl b/src/pipeline.jl index 7f655674..ef94c8e1 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -344,15 +344,15 @@ function _add_the_series(plt, sp, plotattributes) extra_kwargs = warn_on_unsupported_args(plt.backend, plotattributes) @show plt[:extra_kwargs] if (kw = plt[:extra_kwargs]) isa AbstractDict - merge!(plt[:extra_plot_kwargs], get(kw,:plot,KW())) - merge!(sp[:extra_kwargs], get(kw,:subplot, KW())) - merge!(plotattributes[:extra_kwargs], get(kw,:series,KW())) + plt[:extra_plot_kwargs] = get(kw,:plot,KW()) + sp[:extra_kwargs] = get(kw,:subplot, KW()) + plotattributes[:extra_kwargs] = get(kw,:series,KW()) elseif plt[:extra_kwargs] == :plot - merge!(plt[:extra_plot_kwargs], extra_kwargs) + plt[:extra_plot_kwargs] = extra_kwargs elseif plt[:extra_kwargs] == :subplot - merge!(sp[:extra_kwargs], extra_kwargs) + sp[:extra_kwargs] = extra_kwargs elseif plt[:extra_kwargs] == :series - merge!(plotattributes[:extra_kwargs], extra_kwargs) + plotattributes[:extra_kwargs] = extra_kwargs else ArgumentError("Unsupported type for extra keyword arguments") end