|
|
I guys, i can't add a legend to a plot i'm saving
The plotting code is the one below:
plt.plot(x, y_1, 'b', x, y_2, 'r', x, y_3, 'g') blue_patch = mpatches.Patch(color='blue', label=self.y_ok[0]) red_patch = mpatches.Patch(color='red', label=self.y_ok[1]) green_patch = mpatches.Patch(color='green', label=self.y_ok[2]) plt.legend(handles=[blue_patch]) plt.xlabel(self.x_ok) plt.ylabel(self.y_ok[0] + ' ' +self.y_ok[1] + ' ' + self.y_ok[2]) plt.xlim((self.axisScale[0],self.axisScale[1])) plt.ylim((self.axisScale[2],self.axisScale[3]))
I try to add the legend how you can see, but i get a warning message and the figure saved hasn't got the legend
Could you help me?
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
|
|
On Sun, 5 Oct 2014, Andrea Mastrangelo wrote:
> ... but i get a warning message
> Could you help me?
It would be easier for someone to help you if you provide the warning
message.
Rich
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
|
|
excuse me, i don't have the message and now i cut this lines of code
it was something like: pot hasn't attribute 'legend' and then, after some modifies the warning was about patch
it wasn't an error because the file has been saved, but without legend Il giorno domenica 5 ottobre 2014 17:25:25 UTC+2, fuzzydoc ha scritto: On Sun, 5 Oct 2014, Andrea Mastrangelo wrote:
> ... but i get a warning message
> Could you help me?
It would be easier for someone to help you if you provide the warning
message.
Rich
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
|
|
this was the second warning, it's made by an other file.py, but it is the same:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/axes.py:4486: UserWarning: No labeled objects found. Use label='...' kwarg on individual plots.
warnings.warn("No labeled objects found. "
Il giorno domenica 5 ottobre 2014 18:02:13 UTC+2, Andrea Mastrangelo ha scritto: excuse me, i don't have the message and now i cut this lines of code
it was something like: pot hasn't attribute 'legend' and then, after some modifies the warning was about patch
it wasn't an error because the file has been saved, but without legend Il giorno domenica 5 ottobre 2014 17:25:25 UTC+2, fuzzydoc ha scritto: On Sun, 5 Oct 2014, Andrea Mastrangelo wrote:
> ... but i get a warning message
> Could you help me?
It would be easier for someone to help you if you provide the warning
message.
Rich
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
|
|
On Sunday, October 5, 2014 4:46:54 PM UTC+2, Andrea Mastrangelo wrote: I guys, i can't add a legend to a plot i'm saving
A) You should not ask MPL questions in a wxPython forum B) Do you use mpl 1.3.1 (very likely, because mpl 1.4.0 is still very fresh)? In that case this will not work (there is also no mentioning of this syntax in the 1.3.1 docs). You can use instead plt.legend([blue_patch], [self.y_ok[0]])
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
|
|
Sorry for the mistake, I didn't think about the wx, absentmindedly i though it was a python forum.
Thank you for the assistance, i kept the syntax in a forum where they didn't say it works only with new library. I will check the difference and then i think i'll download new versioni!
Thank you very much Il giorno lunedì 6 ottobre 2014 10:10:03 UTC+2, nepix32 ha scritto: On Sunday, October 5, 2014 4:46:54 PM UTC+2, Andrea Mastrangelo wrote: I guys, i can't add a legend to a plot i'm saving
A) You should not ask MPL questions in a wxPython forum B) Do you use mpl 1.3.1 (very likely, because mpl 1.4.0 is still very fresh)? In that case this will not work (there is also no mentioning of this syntax <a href="http://matplotlib.org/1.3.1/users/legend_guide.html" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fmatplotlib.org%2F1.3.1%2Fusers%2Flegend_guide.html\46sa\75D\46sntz\0751\46usg\75AFQjCNEL4x6ueOG2lMTMlrgibtkNPnyWWg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fmatplotlib.org%2F1.3.1%2Fusers%2Flegend_guide.html\46sa\75D\46sntz\0751\46usg\75AFQjCNEL4x6ueOG2lMTMlrgibtkNPnyWWg';return true;">in the 1.3.1 docs). You can use instead plt.legend([blue_patch], [self.y_ok[0]])
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
|
|