plottr
plottr copied to clipboard
Additional plotting style
Hello,
I was working with some data in plottr lately and missed a way to show a 2D dataset as the different linecuts. I know you can plot the linecuts one by one, however for some data it is more illustrative to show all the linecuts in the same plotwindow. I wrote a simple function and implementation of these kind of plots, see below:
def plot_as_linecuts(ax: Axes, x: np.ndarray, y: np.ndarray,
z: np.ndarray, cmap, **kw):
im = "linecuts"
sm = plt.cm.ScalarMappable(cmap=cmap, norm=plt.Normalize(vmin=np.amin(y), vmax=np.amax(y)))
if len(x.shape) == 1:
ax.plot(x,z,color = sm.to_rgba((y[0,0])),**kw)
else:
for i in range(x.shape[1]):
ax.plot(x[:,i],z[:,i],color = sm.to_rgba((y[0,i])),**kw)
return im, sm
It is very simple and can probably made a bit smarter by adding masked arrays to show continuous progress, now it just plots a new linecut after a step on the slow axis.
I was wondering if others are interested in this extension as an addition to the current plottypes and if so would it be possible to add something similar to this to a future release of plottr. If this is something I should keep in my own fork please let me know then I can close this topic.