← Back to team overview

yade-users team mailing list archive

Re: [Question #285268]: can i plot 2 figure using plot.plot

 

Question #285268 on Yade changed:
https://answers.launchpad.net/yade/+question/285268

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hi Diego,

you actually already answered yourself :-)


> i don't want use subplots.


then use plot.plot(subPlots=False) # [1]

########################
from yade import plot
plot.data = dict(a=[0,1,2],b=[2,4,8],c=[4,5,6],d=[8,6,5]) # normally
created by plot.addData(...)
plot.plots = {'a':'b', 'c':'d'}
plot.plot(subPlots=False)
########################

if you want two plots with the same horizontal axis, use space in
plot.plots:

########################
plot.plots = {'a':'b', 'a ':'d'} # note the space in the second 'a ', [2]
plot.plot(subPlots=False)
########################

if this is impossible i use matplotlib and then the question is, are there
> any analog function  to  plot.addData.


it is also possible, e.g. to create some more sophisticated graphs.
plot.data is just plain python dictionary, whose keys are variable names
and values are lists of saved values. So you have all the data and can do
whatever you want with them

cheers
Jan

PS: a MWE [3] is always useful, e.g. to see what you have already tried
etc.

[1] https://yade-dem.org/doc/yade.plot.html#yade.plot.plot
[2] https://yade-dem.org/doc/user.html#multiple-figures
[3] https://yade-dem.org/wiki/Howtoask

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.