Skip to content

Commit

Permalink
added the CellPlus functionality to enable custom co-plots
Browse files Browse the repository at this point in the history
  • Loading branch information
arm61 committed Nov 8, 2018
1 parent 043e1ca commit e2b80a1
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
# built documents.
#
# The short X.Y version.
version = '1.1.9'
version = '1.1.10'
# The full version, including alpha/beta/rc tags.
release = '1.1.9'
release = '1.1.10'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
49 changes: 49 additions & 0 deletions pylj/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,55 @@ def update(self, system):
self.fig.canvas.draw()


class CellPlus(object): # pragma: no cover
"""The CellPlus class will plot the particles positions in addition to one
user defined one-dimensional dataset. This is designed to allow user
interaction with the plotting data.
Parameters
----------
system: System
The whole system information.
xlabel: string
The label for the x-axis of the custom plot.
ylabel: string
The label for the y-axis of the custom plot.
"""
def __init__(self, system, xlabel, ylabel):
fig, ax = environment(2)

setup_cellview(ax[0], system)
ax[1].plot([0], color='#34a5daff')
ax[1].set_ylabel(ylabel, fontsize=16)
ax[1].set_xlabel(xlabel, fontsize=16)

plt.tight_layout()

self.ax = ax
self.fig = fig

def update(self, system, xdata, ydata):
"""This updates the visualisation environment. Often this can be slower
than the cythonised force calculation so use this wisely.
Parameters
----------
system: System
The whole system information.
xdata: float, array-like
x-data that should be plotted in the custom plot.
ydata: float, array-like
y-data that should be plotted in the custom plot.
"""
update_cellview(self.ax[0], system)
line1 = self.ax[1].lines[0]
line1.set_xdata(xdata)
line1.set_ydata(ydata)
self.ax[1].set_ylim([np.amin(ydata), np.amax(ydata)])
self.ax[1].set_xlim(np.amin(xdata), np.amax(xdata))
self.fig.canvas.draw()


class Energy(object): # pragma: no cover
"""The energy class will plot the particle positions and potential energy
of the system.
Expand Down
2 changes: 1 addition & 1 deletion pylj/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def __version__(): # pragma: no cover
"""This will print the number of the pylj version currently in use."""
major = 1
minor = 1
micro = 9
micro = 10
print('pylj-{:d}.{:d}.{:d}'.format(major, minor, micro))


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# versioning
MAJOR = 1
MINOR = 1
MICRO = 9
MICRO = 10
ISRELEASED = True
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)

Expand Down

0 comments on commit e2b80a1

Please sign in to comment.