briederer / LatSpec.jl

A Julia Package for Lattice Spectroscopy
https://bernd1995.github.io/LatSpec.jl
MIT License
3 stars 1 forks source link

Add custom recipe for histogram of a time series #14

Open fzierler opened 3 years ago

fzierler commented 3 years ago

This adds a custom recipe for plotting a histogram next to a time series. I usually use it to plot the plaquette history and its histogram. The labelling of the y-axis does not yet work correctly, also at some point I wanted to make it possible to label the two subplots independently.

This uses grid() from Plots.jl such that the histogram is smaller than the time series. If we care about load times we can use @require from Requires.jl so that the user is warned to include Plots.jl as well or fix the upstream issue https://github.com/JuliaPlots/RecipesBase.jl/issues/15 (see #13).

Edit. I also removed currently unused packages from Project.toml. I think it is best to include only when they are needed so that it is easier to see which PR first made use of it.

briederer commented 3 years ago

Seems okay to me for now. Additions may be added later so I'll wait for you to remove the [WIP] and merge it afterwards.

fzierler commented 3 years ago

OK. Still needs tests and I need to see if the docstring works correctly. I will remove [WIP] once I'm done.

briederer commented 3 years ago

For the docs to work properly we could add to the docs an API Subpage with simply @autodocs in it. The documentation for this PR is then at https://bernd1995.github.io/LatSpec.jl/previews/PR14/

briederer commented 2 years ago

Just as a remark, we could also drop for now the grid and just use

layout --> (1,2)

which is supported in Recipes. This would mean that the Plots have the same size by default but could be changed in another environment where Plots is present by calling e.g.

using LatSpec
using Plots
SeriesHistogramm(dat, layout=grid(1,2, widths = [0.7, 0.3]))
github-actions[bot] commented 2 years ago

The Docs for this PR are deployed! 🥳 You can find them here.

Please make sure that you have documented your new feature properly:

fzierler commented 2 years ago

This branch is now up to date with master and only depends on RecipesBase. It just needs docs and then it's good to go. Example code for testing in an environment with LatSpec.jl (this PR) and Plots.jl present:

using LatSpec
using Plots
x = randn(1000)
plt = serieshistogram(x,ylabel1="values",xlabel1="time series",xlabel2="histogram")
fzierler commented 2 years ago

I have added docs and tests (I just check that a plot command does not error). This is ready for review and testing from your side.

github-actions[bot] commented 2 years ago

The Docs for this PR are deployed! 🥳 You can find them here.

Please make sure that you have documented your new feature properly: