Discussion:
[deprecated list] Facet position
Anton Gladky
2009-07-14 15:24:33 UTC
Permalink
Hi, all!

How can I get current position of Facet for plotting the graph?
This code

yade.plot.plots={'t':('Z_pr')}
def myAddPlotData():
press=O.bodies[id_press]

yade.plot.addData({'t':O.time,'Z_pr':press.phys['se3'][2],'F':O.bex.f(id_press),.....

Does not work.

Thank you
______________________________
[ENG] Best Regards
[GER] Mit freundlichen GrÌßen
[RUS] С МаОлучшОЌО пПжелаМОяЌО
[UKR] З МайкращОЌО пПбажаММяЌО

Anton Gladkyy
Václav Šmilauer
2009-07-14 15:31:40 UTC
Permalink
Post by Anton Gladky
yade.plot.plots={'t':('Z_pr')}
press=O.bodies[id_press]
yade.plot.addData({'t':O.time,'Z_pr':press.phys['se3'][2],'F':O.bex.f(id_press),.....
Does not work.
What do you mean, "does not work"? (Post your script if unsure)

Oh! perhaps you meant

yade.plot.plots={'t':('Z_pr',)}

(note the comma: that makes the ('Z_pr',) a 1-tuple; ('Z_pr') is just
string that is put into redundant parentheses and you will get some
weird error.


_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users-oU9gvf+***@public.gmane.org
Unsubscribe : https://launchpad.net/~yade-users
More help : https://help.launchpad.net/ListHelp
Anton Gladky
2009-07-14 15:47:36 UTC
Permalink
Post by Václav Šmilauer
yade.plot.plots={'t':('Z_pr',)}
(note the comma: that makes the ('Z_pr',) a 1-tuple; ('Z_pr') is just
string that is put into redundant parentheses and you will get some weird
error.
Thank you, that works :)!

Just comma means a lot.....
Post by Václav Šmilauer
_______________________________________________
Mailing list: https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
Unsubscribe : https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
More help : https://help.launchpad.net/ListHelp
Václav Šmilauer
2009-07-14 15:57:50 UTC
Permalink
Post by Václav Šmilauer
yade.plot.plots={'t':('Z_pr',)}
(note the comma: that makes the ('Z_pr',) a 1-tuple; ('Z_pr') is
just string that is put into redundant parentheses and you will
get some weird error.
Thank you, that works :)!
https://bugs.launchpad.net/yade/+bug/399360 (I was hit by that one
myself a few times, as the error reported is not at all clear).


_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users-oU9gvf+***@public.gmane.org
Unsubscribe : https://launchpad.net/~yade-users
More help : https://help.launchpad.net/ListHelp
Anton Gladky
2009-07-15 07:11:51 UTC
Permalink
One more small question. If I want 2 diagrams to be appeared:
yade.plot.plots={'t':('Z_pr',),'F':('t')}
It works,

but when I change F and t:
yade.plot.plots={'t':('Z_pr',),'t':('F')}
I receive only 't':('F') diagram, first one does not appears...
Thank you


Anton Gladkyy
Post by Václav Šmilauer
yade.plot.plots={'t':('Z_pr',)}
Post by Václav Šmilauer
(note the comma: that makes the ('Z_pr',) a 1-tuple; ('Z_pr') is
just string that is put into redundant parentheses and you will
get some weird error.
Thank you, that works :)!
https://bugs.launchpad.net/yade/+bug/399360 (I was hit by that one myself
a few times, as the error reported is not at all clear).
_______________________________________________
Mailing list: https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
Unsubscribe : https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
More help : https://help.launchpad.net/ListHelp
Václav Šmilauer
2009-07-15 07:46:55 UTC
Permalink
Post by Anton Gladky
yade.plot.plots={'t':('Z_pr',),'F':('t')}
It works,
yade.plot.plots={'t':('Z_pr',),'t':('F')}
I receive only 't':('F') diagram, first one does not appears...
That's normal, python dicts have only one value per key; try this:

a={'a':1,'a':2}
print a # {'a': 2}

since 'a':1 was overwritten. What you have to do is to create
differently-named t axis:

yade.plot.plots={'t':('Z_pr',),'t_':('F',)}

(you can name it as you want, I just appended the "_" (and do not forget
the comma after 'F' again)) and in addPlotData, you will have

't':O.time,'t_':O.time,...

HTH, Vaclav



_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users-oU9gvf+***@public.gmane.org
Unsubscribe : https://launchpad.net/~yade-users
More help : https://help.launchpad.net/ListHelp
Anton Gladky
2009-07-15 08:22:08 UTC
Permalink
Thank you!

______________________________
Anton Gladkyy
Post by Václav Šmilauer
Post by Anton Gladky
yade.plot.plots={'t':('Z_pr',),'F':('t')}
It works,
yade.plot.plots={'t':('Z_pr',),'t':('F')}
I receive only 't':('F') diagram, first one does not appears...
a={'a':1,'a':2}
print a # {'a': 2}
since 'a':1 was overwritten. What you have to do is to create
yade.plot.plots={'t':('Z_pr',),'t_':('F',)}
(you can name it as you want, I just appended the "_" (and do not forget
the comma after 'F' again)) and in addPlotData, you will have
't':O.time,'t_':O.time,...
HTH, Vaclav
_______________________________________________
Mailing list: https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
Unsubscribe : https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
More help : https://help.launchpad.net/ListHelp
Anton Gladky
2009-07-15 09:10:08 UTC
Permalink
Is it possible to make different y-values from right side of the diagram?
MatPlotLib manual?

______________________________
Anton Gladkyy
Post by Anton Gladky
Thank you!
______________________________
Anton Gladkyy
Post by Václav Šmilauer
Post by Anton Gladky
yade.plot.plots={'t':('Z_pr',),'F':('t')}
It works,
yade.plot.plots={'t':('Z_pr',),'t':('F')}
I receive only 't':('F') diagram, first one does not appears...
a={'a':1,'a':2}
print a # {'a': 2}
since 'a':1 was overwritten. What you have to do is to create
yade.plot.plots={'t':('Z_pr',),'t_':('F',)}
(you can name it as you want, I just appended the "_" (and do not forget
the comma after 'F' again)) and in addPlotData, you will have
't':O.time,'t_':O.time,...
HTH, Vaclav
_______________________________________________
Mailing list: https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
Unsubscribe : https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
More help : https://help.launchpad.net/ListHelp
Václav Šmilauer
2009-07-15 14:47:56 UTC
Permalink
Post by Anton Gladky
Is it possible to make different y-values from right side of the diagram?
No, not currently. Matplotlib can do it, sure
(http://matplotlib.sf.net/gallery.html), but I tried to wrap it in a
very minimalistic interface to avoid lot of code for simple plots. For
now, do 2 graphs with the same x-axis and file a wishlist bug about
y2axis so that I don't forget. Vaclav



_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users-oU9gvf+***@public.gmane.org
Unsubscribe : https://launchpad.net/~yade-users
More help : https://help.launchpad.net/ListHelp
Václav Šmilauer
2009-07-15 16:53:13 UTC
Permalink
Post by Anton Gladky
Is it possible to make different y-values from right side of the diagram?
MatPlotLib manual?
I added that now, along with fixing
https://bugs.launchpad.net/yade/+bug/399360 (tuple vs. string). Use the
string '|||' to separate y1axis from y2axis:

{'t':'Z_pr','t_':('F',('g','go-'),'|||','F2')}

note 1: 'Z_pr' will work (before, you would have to say ('Z_pr',) )
note 2: F and g will be plotted on y1 on the second figure, F2 on y2;
'|||' separates those
note 3: ('g','go-'): the 2nd string is marker specifier as in matlab,
see
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot (and scripts/siple-scene-graph.py).

(you can add all that to the faq :-) )

If '|||' seems ugly, propose something else, it doesn't really matter.

Vaclav



_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users-oU9gvf+***@public.gmane.org
Unsubscribe : https://launchpad.net/~yade-users
More help : https://help.launchpad.net/ListHelp
Anton Gladky
2009-07-15 17:04:01 UTC
Permalink
I've done it. Thank you.
______________________________

Anton Gladkyy
Post by Václav Šmilauer
(you can add all that to the faq :-) )
Loading...