-
Notifications
You must be signed in to change notification settings - Fork 250
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
refactor docs to use docstrings and have a gallery #1116
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1116 +/- ##
==========================================
- Coverage 87.28% 87.07% -0.22%
==========================================
Files 33 33
Lines 3973 3984 +11
==========================================
+ Hits 3468 3469 +1
- Misses 505 515 +10
Continue to review full report at Codecov.
|
Doesn't build for me? $ julia docs/make.jl
Documenter: setting up build directory.
Documenter: expanding markdown templates.
ERROR: LoadError: MethodError: no method matching discretize_make_pda(::CategoricalArrays.CategoricalArray{String,1,UInt8,String,CategoricalArrays.CategoricalString{UInt8},Union{}}, ::Array{CategoricalArrays.CategoricalString{UInt8},1})
Closest candidates are:
discretize_make_pda(!Matched::Array{T,1} where T, ::Any) at /Users/tamasnagy/.julia/v0.6/Gadfly/src/scale.jl:263
discretize_make_pda(!Matched::DataArrays.DataArray, ::Any) at /Users/tamasnagy/.julia/v0.6/Gadfly/src/scale.jl:271
discretize_make_pda(!Matched::Range, ::Any) at /Users/tamasnagy/.julia/v0.6/Gadfly/src/scale.jl:279
...
Stacktrace:
[1] discretize(::CategoricalArrays.CategoricalArray{String,1,UInt8,String,CategoricalArrays.CategoricalString{UInt8},Union{}}, ::Void, ::Void, ::Bool) at /Users/tamasnagy/.julia/v0.6/Gadfly/src/scale.jl:301
[2] discretize(::CategoricalArrays.CategoricalArray{String,1,UInt8,String,CategoricalArrays.CategoricalString{UInt8},Union{}}, ::Void, ::Void) at /Users/tamasnagy/.julia/v0.6/Gadfly/src/scale.jl:295
[3] apply_scale(::Gadfly.Scale.DiscreteScale, ::Array{Gadfly.Aesthetics,1}, ::Gadfly.Data, ::Vararg{Gadfly.Data,N} where N) at /Users/tamasnagy/.julia/v0.6/Gadfly/src/scale.jl:366
[4] apply_scales(::IterTools.Distinct{Base.ValueIterator{Dict{Symbol,Gadfly.ScaleElement}},Gadfly.ScaleElement}, ::Array{Gadfly.Aesthetics,1}, ::Gadfly.Data, ::Vararg{Gadfly.Data,N} where N) at /Users/tamasnagy/.julia/v0.6/Gadfly/src/scale.jl:33
[5] apply_scales(::IterTools.Distinct{Base.ValueIterator{Dict{Symbol,Gadfly.ScaleElement}},Gadfly.ScaleElement}, ::Gadfly.Data) at /Users/tamasnagy/.julia/v0.6/Gadfly/src/scale.jl:52
[6] render_prepare(::Gadfly.Plot) at /Users/tamasnagy/.julia/v0.6/Gadfly/src/Gadfly.jl:674
[7] render(::Gadfly.Plot) at /Users/tamasnagy/.julia/v0.6/Gadfly/src/Gadfly.jl:752
[8] show at /Users/tamasnagy/.julia/v0.6/Gadfly/src/Gadfly.jl:956 [inlined]
[9] verbose_show(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("image/svg+xml")}, ::Gadfly.Plot) at ./multimedia.jl:42
[10] #sprint#228(::Void, ::Function, ::Int64, ::Function, ::MIME{Symbol("image/svg+xml")}, ::Vararg{Any,N} where N) at ./strings/io.jl:66
[11] stringmime(::MIME{Symbol("image/svg+xml")}, ::Gadfly.Plot) at ./multimedia.jl:83
[12] runner(::Type{Documenter.Expanders.ExampleBlocks}, ::Base.Markdown.Code, ::Documenter.Documents.Page, ::Documenter.Documents.Document) at /Users/tamasnagy/.julia/v0.6/Documenter/src/Expanders.jl:477
[13] dispatch(::Type{Documenter.Expanders.ExpanderPipeline}, ::Base.Markdown.Code, ::Vararg{Any,N} where N) at /Users/tamasnagy/.julia/v0.6/Documenter/src/Selectors.jl:168
[14] expand(::Documenter.Documents.Document) at /Users/tamasnagy/.julia/v0.6/Documenter/src/Expanders.jl:30
[15] runner(::Type{Documenter.Builder.ExpandTemplates}, ::Documenter.Documents.Document) at /Users/tamasnagy/.julia/v0.6/Documenter/src/Builder.jl:178
[16] dispatch(::Type{Documenter.Builder.DocumentPipeline}, ::Documenter.Documents.Document, ::Vararg{Documenter.Documents.Document,N} where N) at /Users/tamasnagy/.julia/v0.6/Documenter/src/Selectors.jl:168
[17] cd(::Documenter.##2#3{Documenter.Documents.Document}, ::String) at ./file.jl:70
[18] #makedocs#1(::Bool, ::Array{Any,1}, ::Function) at /Users/tamasnagy/.julia/v0.6/Documenter/src/Documenter.jl:203
[19] (::Documenter.#kw##makedocs)(::Array{Any,1}, ::Documenter.#makedocs) at ./<missing>:0
[20] include_from_node1(::String) at ./loading.jl:576
[21] include(::String) at ./sysimg.jl:14
[22] process_options(::Base.JLOptions) at ./client.jl:305
[23] _start() at ./client.jl:371
while loading /Users/tamasnagy/.julia/v0.6/Gadfly/docs/make.jl, in expression starting on line 5 |
not sure. maybe try again now that we've merged a bunch of PRs? thanks. |
7d4a1dc
to
123c1bf
Compare
@tlnagy did this error cause the entire build to fail, or just one example? if the latter, just let it finish and then take a look at the as-built docs. i'd like to proceed with finishing this PR if you like the direction it's headed. |
I looked at this (it built for me). In the gallery, I would like each code block do more than one plot (with |
great idea about combing plots into subplots. i've made the changed and pushed. i'm not keen though on separating out the common code elements and putting them at the top. i really want users to be able to make a single cut & paste to reproduce. |
docs/src/gallery/geometries.md
Outdated
Guide.ylabel("Freq")); | ||
|
||
rename!(D, :x1 => :Frequency) | ||
palette = ["blue","brown","green","tan"] # Is there a hazel color? |
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.
Leftover comment? This is unnecessary
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.
Not leftover, it's a humorous comment! Hazel is a color (think eyes/hazelnut), and the plot is about eye color, so one should be able to use "hazel"!
I'm attempting to encourage the use of humorous code comments in the docs 😃
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.
Ah. I get it.
The whole build, but I pulled the latest changes and now I can't reproduce and everything is building 👍
I agree with @bjarthur here.
Overall, I really like this! I think one thing that's missing is code examples in the docstrings for the Geoms/Guides/etc (e.g. https://juliadocs.github.io/Documenter.jl/latest/lib/public/#Documenter.generate) so a user can see a concrete example of how a function can be used after running |
Great! I particularly like the 3 plots for I would also like smaller font size for the code blocks, and/or where possible one-line plot statements e.g. for Also about the common code elements, if you were a user doing copy and paste, would you copy and paste the |
d24a88d
to
442135b
Compare
f352135
to
a1db3e0
Compare
da38bd8
to
5d69220
Compare
c8ff368
to
feee5a6
Compare
still working on this, and have come across a few things for which i'll submit issues for later. just as a reminder for myself:
|
i'm confused... the number of examples should be the same. all i did was take the english text in |
My bad, Github was autocollapsing the geometries gallery so my searching for examples wasn't coming up. In general, I'm a big fan of moving all the text to the docstrings and I think we should go ahead and merge this PR. I do however have some hesitation with how everything is laid out in the big monolithic files (e.g. |
Here are some suggestions. In the Gallery:
so the grid fills the whole plot.
|
And in the Library:
|
In Development:
|
@Mattriks have changed all your suggestions. thanks for the thorough review! the problem with the plot with the missing points is that the id number for elements is randomly generated. when including multiple SVGs in the same HTML document they can conflict (ie be the same). the hack was to change the seed. long term we should look into longer random numbers, or creating a name space if possible. i've started on a new "Thumbnail" section in the gallery, modeled after seaborn, but will put that in a separate PR as i don't want to hold this up anymore. will merge this PR once CI passes. |
so two things that'd be nice to have are:
a matplotlib style gallery, where example plots are all collected in one place along with the exact code to reproduce them.
julia style docstrings so that documentation can be accessed on the REPL. docs embedded in the code are also less likely to get out of date.
towards these ends, i've started down the path of refactoring the documentation. it's a big change though, so this PR currently only contains 10% or so of the changes needed, as i want to get feedback before proceeding.
would be great if folks could checkout this PR, do a
julia docs/make.jl
, then opendocs/build/index.html
and have a look around. also do a?Geom
,?Geom.bar
, etc. on the REPL. i've only made galleries for, and altered the libraries of, two Geoms and one Guide. the rest will follow suit if you guys like this new format. let me know! thanks.