[ANN] Releasing RecipesBase 1.0 and Plots 1.0 (please read)

Everyone, we’re updating the version of Plots and RecipesBase to 1.0. The packages are already fairly mature, the interface has solidified and breaking releases are few. Of course, there are still open issues and development is very active (~200 PRs merged in the last year), but the package has reached a very functional state. Thanks to the literally 100s of contributors that have helped build the package to this point!

Only few packages depend on Plots – but the ~150 packages that depend on RecipesBase will have to update their compat bounds to accept RecipesBase 1.0. Note that this should be COMPLETELY SAFE – the release is not breaking. We’ve taken great care for RecipesBase to never break dependencies, but pre-1.0 this has been difficult to express in SemVer (as minor releases are breaking by definition for 0.x versions).

On the other hand, the 1.0 RecipesBase release offers some new features that make type recipes easier to implement:

  • The type recipe signature for arrays of custom types
@recipe function f(::Type{T}, v::T) where T <: AbstractArray{<:MyType}

is now supported.

  • Type recipes are now aware of the axis they are applied to. So guide --> "My guide" only sets the guide on the corresponding axis in type recipes.
    The current axis in type recipes can be accessed with plotattributes[:letter] and is either :x, :y or :z.

An example for how these changes can be useful e.g. for Measurements.jl is provided in Make type recipes aware of current axes. by daschw · Pull Request #2503 · JuliaPlots/Plots.jl · GitHub.
Furthermore we have added documentation for RecipesBase at Home · RecipesBase.jl.

So please, if your package depends on RecipesBase, we request that you up the compat bounds to 1.0 and release a new patch release immediately, to ensure that this doesn’t hold updating back.The packages depending on RecipesBase are:

AIBECS, ApproxBayes, ApproxFun, ApproxFunBase, AstroImages, AugmentedGaussianProcesses, AverageShiftedHistograms, BAT, BSplines, BasisFunctionExpansions, BioStructures, Bridge, CalculusWithJulia, CancerSeqSim, CausalityTools, ChemometricsTools, ClinicalTrialUtilities, ComplexPhasePortrait, ComplexRegions, ComplexValues, ConcaveHull, ControlSystemIdentification, ConvexBodyProximityQueries, CurveProximityQueries, DFControl, DSGE, DataInterpolations, DelayEmbeddings, DiffEqBase, DiffEqBiological, DiffEqCallbacks, DiffEqDevTools, DiffEqNoiseProcess, DiffEqPDEBase, DiffEqPhysics, DimArrays, DimensionalData, DimensionalPlotRecipes, Diversity, DutyCycles, DynamicLinearModels, DynamicMovementPrimitives, EBayes, EclipsingBinaryStars, EcoBase, EcologicalNetworksPlots, EffectiveWaves, ElasticFDA, ExtremeStats, ForestBiometrics, FourierAnalysis, GaussianProcesses, GeoArrays, GeoInterface, GeoStats, GeoStatsBase, GeoStatsDevTools, GraphRecipes, GridArrays, Harlequin, Healpix, Hyperopt, ImageQuilting, ImplicitEquations, IntervalArithmetic, Iris, IterativeSolvers, JuliaDB, KDEstimation, Kpax3, LPVSpectral, LazySets, LikelihoodProfiler, LossFunctions, LowLevelParticleFilters, MCMCChain, MCMCChains, MIToS, MLJ, MLJTuning, Manopt, Measurements, MicrobiomePlots, MinAtar, MonteCarloMeasurements, MultiJuMP, NBodySimulator, NamedPlus, NeRCA, OnlineStats, PairwiseListMatrices, Pathogen, PenaltyFunctions, PerronFrobenius, Photometry, Phylo, PhyloTrees, Plots, PointPatterns, Polyhedra, PolynomialAmoebas, Polynomials, PotentialFlow, PowerDynSolve, PowerDynamics, PowerGraphics, PyDSTool, QHull, ROCAnalysis, RadiationDetectorSignals, RadiationSpectra, RecursiveArrayTools, Reinforce, Robotlib, SDDP, SchwarzChristoffel, SeparatingAxisTheorem2D, SetProg, Sherlock, SimpleSDMLayers, SingularIntegralEquations, SingularSpectrumAnalysis, SolidStateDetectors, Soss, SparseRegression, SpatialEcology, StatPlots, StateSpaceReconstruction, StatsPlots, Stheno, StratiGraphics, SwitchOnSafety, SymEngine, SymPy, TaylorModels, Temporal, ThreadPools, TimeSeries, Trajectories, TrajectoryOptimization, UncertainData, UnitfulRecipes, ValueHistories, Variography, ViscousFlow, VoxelRayTracers, WeightedArrays
45 Likes

