Hi, my original problem was that the order of the labels in my plot was not the way I wanted. So I found a solution for ggplot2 at the following site:
http://learnr.wordpress.com/2010/03/23/ggplot2-changing-the-default-order-of-legend-labels-and-stacking-of-data/ As an example I tried the following: >>> import rpy2.robjects as r_objects >>> data = dict() >>> data["x"] = r_objects.IntVector(range(5,15)) >>> data["y"] = r_objects.IntVector(range(40,50)) >>> data["label"] = r_objects.IntVector([1]*5 + [2]*5) >>> dataf = r_objects.DataFrame(data) >>> print dataf y x label 1 40 5 1 2 41 6 1 3 42 7 1 4 43 8 1 5 44 9 1 6 45 10 2 7 46 11 2 8 47 12 2 9 48 13 2 10 49 14 2 >>> r_objects.globalenv["dataf"] = dataf >>> res = r_objects.r("dataf") >>> print res y x label 1 40 5 1 2 41 6 1 3 42 7 1 4 43 8 1 5 44 9 1 6 45 10 2 7 46 11 2 8 47 12 2 9 48 13 2 10 49 14 2 >>> r_objects.r("dataf$label <- factor(dataf$label, levels=rev(levels(dataf$label)))") Warning message: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL' Traceback (most recent call last): File "/usr/lib/python2.6/pprint.py", line 59, in pformat return PrettyPrinter(indent=indent, width=width, depth=depth).pformat(object) File "/usr/lib/python2.6/pprint.py", line 111, in pformat self._format(object, sio, 0, 0, {}, 0) File "/usr/lib/python2.6/pprint.py", line 129, in _format rep = self._repr(object, context, level - 1) File "/usr/lib/python2.6/pprint.py", line 223, in _repr self._depth, level) File "/usr/lib/python2.6/pprint.py", line 235, in format return _safe_repr(object, context, maxlevels, level) File "/usr/lib/python2.6/pprint.py", line 320, in _safe_repr rep = repr(object) File "/usr/local/lib/python2.6/dist-packages/rpy2/robjects/vectors.py", line 299, in __repr__ self.__repr_content__() File "/usr/local/lib/python2.6/dist-packages/rpy2/robjects/vectors.py", line 293, in __repr_content__ ', '.join((p_str(x) for x in self[-3 : ])) + \ File "/usr/local/lib/python2.6/dist-packages/rpy2/robjects/vectors.py", line 292, in <genexpr> ', '.join((p_str(x) for x in self[ : 3])) + ', ..., ' + \ File "/usr/local/lib/python2.6/dist-packages/rpy2/robjects/vectors.py", line 270, in p_str res = '%8i' %x SystemError: ../Objects/stringobject.c:4443: bad argument to internal function >>> res = r_objects.r("dataf") >>> print res y x label 1 40 5 <NA> 2 41 6 <NA> 3 42 7 <NA> 4 43 8 <NA> 5 44 9 <NA> 6 45 10 <NA> 7 46 11 <NA> 8 47 12 <NA> 9 48 13 <NA> 10 49 14 <NA> Can you help me to achieve the right ordering? If there is a way to do it in python that R accepts that is completely cool with me, too. TIA, Moritz P.S.: The themes work like a charm now, thank you =] ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list