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

[FR] Series type pixel #2859

Open
isentropic opened this issue Jul 13, 2020 · 9 comments
Open

[FR] Series type pixel #2859

isentropic opened this issue Jul 13, 2020 · 9 comments

Comments

@isentropic
Copy link
Member

Create a new series type that draws pixels. It is similar to st=:scatter with smallest size and no border if backend cannot draw pixels natively. PyPlot and GR are capable of this where the benefit is vastly faster plotting for huge data where line plots take too long

@isentropic
Copy link
Member Author

isentropic commented Jul 13, 2020

A way to start is to see https://github.com/JuliaPlots/Plots.jl/blob/master/src/recipes.jl and understand how some of the recipes work, update natively supported series and implement that series in backends that would support it natively. Else, the series should just become (fallback) a scatter plot with tiny markersize and no borders. Perhaps @LakshyaKhatri or @Diaga would be interested in this issue

@LakshyaKhatri
Copy link
Contributor

LakshyaKhatri commented Jul 27, 2020

Hello @isentropic, Sorry for the late response. I was focusing on CDSAPI.jl for past few days. I am starting to look at the resources provided and open a PR asap. @Diaga, I think we can work on this together.

@LakshyaKhatri
Copy link
Contributor

Hello @isentropic, could you provide any link to the API documentation for pixel plots in pyplot? I tried searching for it and pyplot.imshow() is the only thing that is coming up. The other method like you stated earlier is a scatter plot with no borders and small size.

@isentropic
Copy link
Member Author

Yeah with native pyplot, you could

plt.plot(rand(10), ",")

This has nothing to do with images

@isentropic
Copy link
Member Author

Yes, this should be put in of the conditions, as well as supported series types in the backends.jl file. Perhaps it should only be 2d

@LakshyaKhatri
Copy link
Contributor

I have implemented the recipe, but while calling the plot with st=:pixel it is falling back to the default scatter plot. I will debug it and open a PR then :)

@LakshyaKhatri
Copy link
Contributor

Perhaps updating supported series will do the job 😸 . Thanks @isentropic 🙌

@LakshyaKhatri
Copy link
Contributor

LakshyaKhatri commented Jul 29, 2020

Hello @isentropic, can I ask what @deps does (it is there below all the recipes)? I found no resources on it under RecipeBase.jl:

Plots.jl/src/recipes.jl

Lines 124 to 146 in 5673ced

@recipe function f(::Type{Val{:vline}}, x, y, z)
n = length(y)
newx = vec(Float64[yi for i = 1:3, yi in y])
newy = repeat(Float64[1, 2, NaN], n)
x := newx
y := newy
seriestype := :straightline
()
end
@deps vline straightline
@recipe function f(::Type{Val{:hspan}}, x, y, z)
n = div(length(y), 2)
newx = repeat([-Inf, Inf, Inf, -Inf, NaN], outer = n)
newy = vcat([[y[2i - 1], y[2i - 1], y[2i], y[2i], NaN] for i = 1:n]...)
linewidth --> 0
x := newx
y := newy
seriestype := :shape
()
end
@deps hspan shape

is it denoting the fallback series type? or something like "on which series type this recipe depends"?

If it is the prior case then in pixel recipe, it will look something like this?:

@recipe function f(::Type{Val{:pixel}}, x, y, z)
    x := x
    y := y
    seriestype := :pixel
    markersize := 1
    markerstrokewidth --> 0
    ()
end
@deps pixel scatter

@isentropic
Copy link
Member Author

You need to add an entry in recipes.jl I believe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants