Plots.jl: Way to pass keywords to the backend

Created on 19 Sep 2019  路  11Comments  路  Source: JuliaPlots/Plots.jl

It would be nice to have a way to pass backend-specific keywords.
One idea is, to have a backend_options keyword that takes a Dict or NamedTuple that gets passed as keywords to the backend.

Most helpful comment

A bit of a memo to myself :

  • extra_kwargs needs to be actually be populated
  • this requires different handling of unsupported kwargs, like only checking the Plots specific kwargs and put the rest in extra_kwargs

All 11 comments

Do you feel like experimenting with a PR for one of the backends? It's been suggested several times.

I did take a quick look on it, but the backend <-> frontend interface is not as clear-cut, as i had imagined and I get lost in the Plots pipeline quite quickly. So at least till the beginning of next year I won't have time.

Have a look how this keyword arg was added and passed through to PyPlot https://github.com/JuliaPlots/Plots.jl/pull/1009/files

Actually I see, that extra_kwargs does already exist, it is "just" not passed at the moment.
Edit: I mean it is passed as it should be available to the backend code, but i thought there would be some way to pass that directly to a backend plot interface function which handles it.

Maybe it is at the wrong spot though, since it belongs to the Plot object, but as far as I can see, the backends operate on the Subplot level?

I'm not sure what you mean by that?

Let me put it as a question: How would a backend query the plotattributes?

The backend processes the Plot object and builds up a series_list containing the keywords passed to the backend. So I guess the extra_kw args should just be appended to the series_list without any transformations.

A bit of a memo to myself :

  • extra_kwargs needs to be actually be populated
  • this requires different handling of unsupported kwargs, like only checking the Plots specific kwargs and put the rest in extra_kwargs

perhaps:
plot(x1, x2, backendkeyword="parameter=value")
aliases:
plot(x1, x2, bk="parameter=value")
plot(x1, x2, backend_keywords="parameter=value, parameter2=value2")

There would be some effort parsing "parameter=value, parameter2=value2", but should be fine I think, I can try implementing this with pyplot

I think it would make most sense if you were checkout #2200 and see, if you can make it work for pyplot too.
I don't think we need special parsing here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

apalugniok picture apalugniok  路  3Comments

SebastianM-C picture SebastianM-C  路  4Comments

crstnbr picture crstnbr  路  3Comments

kersulis picture kersulis  路  5Comments

ereday picture ereday  路  3Comments