Skip to content
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

Recipe usage #833

Closed
henry2004y opened this issue Feb 1, 2021 · 7 comments
Closed

Recipe usage #833

henry2004y opened this issue Feb 1, 2021 · 7 comments

Comments

@henry2004y
Copy link
Contributor

Hello,

Originally I posted a question on Discourse, but no one responded. I explained my confusion when using the recipes in Makie. Can you offer me some help in getting this through?

Basically I am asking about two things:

  1. How to correctly use recipe for Makie, with a minimal working example? The complete example shown in the Full Recipes section is a little bit hard to follow for me, even though it actually works.
  2. What is the difference between MakieRecipes.jl and the convert_arguments() or @recipe stuff?

The details are explained in the linked post. Thanks for your response ahead!

@henry2004y
Copy link
Contributor Author

I have seen something in the Makie milestone related to this. Hopefully it can be made easier to use and with better tutorial!

@jkrumbiegel
Copy link
Member

Hi, I've updated the recipe example a couple days ago, could you have a look and comment here if you still don't understand? Then I could try to address those problems

@henry2004y
Copy link
Contributor Author

Oh I haven't notice that! Yes I will check it soon. Thanks for letting me know! I'll provide some feedback later.

@henry2004y
Copy link
Contributor Author

henry2004y commented Feb 8, 2021

The full recipe documentation is good. The part I don't quite understand is the type recipes. Similar to the issue described in the discourse thread, I haven't managed to make it work for my type.

using Makie

struct MyType
   data::Vector
end

convert_arguments(P::Type{<:AbstractPlot}, x::MyType) = (P,rand(10))

fig = Figure(resolution = (800, 500), backgroundcolor = RGBf0(0.98, 0.98, 0.98))
ax1 = fig[1, 1] = Axis(fig, title = "test")

mydata = MyType(ones(10))
plot!(mydata, color=:red)
fig

it returned

ERROR: LoadError: Plotting for the arguments (::MyType) not defined. If you want to support those arguments, overload plot!(plot::Plot(MyType,))

How to make this work? Can you help me?

@goretkin
Copy link
Contributor

goretkin commented Apr 15, 2021

What is the difference between MakieRecipes.jl and the convert_arguments() or @recipe stuff?

It appears that MakieRecipes.jl is intended (i.e. it isn't finished) to allow recipes defined with https://github.com/JuliaPlots/RecipesBase.jl for the Plots.jlworld to be re-purposed for use with the AbstractPlotting.jl world.

I think someone might be reasonable confused about the two kinds of recipes within the JuliaPlots org, and it might be worth mentioning in the documentation that they (unless I am mistaken) are not immediately interchangeable.

Am I right in understanding that if package Foo.jl wants to implement a Plots.jl-recipe, Foo.jl must depend on RecipesBase.jl, whereas to implement a Makie.jl-recipe, Foo.jl must depend on AbstractPlotting.jl?

@henry2004y
Copy link
Contributor Author

It appears that MakieRecipes.jl is intended (i.e. it isn't finished) to allow recipes defined with https://github.com/JuliaPlots/RecipesBase.jl for the Plots.jlworld to be re-purposed for use with the AbstractPlotting.jl world.

This is my impression too. However as a user I tend to be lost in the progress of development. Another issue #893 also mentioned the current failure of the recipe system and I am looking forward to the fixes.

@ffreyer
Copy link
Collaborator

ffreyer commented Aug 22, 2024

I'm closing this as outdated/fixed by docs updates

@ffreyer ffreyer closed this as completed Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants