-
Notifications
You must be signed in to change notification settings - Fork 251
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
Theme_colormaps #1118
base: master
Are you sure you want to change the base?
Theme_colormaps #1118
Conversation
I know what the error in the test p1 = Gadfly.with_theme(:dark) do
plot(dataset("ggplot2", "diamonds"), x=:Price, color=:Cut, Geom.density)
end
draw(PNG(4inch,3inch), p1) Gadfly.with_theme(:dark) do
p2 = plot(dataset("ggplot2", "diamonds"), x=:Price, color=:Cut, Geom.density)
draw(PNG(4inch,3inch), p2)
end Note the difference in the color scale, the first plot has reverted to the |
Codecov Report
@@ Coverage Diff @@
## master #1118 +/- ##
==========================================
+ Coverage 86.12% 86.21% +0.08%
==========================================
Files 32 32
Lines 3986 3983 -3
==========================================
+ Hits 3433 3434 +1
+ Misses 553 549 -4
Continue to review full report at Codecov.
|
Nice! Could you add an entry to NEWS.md for this? (under v0.6.6) |
I updated NEWS.md with changes for |
great about NEWS.md! how about your other contributions: rect, vectorfield, smooth, etc. |
Done - added those (ignoring minor fixes). |
when running the regression tests (using |
There was no A general issue with testing named themes is that runtests.jl is calling |
two things: does this PR introduce any breaking changes? if so, we'll have to wait to merge until we plan to tag a minor release. also, a small point, but it'd be nice to use capitalization consistently in the test filenames. |
Yes, this PR discontinues the use of Maybe |
would be best to deprecate the old functionality so that users are given a warning message which explains how to refactor their code. might have to keep around a method definition for Theme with the old signature and stick a call to |
The |
all that's really needed is a constructor function which mimics the old behavior, and converts to the new with a depwarn. don't need to redefine the old type. easiest probably just to do it by hand instead using the macro. |
Currently module test
# this all mock code
struct ColorScale
f::Function
end
ColorScale(;f::Function=(x,y)->x*y) = ColorScale(f)
struct Them
a::Float64
b::Float64
# deprecate c::ColorScale
d::Function
end
# Outer constructor:
function Them(;a::Float64=0.5, b::Float64=1.5, c::T=nothing, d=(x,y)->x*y) where T<:Union{ColorScale,Void}
if c!=nothing
d = c.f
Base.depwarn("The keyword argument `c` will be deprecated, use `d` instead", :Them)
end
return Them(a,b,d)
end
end
them1 = test.Them(c=test.ColorScale((x,y)->x+y)) # prints depwarn
them1.d(1,2) # returns 3 as expected |
vim macros to the rescue! people will and have complained about Gadfly breaking changes, so this is reasonably important.
|
the merge conflicts here are going to get worse once we support 0.7. best to get this merged sooner rather than later. |
This branch is a bit stale, and I think I'd prefer to close it, and I'll start a new branch sometime... |
@Mattriks do you want to rebase on master and update this PR? |
This would be an awesome feature to have. |
I'll take another look at this after Guide-ageddon (#1156), so sometime off yet. |
The issues behind this PR are explained here. The current implementation in
Gadfly
wherebyTheme()
replaces the whole color scale has some flaws. This PR givesTheme
control of just the color map functions, so the color scales (Scale.color_discrete
andScale.color_continuous
) can be used as normal. This is easier for both users and developers. E.g. theorder
of key colors, and transformed color scales (e.g.Scale.color_log10
) now behave as expected:Also I've updated the
:dark
theme, added a:ggplot
theme, and updated the docs.