Skip to content

Add custom recipe for histogram of a time series#14

Open
fzierler wants to merge 7 commits intomasterfrom
serieshistogram
Open

Add custom recipe for histogram of a time series#14
fzierler wants to merge 7 commits intomasterfrom
serieshistogram

Conversation

@fzierler
Copy link
Collaborator

@fzierler fzierler commented May 25, 2021

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 JuliaPlots/RecipesBase.jl#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.

@fzierler fzierler mentioned this pull request May 25, 2021
@briederer
Copy link
Owner

briederer commented May 25, 2021

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
Copy link
Collaborator Author

fzierler commented May 25, 2021

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

@briederer
Copy link
Owner

briederer commented May 25, 2021

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/

import LsqFit: curve_fit
import Statistics: mean
using Plots

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've read somewhere that there is a suggested order for structuring a module-file. Do you know anything about it and if so do we already follow this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I don't care. Put them in any order you want ;)

include("plots.jl")
include("spectroscopy.jl")
include("theory.jl")
include("statistics.jl")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer alphabetic order in the included files.

@briederer briederer added the WIP Work in progress label May 26, 2021
@briederer briederer force-pushed the master branch 2 times, most recently from 606ce9f to ead5994 Compare May 27, 2021 11:00
@briederer
Copy link
Owner

briederer commented Nov 4, 2021

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
Copy link
Contributor

github-actions bot commented Jan 15, 2022

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

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

  • Added documentation (if needed).

@fzierler
Copy link
Collaborator Author

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 fzierler changed the title [WIP] Add custom recipe for histogram of a time series Add custom recipe for histogram of a time series Jan 15, 2022
@fzierler
Copy link
Collaborator Author

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
Copy link
Contributor

github-actions bot commented Jan 15, 2022

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

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

  • Added documentation (if needed).

@fzierler fzierler removed the WIP Work in progress label Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants