Giter Site home page Giter Site logo

Comments (3)

SimonDanisch avatar SimonDanisch commented on May 22, 2024

I plan to have themes for recipes, so e.g. density would have it's own theme node, which can be used to store information like label names. Would that solve one part of this?

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 Scene, but they will still be overwriteable by the user (as pointed out in #10)!

Is this solving the issue completely, or would you argue that having _default_names still needs to exist?

from makie.jl.

piever avatar piever commented on May 22, 2024

I think the Scene idea solves the "overridable default" part, but there are two issues to keep in mind:

  1. Figuring out which arguments are x or y (the main issue being that in plot plot(x) is the same as plot(1:length(x), x) so the x ends up on the y axis). If that method is not allowed in Makie, this should be solved

  2. In this example case, I would actually want:

@macroexpand @label plot(X, [Z, logistic.(Z)]); kw_args...) 
plot(X, [Z, logistic.(Z)], xlabel = "Z", label = ["Z" "logistic.(Z)"]; kw_args...)

because the ylabel is a vector and is better expressed as a legend:

@plot (X, [Z, logistic.(Z)])

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 create_label_scene(labels) that creates the Scene with the defaults, checking out whether the labels are symbols or vectors and deciding how to use them accordingly.

Anyway, I'll try to start porting the @df macro as soon as I have a bit more time and I'll see where/how I get stuck. Is the recipe system still in flux or it is already safe to port things?

from makie.jl.

SimonDanisch avatar SimonDanisch commented on May 22, 2024

It's not really there yet! Still fighting with my refactor of scene creation, layouting and units...
I'll make a release with some demos once it's out!

Anyways, I think I first didn't understand your problem & solution correctly ;) I will think about this - if _default_names is the best solution, I don't see why we shouldn't add it!

It could be a bit painful to add this _default_names keyword a posteriori so I thought I should mention it already.

This should be no problem. There is a single location in Makie, were one can add kw_args to every plotting function.

from makie.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.