PLGRADIENT(3plplot)

πŸ’… PLGRADIENT (3plplot) β€” the PLplot API, bestie edition πŸŽ€

okay so. plplot, right? iconic. and this little function? plgradient is its own kind of slay. this is a page from the PLplot API and we're gonna get you fluent, fr fr. πŸ¦‹


✨ NAME ✨

plgradient β€” draws a linear gradient inside a polygon πŸ’–


🫢 SYNOPSIS 🫢

plgradient(n, x, y, angle)

🌈 DESCRIPTION 🌈

okay so picture this: you're drawing a linear gradient using cmap1, and it lives inside the polygon defined by the n points (x[i], y[i]). that's the whole vibe. ✨

the way the polygon gets interpreted? literally the exact same as plfill(3plplot). same energy, no notes. πŸ’…

so both the polygon coordinates and the gradient angle are expressed in world coordinates β€” remember that, it matters.

the angle from the x axis β€” for both the rotated coordinate system and the gradient vector β€” is specified by angle. lowkey the main character of this function tbh. πŸ‘‘

now the magnitude of the gradient vector: it's the difference between the maximum and minimum values of x for the vertices in the rotated coordinate system. and the origin of that gradient vector? you can interpret it as being anywhere on the line corresponding to the minimum x value for the vertices in the rotated coordinate system. so like, pick a spot on that line, it's all valid. πŸ™ˆ

the distance along the gradient vector gets linearly transformed to the independent variable of color map 1, which ranges from 0. at the tail of the gradient vector to 1. at the head. so tail = zero, head = one, got it? periodt. πŸ’€

and what actually gets drawn? the RGBA color corresponding to the independent variable of cmap1. that's the whole reveal. 🧚

for more info about cmap1, go check the PLplot documentation β€” that's where the lore lives. πŸ“š

Redacted form: plgradient(x,y,angle)

this function is used in examples 25 and 30. go look at them if you want to see it in action, ngl they're kind of a moment. πŸ”₯


⭐ ARGUMENTS ⭐

  • n (PLINT(3plplot), input) β€” number of vertices in the polygon. yes bestie, count them. πŸ“
  • x (PLFLT_VECTOR(3plplot), input) β€” a vector holding the x coordinates of the vertices. πŸ’œ
  • y (PLFLT_VECTOR(3plplot), input) β€” a vector holding the y coordinates of the vertices. πŸ’œ
  • angle (PLFLT(3plplot), input) β€” angle (degrees) of the gradient vector from the x axis. degrees bestie, not radians, don't do that to yourself 😭

πŸ‘‘ AUTHORS πŸ‘‘

many developers have contributed to PLplot over its long history β€” and they're credited at http://plplot.sourceforge.net/credits.php. absolute legends, all of them. 🫢🌸


πŸ” SEE ALSO πŸ”

PLplot documentation at http://plplot.sourceforge.net/documentation.php. it's giving required reading, but like, in a fun way. πŸ“–βœ¨


<div align="center">β€” πŸŽ€ β€”</div>

that's the whole page, bestie! this one's from the PLplot source, dated August, 2026, and you found it under PLGRADIENT(3plplot). now go make something gorgeous with a gradient in it. slay. πŸ’…πŸŒˆπŸ’–

πŸ“¦ where this page comes from