Comments (8)
The gaps should be filled up
from thebeat.
Was fixed in 9f0b9e4 for thebeat.helpers.plot_single_sequence
, but not yet for thebeat.visualization.plot_multiple_sequences
. Will take a look later because that's slightly different. The y-axis there is provided as a categorical variable, which matplotlib.pyplot.vlines
does not support.
from thebeat.
Also, after 9f0b9e4 the lines have different widths. It's difficult to see but compare e.g. these two:
from thebeat.
I think this is the way forward:
import thebeat
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.patches as mpatches
# Create sequence
s = thebeat.Sequence([100, 500, 1000] * 50, first_onset=20, name="test")
# Make empty fig and ax
fig, ax = plt.subplots()
# Set title
ax.set_title("Sequence")
# Get final IOI
final_ioi = s.iois[-1] if s.end_with_interval is True else 0
# Set x and y limits
ax.set_ylim(0, 1)
ax.set_xlim(0, s.onsets[-1] + final_ioi)
# Plot onsets as rectangles
for onset in s.onsets:
rect = mpatches.Rectangle(xy=(onset, 0), height=1, width=np.min(s.iois) / 10, color="blue", fill=True)
ax.add_patch(rect)
# Remove y tick labels
ax.set_yticklabels([])
ax.set_yticks([])
# Show plot
plt.show()
I am also closing #6, because that is related.
from thebeat.
Almost done in 9e23c3d . Solution is a bit hacky for now, that has to be improved in the future.
from thebeat.
I'm having trouble reproducing this issue. My observations:
- It does not seem to depend on the type of matplotlib version used
- When saving the figure in how originally these sequences were created, there didn't seem to be an issue, even at low dpi (e.g. 100)
- My guess is that it's a problem with the inline backend of matplotlib, as the first time this issue came to light was in a Jupyter notebook
So:
- We will revert commits d131cc8 and 9f0b9e4
- We will not merge the branch better_sequence_plots', but leave it be for a while. Let's see if the problem resurfaces at some point, but I think it was a pretty specific issue.
- We will take one idea from the new branch, namely another way of renaming the y-axis labels if multiple the same exist (completely unrelated to the pres. issue, here as a reminder). This will be done in a separate commit.
from thebeat.
from thebeat.
Closing this issue.
from thebeat.
Related Issues (20)
- Error not raised when constructing a SoundSequence with end_with_interval=True and too long sound HOT 1
- Don't force a style onto users of plotting functions HOT 2
- Plot multiple sequences combines sequences with the same name HOT 1
- Different return type than given HOT 1
- ugof calculation: correlation between number of onsets and ugof HOT 3
- SoundStimulus/SoundSequence: Working with different channels HOT 3
- Rhythm.generate_random_rhythm() does deep-first search every time HOT 1
- reset index of pd dataframe returned by thebeat.utils.get_ioi_df HOT 2
- Add REPP-like phase/alignment calculations?
- Rework plot_phase_differences example
- Fix rounding terminology and consistency
- Handling of matplotlib styles by thebeat
- LilyPond figures and matplotlib
- Rhythm: Notes not tied correctly HOT 2
- Turn on nitpicky and sphinx-linkcheck for docs
- fft_values makes rounding error? HOT 1
- `Sequence.generate_random_poisson` does not generate IOIs HOT 1
- Write tests for SoundStimulus.from_parselmouth
- CI fails on Mac OS, lilypond error HOT 3
- SoundStimulus.from_parselmouth results in unwriteable (but playable) SoundStimulus object HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thebeat.