Skip to content
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

Autogen unicodeplots and inspectdr #246

Merged
merged 3 commits into from
Jul 12, 2021

Conversation

t-bltg
Copy link
Member

@t-bltg t-bltg commented Jul 9, 2021

Should replace inspectdr.md and unicodeplots.md.

Unicodeplots

unicode-sample

InspectDR

inspectdr-sample

@t-bltg
Copy link
Member Author

t-bltg commented Jul 9, 2021

I've added 2 screenshots from my local build producing the html files.

I think that UnicodePlots really looks good, but we have to wait for a new release of Documenter.jl since I used JuliaDocs/Documenter.jl#1441.

However, I have a font issues with InspectDR, @BeastyBlacksmith or @daschw do you have any clue of what might cause this ?

@BeastyBlacksmith
Copy link
Member

@ma-laforge might know

@ma-laforge
Copy link
Contributor

Hi. I think I'm not running with the right configuration: Can't reproduce your results. In the results below, I used the following config:

OS: Ubuntu 18.04
Julia: v1.6.1
Cairo: v1.0.5
Gtk: v1.1.8
Pango_jll = "1.42.4+10" (Font engine, I believe)
Plots: v1.18.2

My results

Plot: Plots._examples[4]

image

Comments

  • I don't get the strange tick labels you show in your screenshot.
  • My legend does not try to display "ys" at all. It displays "line" - which is the same labels I see in the GR output.
  • I am not 100% certain the InspectDR backend reads in the data correctly when the user provides data in matrices or labels as vectors (to match the structure when y is in matrix format).
  • I use GR and PyPlot as models, and try to replicate their behaviour as much as possible.

Your setup

Can you please explain what you did to obtain these results @t-bltg ?

For example, are you on mac-os? I've only really verified functionality on Windows and Linux.

@t-bltg
Copy link
Member Author

t-bltg commented Jul 11, 2021

@ma-laforge thanks your detailed answer.
I'm on Linux too, Ubuntu 20.04.

I get the same output when issuing $ julia -e 'using Plots; test_examples(:inspectdr, 4); png("ex4"); Plots.svg("ex4")':
ex4
, so we're on the same page here.

The issue arises when I use Documenter to generate the PlotDocs html pages. Here is the procedure:

] dev https://github.com/JuliaPlots/PlotDocs.jl
] dev https://github.com/JuliaDocs/Documenter.jl
$ cd ~/.julia/dev/PlotDocs
$ wget github.com/JuliaPlots/PlotDocs.jl/pull/246.patch -O - | patch -p1
$ julia --project=docs/ docs/make.jl

20min later, I get the generated documentation in ~/.julia/dev/PlotDocs/build.

The issue comes from the svg integration in the html files:

<h3 id="inspectdr-ref4"><a class="docs-heading-anchor" href="#inspectdr-ref4">Colors</a><a id="inspectdr-ref4-1"></a><a class="docs-heading-anchor-permalink" href="#inspectdr-ref4" title="Permalink"></a></h3><p>Access predefined palettes (or build your own with the <code>colorscheme</code> method). Line/marker colors are auto-generated from the plot&#39;s palette, unless overridden.  Set the <code>z</code> argument to turn on series gradients.</p><pre><code class="language-julia">y = rand(100)
plot(0:10:100, rand(11, 4), lab = &quot;lines&quot;, w = 3, palette = cgrad(:grays), fill = 0, α = 0.6)
scatter!(y, zcolor = abs.(y .- 0.5), m = (:heat, 0.8, Plots.stroke(1, :green)), ms = 10 * abs.(y .- 0.5) .+ 4, lab = &quot;grad&quot;)</code></pre><?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600pt" height="400pt" viewBox="0 0 600 400" version="1.1">
<defs>
<g>
<symbol overflow="visible" id="glyph0-0">
<path style="stroke:none;" d="M 0.59375 2.125 L 0.59375 -8.46875 L 6.59375 -8.46875 L 6.59375 2.125 Z M 1.265625 1.453125 L 5.9375 1.453125 L 5.9375 -7.78125 L 1.265625 -7.78125 Z M 1.265625 1.453125 "/>
</symbol>
<symbol overflow="visible" id="glyph0-1">
<path style="stroke:none;" d="M 3.8125 -7.96875 C 3.207031 -7.96875 2.75 -7.664062 2.4375 -7.0625 C 2.132812 -6.46875 1.984375 -5.566406 1.984375 -4.359375 C 1.984375 -3.160156 2.132812 -2.257812 2.4375 -1.65625 C 2.75 -1.0625 3.207031 -0.765625 3.8125 -0.765625 C 4.425781 -0.765625 4.882812 -1.0625 5.1875 -1.65625 C 5.5 -2.257812 5.65625 -3.160156 5.65625 -4.359375 C 5.65625 -5.566406 5.5 -6.46875 5.1875 -7.0625 C 4.882812 -7.664062 4.425781 -7.96875 3.8125 -7.96875 Z M 3.8125 -8.90625 C 4.789062 -8.90625 5.539062 -8.515625 6.0625 -7.734375 C 6.582031 -6.960938 6.84375 -5.835938 6.84375 -4.359375 C 6.84375 -2.890625 6.582031 -1.765625 6.0625 -0.984375 C 5.539062 -0.210938 4.789062 0.171875 3.8125 0.171875 C 2.832031 0.171875 2.082031 -0.210938 1.5625 -0.984375 C 1.050781 -1.765625 0.796875 -2.890625 0.796875 -4.359375 C 0.796875 -5.835938 1.050781 -6.960938 1.5625 -7.734375 C 2.082031 -8.515625 2.832031 -8.90625 3.8125 -8.90625 Z M 3.8125 -8.90625 "/>
</symbol>
[...]

I'm trying to dig in Documenter.jl to see what machinery produces the svg from inspectdr's output. I think I will bypass this by generating pngs instead as it is done for plotly.

@t-bltg
Copy link
Member Author

t-bltg commented Jul 11, 2021

All good now with png output (don't bother the warning, it will be suppressed) 🎉
ex4-ok

@t-bltg t-bltg marked this pull request as ready for review July 11, 2021 19:32
@ma-laforge
Copy link
Contributor

Great to hear. Thanks for helping to improve documentation @t-bltg.

@BeastyBlacksmith
Copy link
Member

Thanks a lot

@BeastyBlacksmith BeastyBlacksmith merged commit b36ef11 into JuliaPlots:master Jul 12, 2021
@t-bltg t-bltg deleted the ins_uni branch July 12, 2021 11:36
@t-bltg
Copy link
Member Author

t-bltg commented Jul 12, 2021

@BeastyBlacksmith, I hope that merging this now won't break building docs, since v0.27.4 of Documenter.jl is not yet released (#246 (comment)).

@t-bltg
Copy link
Member Author

t-bltg commented Jul 21, 2021

BeastyBlacksmith pushed a commit that referenced this pull request Jun 7, 2022
* autogen unicodeplots and inspectdr

* fix generation for unicodeplots - add ansi color support

* bypass svg for :inspectdr

Co-authored-by: t-bltg <t-bltg@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants