Minor changes in preparation of v1.4.1
This commit is contained in:
parent
919068e797
commit
9001d5f385
14
ChangeLog.md
14
ChangeLog.md
@ -1,3 +1,17 @@
|
||||
# Version 1.4.1 (released on: )
|
||||
- New features:
|
||||
* Implicit recipes can now returns a `Vector{PlotElement}`;
|
||||
|
||||
* Allow using single quotes in output file names (#52);
|
||||
|
||||
* New function: `palette_levels()` can be used to modify palette levels before passing them to gnuplot;
|
||||
|
||||
- Bugfix:
|
||||
* Fixed `BoundsErrors` in `hist()` (#49);
|
||||
|
||||
* Fixed problem when generating documentation (#51);
|
||||
|
||||
|
||||
# Version 1.4.0 (released on: May 5, 2021)
|
||||
- New features:
|
||||
* Missing values are accepted if the input arrays have `eltype <:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
name = "Gnuplot"
|
||||
uuid = "dc211083-a33a-5b79-959f-2ff34033469d"
|
||||
version = "1.4.0"
|
||||
version = "1.4.1"
|
||||
|
||||
[deps]
|
||||
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
|
||||
@ -21,4 +21,4 @@ DataStructures = "^0.18"
|
||||
ReplMaker = "^0.2"
|
||||
StatsBase = "^0.33"
|
||||
StructC14N = "^0.3"
|
||||
julia = "^1.5"
|
||||
julia = "^1.6"
|
||||
|
||||
@ -21,6 +21,7 @@ gpvars
|
||||
hist
|
||||
linetypes
|
||||
palette
|
||||
palette_levels
|
||||
palette_names
|
||||
recipe
|
||||
save
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 38 KiB |
@ -210,6 +210,16 @@ saveas("basic008a") # hide
|
||||
```
|
||||

|
||||
|
||||
The palette levels may be easily stretched by using the [`palette_levels()`](@ref) and modifying the numeric levels, e.g.:
|
||||
```@example abc
|
||||
x = 0:0.1:10pi
|
||||
v, l, n = palette_levels(:viridis)
|
||||
@gsp palette(v.^0.25, l, n) cbr=[-1,1].*30 :-
|
||||
@gsp :- x x.*sin.(x) x.*cos.(x) x./20 "w p pt 7 ps var lc pal"
|
||||
saveas("basic008b") # hide
|
||||
```
|
||||

|
||||
|
||||
The list of all available palette can be retrieved with [`palette_names()`](@ref):
|
||||
```@repl abc
|
||||
palette_names()
|
||||
|
||||
@ -19,11 +19,11 @@ Check **Gnuplot.jl** version with:
|
||||
```julia-repl
|
||||
julia> ]st Gnuplot
|
||||
Status `~/.julia/environments/v1.4/Project.toml`
|
||||
[dc211083] Gnuplot v1.4.0
|
||||
[dc211083] Gnuplot v1.4.1
|
||||
```
|
||||
If the displayed version is not `v1.4.0` you are probably having a dependency conflict. In this case try forcing installation of the latest version with:
|
||||
If the displayed version is not `v1.4.1` you are probably having a dependency conflict. In this case try forcing installation of the latest version with:
|
||||
```julia-repl
|
||||
julia> ]add Gnuplot@1.4.0
|
||||
julia> ]add Gnuplot@1.4.1
|
||||
```
|
||||
and check which package is causing the conflict.
|
||||
|
||||
|
||||
@ -110,8 +110,5 @@ using Requires
|
||||
end;
|
||||
end
|
||||
```
|
||||
At the Julia prompt you may load the package and the associated settings by typing:
|
||||
```julia
|
||||
julia> @gnuplotrc
|
||||
```
|
||||
and you're ready to go.
|
||||
|
||||
The above code will be automatically when you first load the package with `using Gnuplot`.
|
||||
|
||||
@ -26,11 +26,13 @@ Press the `h` key on the window to display an help message with all available ke
|
||||
|
||||
|
||||
## Plot in a terminal application (`dumb`, `sixel` and `sixelgd`)
|
||||
Gnuplot supports plotting in a terminal application, with no need for X11 or other GUI support, via the `dumb`, `sixel` and `sixelgd` terminals. These are extremely useful when you run Julia on a remote shell through `ssh`, with no X11 forwarding.
|
||||
Gnuplot supports plotting in a terminal application, with no need for X11 or other GUI support, via the `dumb`, `sixel` and `sixelgd` terminals. These are extremely useful when you run Julia on a remote shell through `ssh`, with no X11 forwarding. The `dumb` terminal uses ASCII characters to draw a plot, while `sixel` and `sixelgd` actually use bitmaps (but require Sixel support to be enabled in the terminal, e.g. `xterm -ti vt340`).
|
||||
|
||||
The `dumb` terminal uses ASCII characters to draw a plot, while `sixel` and `sixelgd` actually use bitmaps (but require Sixel support to be enabled in the terminal, e.g. `xterm -ti vt340`). Dumb terminal can be used as follows:
|
||||
Dumb terminal can be used as follows:
|
||||
|
||||
```jldoctest; setup = :(using Gnuplot)
|
||||
julia> origterm = Gnuplot.options.term;
|
||||
|
||||
```jldoctest; setup = :(using Gnuplot; origterm = Gnuplot.options.term)
|
||||
julia> Gnuplot.options.term = "dumb size 60,15";
|
||||
|
||||
julia> @gp "plot sin(x)"
|
||||
|
||||
@ -7,7 +7,7 @@ import Base.reset
|
||||
import Base.write
|
||||
import Base.show
|
||||
|
||||
export session_names, dataset_names, palette_names, linetypes, palette,
|
||||
export session_names, dataset_names, palette_names, linetypes, palette_levels, palette,
|
||||
terminal, terminals, test_terminal,
|
||||
stats, @gp, @gsp, save, gpexec,
|
||||
boxxy, contourlines, dgrid3d, hist, recipe, gpvars, gpmargins, gpranges
|
||||
@ -520,19 +520,6 @@ function readTask(gp::GPSession)
|
||||
delete!(sessions, gp.sid)
|
||||
end
|
||||
|
||||
# Read data from `from` and forward them to `stdout`.
|
||||
#
|
||||
# This is similar to `Base.write(to::IO, from::IO)` when called as
|
||||
# write(stdout, from), but the difference is in situation when
|
||||
# `stdout` changes. This function writes data to the changed `stdout`,
|
||||
# whereas the call to `Base.write` writes to the original `stdout`
|
||||
# forever.
|
||||
function writeToStdout(from::IO)
|
||||
while !eof(from)
|
||||
write(stdout, readavailable(from))
|
||||
end
|
||||
end
|
||||
|
||||
function GPSession(sid::Symbol)
|
||||
session = DrySession(sid)
|
||||
if !options.dry
|
||||
@ -565,7 +552,9 @@ function GPSession(sid::Symbol)
|
||||
|
||||
# Start reading tasks
|
||||
@async readTask(out)
|
||||
@async writeToStdout(pout)
|
||||
@async while !eof(pout) # see PR #51
|
||||
write(stdout, readavailable(pout))
|
||||
end
|
||||
|
||||
# Read gnuplot default terminal
|
||||
if options.term == ""
|
||||
@ -1372,7 +1361,7 @@ end
|
||||
|
||||
Return the **Gnuplot.jl** package version.
|
||||
"""
|
||||
version() = v"1.4.0"
|
||||
version() = v"1.4.1"
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
"""
|
||||
@ -1723,6 +1712,34 @@ function linetypes(cmap::ColorScheme; lw=1, ps=1, dashed=false, rev=false)
|
||||
end
|
||||
|
||||
|
||||
"""
|
||||
palette_levels(cmap::ColorScheme; rev=false, smooth=false)
|
||||
palette_levels(s::Symbol; rev=false, smooth=false)
|
||||
|
||||
Convert a `ColorScheme` object into a `Tuple{Vector{Float64}, Vector{String}, Int}` containing:
|
||||
- the numeric levels (between 0 and 1 included) corresponding to colors in the palette;
|
||||
- the corresponding colors (as hex strings);
|
||||
- the total number of different colors in the palette.
|
||||
|
||||
If the argument is a `Symbol` it is interpreted as the name of one of the predefined schemes in [ColorSchemes](https://juliagraphics.github.io/ColorSchemes.jl/stable/basics/#Pre-defined-schemes-1).
|
||||
|
||||
If `rev=true` the palette is reversed. If `smooth=true` the palette is interpolated in 256 levels.
|
||||
"""
|
||||
palette_levels(s::Symbol; kwargs...) = palette_levels(colorschemes[s]; kwargs...)
|
||||
function palette_levels(cmap::ColorScheme; rev=false, smooth=false)
|
||||
levels = OrderedDict{Float64, String}()
|
||||
for x in LinRange(0, 1, (smooth ? 256 : length(cmap.colors)))
|
||||
if rev
|
||||
color = get(cmap, 1-x)
|
||||
else
|
||||
color = get(cmap, x)
|
||||
end
|
||||
levels[x] = "#" * Colors.hex(color)
|
||||
end
|
||||
return (collect(keys(levels)), collect(values(levels)), length(cmap.colors))
|
||||
end
|
||||
|
||||
|
||||
"""
|
||||
palette(cmap::ColorScheme; rev=false, smooth=false)
|
||||
palette(s::Symbol; rev=false, smooth=false)
|
||||
@ -1733,19 +1750,13 @@ If the argument is a `Symbol` it is interpreted as the name of one of the predef
|
||||
|
||||
If `rev=true` the palette is reversed. If `smooth=true` the palette is interpolated in 256 levels.
|
||||
"""
|
||||
function palette(values::Vector{Float64}, levels::Vector{String}, ncolors::Int)
|
||||
str = string.(values) .* " '" .* levels .* "'"
|
||||
return "set palette defined (" * join(str, ", ") * ")\nset palette maxcol $(ncolors)\n"
|
||||
end
|
||||
palette(s::Symbol; kwargs...) = palette(colorschemes[s]; kwargs...)
|
||||
function palette(cmap::ColorScheme; rev=false, smooth=false)
|
||||
levels = Vector{String}()
|
||||
for x in LinRange(0, 1, (smooth ? 256 : length(cmap.colors)))
|
||||
if rev
|
||||
color = get(cmap, 1-x)
|
||||
else
|
||||
color = get(cmap, x)
|
||||
end
|
||||
push!(levels, "$x '#" * Colors.hex(color) * "'")
|
||||
end
|
||||
return "set palette defined (" * join(levels, ", ") * ")\nset palette maxcol $(length(cmap.colors))\n"
|
||||
end
|
||||
palette(cmap::ColorScheme; kwargs...) =
|
||||
palette(palette_levels(cmap; kwargs...)...)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user