Can you please make the list a bit more manageable? It’s hard to scroll such a long line :slight_smile:

3 Likes

Here you go: :slight_smile:

List of RecipesBase reverse dependencies
  • AIBECS
  • ApproxBayes
  • ApproxFun
  • ApproxFunBase
  • AstroImages
  • AugmentedGaussianProcesses
  • AverageShiftedHistograms
  • BAT
  • BSplines
  • BasisFunctionExpansions
  • BioStructures
  • Bridge
  • CalculusWithJulia
  • CancerSeqSim
  • CausalityTools
  • ChemometricsTools
  • ClinicalTrialUtilities
  • ComplexPhasePortrait
  • ComplexRegions
  • ComplexValues
  • ConcaveHull
  • ControlSystemIdentification
  • ConvexBodyProximityQueries
  • CurveProximityQueries
  • DFControl
  • DSGE
  • DataInterpolations
  • DelayEmbeddings
  • DiffEqBase
  • DiffEqBiological
  • DiffEqCallbacks
  • DiffEqDevTools
  • DiffEqNoiseProcess
  • DiffEqPDEBase
  • DiffEqPhysics
  • DimArrays
  • DimensionalData
  • DimensionalPlotRecipes
  • Diversity
  • DutyCycles
  • DynamicLinearModels
  • DynamicMovementPrimitives
  • EBayes
  • EclipsingBinaryStars
  • EcoBase
  • EcologicalNetworksPlots
  • EffectiveWaves
  • ElasticFDA
  • ExtremeStats
  • ForestBiometrics
  • FourierAnalysis
  • GaussianProcesses
  • GeoArrays
  • GeoInterface
  • GeoStats
  • GeoStatsBase
  • GeoStatsDevTools
  • GraphRecipes
  • GridArrays
  • Harlequin
  • Healpix
  • Hyperopt
  • ImageQuilting
  • ImplicitEquations
  • IntervalArithmetic
  • Iris
  • IterativeSolvers
  • JuliaDB
  • KDEstimation
  • Kpax3
  • LPVSpectral
  • LazySets
  • LikelihoodProfiler
  • LossFunctions
  • LowLevelParticleFilters
  • MCMCChain
  • MCMCChains
  • MIToS
  • MLJ
  • MLJTuning
  • Manopt
  • Measurements
  • MicrobiomePlots
  • MinAtar
  • MonteCarloMeasurements
  • MultiJuMP
  • NBodySimulator
  • NamedPlus
  • NeRCA
  • OnlineStats
  • PairwiseListMatrices
  • Pathogen
  • PenaltyFunctions
  • PerronFrobenius
  • Photometry
  • Phylo
  • PhyloTrees
  • Plots
  • PointPatterns
  • Polyhedra
  • PolynomialAmoebas
  • Polynomials
  • PotentialFlow
  • PowerDynSolve
  • PowerDynamics
  • PowerGraphics
  • PyDSTool
  • QHull
  • ROCAnalysis
  • RadiationDetectorSignals
  • RadiationSpectra
  • RecursiveArrayTools
  • Reinforce
  • Robotlib
  • SDDP
  • SchwarzChristoffel
  • SeparatingAxisTheorem2D
  • SetProg
  • Sherlock
  • SimpleSDMLayers
  • SingularIntegralEquations
  • SingularSpectrumAnalysis
  • SolidStateDetectors
  • Soss
  • SparseRegression
  • SpatialEcology
  • StatPlots
  • StateSpaceReconstruction
  • StatsPlots
  • Stheno
  • StratiGraphics
  • SwitchOnSafety
  • SymEngine
  • SymPy
  • TaylorModels
  • Temporal
  • ThreadPools
  • TimeSeries
  • Trajectories
  • TrajectoryOptimization
  • UncertainData
  • UnitfulRecipes
  • ValueHistories
  • Variography
  • ViscousFlow
  • VoxelRayTracers
  • WeightedArrays
