yongrenjie / penguins Goto Github PK
View Code? Open in Web Editor NEWA Python 3 package for analysing and plotting NMR spectra.
Home Page: https://yongrenjie.github.io/penguins
License: MIT License
A Python 3 package for analysing and plotting NMR spectra.
Home Page: https://yongrenjie.github.io/penguins
License: MIT License
This is separate from plotting tests...
So far I've figured out how to do this when there's only one spectrum on an entire Figure, by passing gridspec_kw to subplots(). However, I think we can do this more generally (and with fewer inconsistencies with the existing API) using the axes_divider module, something like this: https://matplotlib.org/3.1.1/gallery/axes_grid1/demo_colorbar_with_axes_divider.html
The API should be kwarg(s) for _stage2d(), perhaps a dictionary projection_options
, with keys f1
(bool), f2
(bool), f1_dataset
(optional Dataset1DProj, defaults to ds.f1projp()
), f2_dataset
(optional Dataset1DProj, defaults to ds.f2projp()
), ratio
(float, ratio of main spectrum width vs projection), and maybe more keys to control geometry (whether f1proj appears on the left or the right...?).
How do we pass plot options, e.g. the color of projections? Can't have a nested dictionary can we...
e.g. spectra that were simulated in matlab / other software
For example for 2D spectra, all of this could be bundled into one function.
Alternatively, we could add another kwarg to mkplot2d(). That might actually be more sensible.
ax.yaxis.tick_right()
ax.yaxis.label.set_rotation(0)
ax.yaxis.label.set_horizontalalignment("left")
ax.yaxis.label.set_verticalalignment("top")
ax.yaxis.set_label_coords(1.02, 1)
would be nice to have the x-axis be something apart from ppm, then we can show how a spectrum varies with p1 or some other parameter
Suggested interface - the function name can be changed
pg.add_numbering(axs, posn="upper left", type='a', start=1, fstr="({})", **kwargs)
axs - iterable of mpl.axes.Axes
posn - string where the label is placed
type - string from {'a', 'A', 'i', 'I', '1'} (what other options are there?)
start - int to start labelling from
fstr - format string, the text added is fstr.format(char)
**kwargs - keyword arguments passed on to ax.text()
Also automatically adjust the height and width. For every height_ratio that is 1 it should be 4 inches wide, so on
if "1..2" is passed as the first non-keyword argument, stage()
thinks that it should be the axes, and then it raises a weird error about not having a PlotHoldingArea.
The error is technically correct, but could be more helpful.
Then just pass kwargs through to ax.plot(). Should be easier for the user...
Reserve master for "stable" and "working" versions.. of course this doesn't actually mean anything until I actually add more tests!
Please see develop branch for updated docs.
it seems that it might be logical to add an ax parameter to the staging -- we can add attributes on mpl.axes.Axes easily like the plot queue and plot properties, so those can then be accessed with ax.plot_queue, ax.color_generator etc
We’d need to override the return type of subplots as well.
These videos are meant to accompany https://gist.github.com/yongrenjie/32cb5facb966119514d42217c4ab2b32.
For a script this isn't a problem because any errors will stop execution immediately, but doing this avoids issues with the state of the PHA persisting between different cells of jupyter notebook (thus producing weird errors when a cell failed to plot a 1D spectrum, and the next cell tries to stage a 2D spectrum).
Just use try/finally code inside mkplot().
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.