Am Donnerstag, 4. April 2013 11:38:41 UTC+2 schrieb P Purkayastha:
> I suggest that you introduce a function in sage/plot/misc.py, say, > > def get_matplotlib_linestyle(linestyle, return_type): > if return_type == 'short': > # change linestyle from 'dotted', 'dashed', etc to ':', '--' > # if linestyle is already in the form ':', '--', etc then > # return back the same thing > elif return_type == 'long': > # do the opposite of the "if" statement > else: > # raise ValueError. > > > Then call this function with the proper value of return_type depending > on the plot function that is called. Since the main restriction of the > linestyle ('dotted' format or ':' format) comes from matplotlib. This > one function will also ensure that similar code is not repeated in a > hundred different functions. Also, it will simultaneously enable us to > unify the linestyle argument for all plot functions. > > > I followed your suggestion and attached a > patch<http://trac.sagemath.org/sage_trac/attachment/ticket/13834/trac_13834_enable_short_linestyle.patch>to > the > trac<http://trac.sagemath.org/sage_trac/attachment/ticket/13834/trac_13834_enable_short_linestyle.patch>ticket. > Furthermore I tried to catch the ValueError and print a warning, that the linestyle is ignored if it is not among the allowed keywords. Maybe you can have a look at this patch? > > > > Furthermore: > > > > plot_vector_field > > plot_slope_field > > > > crashed if linestyle was set. Other function which didin't allow > > linestyle ignored the keyword and printed a message, that it was > > ignored. Should these function also provide this behavior. > > I would suggest ignoring the linestyle and print a warning instead of > inducing a crash. This method is already used in a lot of places in the > plot code. > > I looked a little bit into this problem. Seems there is a little bug in these classes. I'll soon open a ticket concerning this problem. Best, Tobias -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel?hl=en. For more options, visit https://groups.google.com/groups/opt_out.