Plots.jl recipes #4175
Replies: 21 comments
-
Implementation for sticks (needs to be turned into a recipe but you get the picture): function sticks!(scene, x, y)
for (i, j) in zip(x, y)
linesegments!(scene, (Point2f0(i, min(j, 0)), Point2f0(i, max(j, 0)))
end
end This could use a LinesegmentBuffer to be more performant as well. |
Beta Was this translation helpful? Give feedback.
-
Here's GR.jl's (polar) axis drawing code, for reference. https://github.com/jheinen/GR.jl/blob/9edecc09594ac855bae70113a6fd452db12c5ea0/src/jlgr.jl#L414-L526 function draw_polar_axes()
viewport = plt.kvs[:viewport]
diag = sqrt((viewport[2] - viewport[1])^2 + (viewport[4] - viewport[3])^2)
charheight = max(0.018 * diag, 0.012)
window = plt.kvs[:window]
rmin, rmax = window[3], window[4]
GR.savestate()
GR.setcharheight(charheight)
GR.setlinetype(GR.LINETYPE_SOLID)
tick = 0.5 * GR.tick(rmin, rmax)
n = round(Int, (rmax - rmin) / tick + 0.5)
for i in 0:n
r = float(i) / n
if i % 2 == 0
GR.setlinecolorind(88)
if i > 0
GR.drawarc(-r, r, -r, r, 0, 359)
end
GR.settextalign(GR.TEXT_HALIGN_LEFT, GR.TEXT_VALIGN_HALF)
x, y = GR.wctondc(0.05, r)
GR.text(x, y, string(signif(rmin + i * tick, 12)))
else
GR.setlinecolorind(90)
GR.drawarc(-r, r, -r, r, 0, 359)
end
end
for alpha in 0:45:315
a = alpha + 90
sinf = sin(a * π / 180)
cosf = cos(a * π / 180)
GR.polyline([sinf, 0], [cosf, 0])
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_HALF)
x, y = GR.wctondc(1.1 * sinf, 1.1 * cosf)
GR.textext(x, y, string(alpha, "^o"))
end
GR.restorestate()
end Seems that the logic would be easy enough to port to AbstractPlotting. |
Beta Was this translation helpful? Give feedback.
-
Plots.jl bezier curves: |
Beta Was this translation helpful? Give feedback.
-
For |
Beta Was this translation helpful? Give feedback.
-
@jheinen, this doesn't seem to be in the GR documentation - what does |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Thanks! Will look into the polar axis adaptation further. |
Beta Was this translation helpful? Give feedback.
-
Hi, could I ask what the progress on this has been like / what the status of this is? I would be interested in helping out if you need help --- I'm guessing that it won't be very hard or require metaprogramming skills (though please correct me if I'm wrong)! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
That looks great :)
Make an animation with an observable? Or what do you mean? |
Beta Was this translation helpful? Give feedback.
-
Yes, exactly. I tried it, but maybe I mixed something up with the observables because I get an error |
Beta Was this translation helpful? Give feedback.
-
Nevermind, managed it, should work now :) |
Beta Was this translation helpful? Give feedback.
-
Very cool, is this going to be a PR? |
Beta Was this translation helpful? Give feedback.
-
Hi there! I wonder if there is any progress regarding I can try to help if someone gives me a process on how to start (should I try to port things from plots.jl?) |
Beta Was this translation helpful? Give feedback.
-
I guess one can do that with: |
Beta Was this translation helpful? Give feedback.
-
Yeah pretty much, since one can get the transformed plot limits from the model matrix theoretically it could be done in a recipe. However, for the best implementation this should probably wait until we have a better interface for using Axis-level attributes in recipes, so that the palette can be shared. |
Beta Was this translation helpful? Give feedback.
-
I see. I will try to use a workaround with Thanks EDIT: |
Beta Was this translation helpful? Give feedback.
-
Just for the follow-up, the second I assume you don't need a MWE, but I can write one to illustrate the areaplot recipe for Makie. simu.mp4 |
Beta Was this translation helpful? Give feedback.
-
A PR with the recipe would be even greater ;) |
Beta Was this translation helpful? Give feedback.
-
hexbin has been added? |
Beta Was this translation helpful? Give feedback.
-
This was part of https://github.com/MakieOrg/Makie.jl/projects/2 |
Beta Was this translation helpful? Give feedback.
-
Plots.jl has a lot of small, easy-to-implement convenience functions and recipes that would be nice to have in AbstractPlotting, or StatsMakie.
stephist
:scatterhist
:sticks
:hexbin
: Note that Plots doesn't seem to have support for this.hline
:vline
:ohlc
:curves
:pie
: Plot a pie diagramareaplot
:Beta Was this translation helpful? Give feedback.
All reactions