-
-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: default names to axis #41
Comments
I plan to have themes for recipes, so e.g. For the macro, I would implement it as: >macroexpand(@label plot(X, [Z, logistic.(Z)]); kw_args...) # with kw_args e.g. ylabel = "Owerwrite Z"
plot(X, [Z, logistic.(Z)], Scene(xlabel = "Z", ylabel = "logistic.(Z)"); kw_args...) The plot will inherit attributes from Is this solving the issue completely, or would you argue that having |
I think the
because the If issue one is not a problem (that is to say, you don't need to know the plot type to know what goes on what axis), then it'd be sufficient to have a function Anyway, I'll try to start porting the |
It's not really there yet! Still fighting with my refactor of scene creation, layouting and units... Anyways, I think I first didn't understand your problem & solution correctly ;) I will think about this - if
This should be no problem. There is a single location in Makie, were one can add kw_args to every plotting function. |
There are case where, from the function call, the plotting package can determine how to label the axis and the legend:
when using the
@df
macro in StatPlots to plot columns a data table: the axis should be labelled with the appropriate column labelwhen using some macro mechanism, for example
@label plot(X, [Z, logistic.(Z)])
(see #1072 ) could create a legend with entriesZ
andlogistic.(Z)
The difficulty with implementing this is that the translation from the argument names (as visible at "macroexpand" time) to the axis of the plot is not straightforward (for example
plot(y)
should have ay
axis label anddensity(y)
should have ax
axis label) which makes these macros tricky to write.The best solution we could find was to add a
_default_names
keyword argument to all plot calls, which would take all the extra label info from the macro (basically all the names of the main arguments, which could correspond tox
,y
,z
or to the legend if the user is passing a vector of vectors such as[Z, logistic.(Z)]
), combine it with the label explicitly provided by the user (which should have priority) and label the plot appropriately. Then writing these macros becomes very simple.It could be a bit painful to add this
_default_names
keyword a posteriori so I thought I should mention it already.See here for previous discussion.
The text was updated successfully, but these errors were encountered: