Commit Graph

365 Commits

Author SHA1 Message Date
Giorgio Calderone 919068e797 Merge branch 'master' of https://github.com/gcalderone/Gnuplot.jl 2022-01-03 13:34:33 +01:00
gcalderone 23c3d663e8 Merge pull request #51 from wentasah/stdout-via-pipe
Don't run gnuplot process connected to stdout
2022-01-03 13:34:25 +01:00
Giorgio Calderone 3f40e38d72 Merge branch 'master' of https://github.com/gcalderone/Gnuplot.jl 2022-01-03 12:41:12 +01:00
gcalderone 443ef0edf7 Merge pull request #49 from wentasah/hist-bounds
Fix BoundsErrors in hist()
2022-01-03 12:40:40 +01:00
gcalderone ab927d0622 Merge pull request #52 from wentasah/escape-output
Allow using single quotes in output file names
2022-01-03 10:45:19 +01:00
Giorgio Calderone 622597c589 Merge branch 'master' of https://github.com/gcalderone/Gnuplot.jl 2022-01-03 10:39:40 +01:00
Michal Sojka ce00617796 Allow using single quotes in output file names
Gnuplot single-quoted strings have to escape single-quote characters
by doubling them.
2021-12-13 18:58:24 +01:00
Giorgio Calderone e70c30dd13 Handle the case where an implicit recipe returns a Vector{PlotElement} 2021-12-05 15:59:48 +01:00
Michal Sojka 799154f53c Add doctest of dumb terminal
This serves two purposes:

1. It demonstrates the functionality of the dumb terminal.
2. It checks that the previous commit works.
2021-12-05 11:53:30 +01:00
Michal Sojka d02c211e99 Don't run gnuplot process connected to stdout
This change fixes incompatibility of Gnuplot.jl with Documenter.jl
versions 0.27.0 and above. Without this change, Gnuplot.jl has at
least these problems:

1. When building Gnuplot.jl documentation, the process blocks and
   never finishes.

2. When using Gnuplot.jl in docstrings in other code, running
   `doctest` blocks and never finishes.

The reason is that Documenter uses a new version of IOCapture.jl,
which contains this commit:
https://github.com/JuliaDocs/IOCapture.jl/pull/9/commits/6cb4cdff34cd8f5d416bc4d0e36fe118e3f4d0bc.

Documenter evaluates code snippets from the documentation with
`stdout` redirected to a pipe to show the command's output. The
mentioned commit changes the behavior so that now capturing waits
until the pipe is closed. The problem with Gnuplot.jl is that when the
gnuplot process is started as a part of the execution of documentation
code snippet, its `stdout` is bound to Documenter's pipe. The pipe is
not closed until the gnuplot process exits, which does not happen
unless the code snippet calls `Gnuplot.quit` explicitly. Therefore
Documenter blocks indefinitely.

This can be demonstrated by storing the following code in `test.jl`

    module GnuplotDocTest
    """
    ```jldoctest; setup = :(using Gnuplot)
    julia> @gp rand(100)

    ```
    """
    test() = nothing
    end

    using Documenter
    doctest(pwd(), [GnuplotDocTest])

and running `julia test.jl`.

To fix this problem, we run the gnuplot process with stdout redirected
to a pipe and create an asynchronous task, which reads the gnuplot's
stdout and writes it to Julia's current stdout.

Correctness of this approach can be verified by running:

    using Gnuplot
    Gnuplot.options.term = "dumb"
    @gp "plot sin(x)"

Dumb terminal prints to stdout and the above command shows the graph
on Julia's stdout too. In the next commit, we add the above code as a
doctest.
2021-12-05 11:51:29 +01:00
Michal Sojka 67c8781f2b Fix another hist BoundsError
This fixes the error with `hist([1,1,1], bs=1)`:

    ERROR: BoundsError: attempt to access 0-element Vector{Int64} at index [0]
    Stacktrace:
     [1] getindex
       @ ./array.jl:801 [inlined]
     [2] hist(v::Vector{Int64}; range::Vector{Float64}, bs::Int64, nbins::Int64, pad::Bool)
       @ Gnuplot ~/.julia/dev/Gnuplot/src/Gnuplot.jl:1864
     [3] top-level scope
       @ REPL[50]:1
2021-09-06 16:53:40 +02:00
Michal Sojka db8dcfc433 Fix bounds error in hist recipe
When running hist([1,2,3], bs=2), the following error is produced:

ERROR: BoundsError: attempt to access 1-element Vector{Float64} at index [2]
Stacktrace:
 [1] getindex
   @ ./array.jl:801 [inlined]
 [2] hist(v::Vector{Int64}; range::Vector{Float64}, bs::Int64, nbins::Int64, pad::Bool)
   @ Gnuplot ~/.julia/dev/Gnuplot/src/Gnuplot.jl:1873
 [3] top-level scope
   @ REPL[25]:1
2021-09-06 16:53:40 +02:00
gcalderone 04484adc22 Merge pull request #44 from wentasah/requires-jl
docs: Suggest using Requires.jl for automatic settings of package options
2021-05-25 16:04:11 +02:00
Michal Sojka 658e5f422c docs: Suggest using Requires.jl for automatic settings of package options
Using the @gnuplotrc macro for collecting user's preferred setup works
well, but it is a bit annoying when Julia needs to be restarted
often (e.g. due to crashes). Using Requires.jl allows the user to
forget about calling @gnuplotrc; the initialization happens
automatically, whenever the Gnuplot package is loaded.
2021-05-25 15:01:45 +02:00
Giorgio Calderone 9327492aa1 Updated 2021-05-06 00:14:01 +02:00
Giorgio Calderone 0567acc60e Bump version to 1.4.0 (to meet automerge guidelines) v1.4.0 2021-05-05 23:48:11 +02:00
Giorgio Calderone 74e195f290 Updated 2021-05-05 12:19:04 +02:00
Giorgio Calderone 875773fd3d Docs updated 2021-05-05 12:03:13 +02:00
Giorgio Calderone 53159f89e1 Bugfix; Allow missing as input to hist(); Updated version() 2021-05-05 11:59:15 +02:00
Giorgio Calderone 54db30cc32 Bump version 2021-05-05 00:58:14 +02:00
Giorgio Calderone 364e5281bd Merge branch 'master' of https://github.com/gcalderone/Gnuplot.jl 2021-05-05 00:53:09 +02:00
Giorgio Calderone e8a6b21df6 Updated dependencies; Accept missing values on input arrays (if eltype <: AbstractFloat) 2021-05-05 00:52:56 +02:00
gcalderone 6c6b889df6 Merge pull request #43 from wentasah/vscode
VS Code support
2021-04-08 17:40:36 +02:00
Giorgio Calderone 5c46e35fea Updated DataStructures dependency 2021-04-01 14:04:40 +02:00
Michal Sojka 34af493921 Make the figures in VS Code bigger
Without this change, the figures in VS Code are too small.
2021-03-30 20:11:05 +02:00
Michal Sojka f2ef5373b0 Show plots in internal VS Code plot pane
With this change, when Gnuplot.jl is used within VSCode, the plot
shows in VSCode plot pane instead of in a separate Gnuplot window.

Note that when compared to IJulia and Juno, we do not test for active
VS Code connection. I don't think it is necessary, but if it turns out
to be needed later, it can be done with

    isopen(VSCodeServer.conn_endpoint[])
2021-03-30 19:43:27 +02:00
Giorgio Calderone bc74aa0db4 Accept AbstractArrays which can be converted to actual arrays 2021-01-02 00:15:39 +01:00
Giorgio Calderone b7a15290d3 Bugfix 2020-10-06 10:21:46 +02:00
Giorgio Calderone f62b569560 Fix #28 and similar issues 2020-10-05 01:14:18 +02:00
gcalderone 584144e2ec Merge pull request #30 from PallHaraldsson/patch-1
Juno and Jypyther in docs
2020-10-05 00:00:36 +02:00
gcalderone 03953c0ad6 Merge pull request #35 from jarvist/master
Add check for Pluto.jl interactive notebook.
2020-10-04 23:55:14 +02:00
Jarvist Moore Frost 084dd63059 Add check for Pluto.jl interactive notebook. 2020-09-21 21:02:08 +01:00
Páll Haraldsson 50141d1b0e Juno and Jypyther in docs
[ci skip]
2020-07-13 11:38:23 +00:00
Giorgio Calderone 83c59ae682 Set utf8 encoding on gnuplot start 2020-05-05 11:44:08 +02:00
gcalderone 1877deef7f Merge pull request #26 from lyon-fnal/master
Fix the string indexing error and problems with multiplot on JupyterLab
2020-05-05 00:59:08 +02:00
Adam Lyon 67a5583c29 Fixes #25 2020-05-04 15:59:21 -05:00
Adam Lyon 69644f99ba Fix #24 2020-05-04 15:58:59 -05:00
Giorgio Calderone 2713f8517e Updated 2020-04-29 12:24:46 +02:00
Giorgio Calderone 2c2c74e448 Added dgrid3d function v1.3.0 2020-04-29 12:12:52 +02:00
Giorgio Calderone 6bf1b80058 Bump version (1.3.0) 2020-04-28 19:26:23 +02:00
Giorgio Calderone 671efccc17 Updated 2020-04-28 19:09:39 +02:00
Giorgio Calderone bdeb0e45ab Updated 2020-04-28 18:56:04 +02:00
Giorgio Calderone 3e03aa27f7 Updated 2020-04-28 18:50:40 +02:00
Giorgio Calderone dab424bfec Updated 2020-04-28 18:42:58 +02:00
Giorgio Calderone 92380bc468 Added smooth keyword to palette; Updated docstrings 2020-04-28 14:14:25 +02:00
Giorgio Calderone 4d1768e15e Added contourlines method accepting top fractions 2020-04-27 18:37:59 +02:00
Giorgio Calderone 8e140ee998 Updated 2020-04-25 20:52:19 +02:00
Giorgio Calderone 6df834bb88 Docs updated 2020-04-25 20:41:09 +02:00
Giorgio Calderone c9fa96c9eb Docs updated 2020-04-25 20:20:09 +02:00
Giorgio Calderone d74715f156 Fixed initialization in Juno 2020-04-25 19:28:57 +02:00