11 Likes

My versions of Plots and RecipesBase aren’t updating yet. Any way for me to tell which package with not yet up-to-date compat are holding them back?

1 Like

Yes you can ]add Plots@1.0 to see what’s holding you back

5 Likes

Done for BioStructures.jl!

3 Likes

thanks!

Hi,

I am wondering if there is a way to specify the layer. For example, if I do the following recipe, how can I specifiy the fact that I want the scatter to be above the lines, in the foreground?

struct A end

@recipe function f(::A)
	N = 10
	x = 1:N
	y = rand(N)
	@series begin
		seriestype := :scatter
		x, y
	end
	x, y
end

plot(A())

Thank you,

Just sort the series with the scatter last:

@recipe function f(::A)
    N = 10
    x = 1:N
    y = rand(N)
    @series begin
        x, y
    end
    @series begin
        seriestype := :scatter
        x, y
    end
end

[EDIT]: But if you just want to show markers and lines, better to just add the marker:

@recipe function f(::A)
    N = 10
    x = 1:N
    y = rand(N)
    markershape --> :circle
    x, y
end
1 Like

thank you.

Concerning this new signature, is there an example available?

using Plots

struct MyType
    v::Float64
end
getval(mt) = mt.v

@recipe function f(::Type{T}, mtv::T) where T <: AbstractArray{<:MyType}
    guide --> "MyType axis"
    formatter --> x -> string("MyType(", round(x, digits = 6), ")")
    getval.(mtv)
end
plot(MyType.(rand(10)))

mytype_1

plot(MyType.(1:10), rand(10))

mytype_2

or https://github.com/JuliaPlots/Plots.jl/pull/2548#issue-400307090

2 Likes

Oh I see.

It is not what I imagined. I have a plot recipe for a MyType and I thought I could use the new signature to apply repeatedly the plot recipe to each element in vecMyType::AbstractArray{MyType} to plot inplace, by superposition of the different plots. This would avoid writing 2 separate recipes which a quite the same.

I’m sorry, I don’t really understand what you mean with this. Which 2 recipes that are almost the same would you have to write? Could you provide a MWE?

Say I have the following recipe for a single element a::A:

struct A end

# this is more complex in my use case
@recipe function f(::A)
	N = 10
	x = 1:N
	y = rand(N)
	@series begin
		seriestype := :scatter
		label --> ""
		x, y
	end
	x, y
end

I can use this to do plot(A()). What I want to do it plot([A(), A(), A()]) as a mean to

plot(A())
plot!(A())
plot!(A())

and I thought that @recipe function f(::Type{T}, v::T) where T <: AbstractArray{<:MyType} was for this.

So, I want to do something along the lines of (completely wrong)

@recipe function f(::Type{T}, myAs::T) where T <: AbstractArray{<:A}
	for res in myAs
	      f(res)
	end
end

If this is not possible, I will have to re-implement @recipe function f(::Type{T}, myAs::T) where T <: AbstractArray{<:A} and the code will look like a duplicate of @recipe function f(::A).

OK, I see, you are using a user recipe. I’m afraid, what you want to do is in general not possible for type recipes. Type recipes are supposed to define a mapping from user defined types to data points that Plots can assign along an axis (Strings or Numbers), or types that are handled by another type recipe. New series are ignored in type recipes.
Would a second user recipe for vectors work in your case?

@recipe function f(v::AbstractVector{<:A})
    for i in eachindex(v)
        @series begin
            A()
        end
    end
end
1 Like

I like that!! Thank you