-
-
Notifications
You must be signed in to change notification settings - Fork 372
Add hatched fill for GR and PyPlot #3107
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
Conversation
|
I love this! |
|
That's amazing! |
|
I tried with |
Seems to be a bug in GR. Will check ... |
|
The GR problems should be fixed in GR.jl v0.53.0 |
|
Thanks, @jheinen! I've been a little swamped lately, but will try to make more progress on this next week. |
|
@pearlzli, would you be able to find time to finish this ? (or is it maybe ready for review ?). That would allow me to add support to filled pattern for the |
|
Hi @t-bltg and everyone - sorry for totally dropping the ball on this! I'll try to take a crack at this again over the weekend. |
|
Sorry again for my delay on this! Using an updated version of GR.jl, changing the hatch color works perfectly: using Plots
gr()
y = rand(10)
hatchstyles = [:/ :\ :| :- :+ :x nothing]
hatchnames = [":/" ":\\" ":|" ":-" ":+" ":x" "nothing"]
plot(repeat(y .+ 1, outer = (1,7)), fillrange = repeat(y, outer = (1,7)),
fillstyle = hatchstyles, label = "fillstyle = " .* hatchnames,
layout = (4,2))I think I've also addressed the problem with setting the line color independently of the fill color in PyPlot that I mentioned in #3107 (comment): using Plots
pyplot()
y = rand(10)
verts = [(1,0), (0,1), (-1,0), (0,-1), (1,0)]
p1 = plot(repeat(y .+ 1, outer = (1,2)), fillrange = repeat(y, outer = (1,2)),
fillstyle = [:/ nothing], linecolor = 2, label = "fillrange", layout = (1,2))
p2 = plot([Shape(verts) Shape(verts)], fillstyle = [:/ nothing],
linecolor = 2, label = "shape", layout = (1,2))
plot(p1, p2, layout = (2,1)) |
Codecov Report
@@ Coverage Diff @@
## master #3107 +/- ##
==========================================
+ Coverage 62.97% 63.41% +0.44%
==========================================
Files 28 28
Lines 7070 7372 +302
==========================================
+ Hits 4452 4675 +223
- Misses 2618 2697 +79
Continue to review full report at Codecov.
|
t-bltg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for finalizing 👍
|
Hi, using Plots
gr()
y = rand(10)
hatchstyles = [:/ :\ :| :- :+ :x nothing]
hatchnames = [":/" ":\\" ":|" ":-" ":+" ":x" "nothing"]
plot(repeat(y .+ 1, outer = (1,7)), fillrange = repeat(y, outer = (1,7)),
fillstyle = hatchstyles, label = "fillstyle = " .* hatchnames,
layout = (4,2))The output looks fine on a Jupyter notebook. However when I save it as a PDF file, the hatch color is back to black. To save it, I do: Plots.savefig("test.pdf")Using GRUtils.savefig instead produced a corrupted pdf file. Thanks for your help |










I took a crack at adding a
fillstyleargument which allows a few different hatching patterns, as suggested on Discourse and Gitter. I (kind of arbitrarily) followed the PyPlot convention in letting the possible values offillstylebe:/,:\,:|,:-,:+,:x, andnothing(the default, which keeps the solid fill).In PyPlot:
In GR, I unfortunately can't figure out how to change the color of the hatching from black:
Would love to get your feedback and suggestions!
Fix #1337.