Module containing utility functions for plotting inside yade. See scripts/simple-scene-plot.py or examples/concrete/uniax.py for example of usage.
Global dictionary containing all data values, common for all plots, in the form {‘name’:[value,...],...}. Data should be added using plot.addData function. All [value,...] columns have the same length, they are padded with NaN if unspecified.
dictionary x-name -> (yspec,...), where yspec is either y-name or (y-name,’line-specification’)
Dictionary converting names in data to human-readable names (TeX names, for instance); if a variable is not specified, it is left untranslated.
Enable/disable live plot updating. Disabled by default for now, since it has a few rough edges.
Interval for the live plot updating, in seconds.
Enable/disable automatic plot rezooming after data update.
Do the actual plot, which is either shown on screen (and nothing is returned: if noShow is False) or, if noShow is True, returned as matplotlib’s Figure object or list of them.
You can use
>>> from yade import plot
>>> plot.plots={'foo':('bar',)}
>>> plot.plot(noShow=True).savefig('someFile.pdf')
>>> import os
>>> os.path.exists('someFile.pdf')
True
to save the figure to file automatically.
Note
For backwards compatibility reasons, noShow option will return list of figures for multiple figures but a single figure (rather than list with 1 element) if there is only 1 figure.
Reset all plot-related variables (data, plots, labels)
Reset all plot data; keep plots and labels intact.
Make all plots discontinuous at this point (adds nan’s to all data fields)
Add data from arguments name1=value1,name2=value2 to yade.plot.data. (the old {‘name1’:value1,’name2’:value2} is deprecated, but still supported)
New data will be left-padded with nan’s, unspecified data will be nan. This way, equal length of all data is assured so that they can be plotted one against any other.
Nan’s don’t appear in graphs.
Save data added with plot.addData into (compressed) file and create .gnuplot file that attempts to mimick plots specified with plot.plots.
Parameters: |
|
---|---|
Returns: | name of the gnuplot file created. |