Gadfly.jl icon indicating copy to clipboard operation
Gadfly.jl copied to clipboard

Added ability for intercept in geom.hair to take vector to function as lolipop

Open hewsond opened this issue 4 years ago • 4 comments

Chainged Geom.hair Documented hair as lolipop in geometries documentation Added Geom.hair update as lolipop to news Added tests for Geom.hair lolipop

Fixes #XXX

Contributor checklist:

  • [x] I've updated the documentation to reflect these changes
  • [x] I've added an entry to NEWS.md
  • [x] I've added and/or updated the unit tests
  • [x] I've run the regression tests
  • [x] I've squash'ed or fixup'ed junk commits with git-rebase
  • [ ] I've built the docs and confirmed these changes don't cause new errors

Proposed changes

Use length check on intercept in Geom.hair to determine if it is same length as number of points want to draw hairs for.

If it is same length, don't fill end point vector, just use the supplied vector.

hair

Doc building issues

I've added it to the test files and above you can see the output, however when i try to build the documentation I get an error: MethodError: no method matching isless(::Array{Float64,1}, ::Int64)

Though it isn't the only @example block that gives some errors.

hewsond avatar Feb 18 '21 23:02 hewsond

Another possibility here is changing the syntax to plot(x=x, y=x.^2, intercept=(x.^2)./2, Geom.hair, Geom.point), and allow intercept to take vectors of length one (or more). I've got a PR coming soon which refactors some internal code and is relevant to making that switch.

Mattriks avatar Feb 18 '21 23:02 Mattriks

I'm not an expert on the whole grammar of graphics thing but IMO the intercept argument as you suggest does sound much nicer and cleaner.

I'm happy to have at re-basing to work in that way once you've done the refactor if required.

hewsond avatar Feb 19 '21 04:02 hewsond

@Mattriks did you finished the aforementioned PR?

bjarthur avatar Sep 25 '21 11:09 bjarthur

No unfortunately. I think I was referring to #1520 (which I opened on the same day as the posts above), or a subsequent PR. I do hope to return to #1520 sometime!

Mattriks avatar Sep 26 '21 12:09 Mattriks