On 04/03/2013 11:00 PM, Tobias Weich wrote:
Hi,

P Purkayastha nicely invited me to fix

http://trac.sagemath.org/sage_trac/ticket/13834
<http://trac.sagemath.org/sage_trac/ticket/13834>

and after I looked at it in more detail it really seemed to be easy
enough as a starting point to contributiong to sage. Whoever I will
definitely neeed some support as I didn't contribute anything before.


I started testing the 2d plotting functions for functions which only
accept 'dotted' but not ':' as linestyle.

It seems that

hyperbolic_arc
hyperbolic_triangle
circle
arc
bezier_path

are affected by this error. Should I fix this, the way P Purkayasthahas
done for the arrows (http://trac.sagemath.org/sage_trac/ticket/13423)
and attach a patch to the ticket?


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.


Furthermore I observed the following poblems while testing:

disk
Polygon

do not permit setting the linestyle. Would it be preferable to ad this
option? If you plot them not filled, then the border could be possibly
plotted in different linestyles.

We should check whether the underlying matplotlib functions do allow for linestyles.



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.



For 3d plotting i Didn't find any function which allow linestyle.
However there are some where it woul be nice as a parametric curve.
Should these features be added?

This can be done in a separate ticket. Feel free to open a new one.



Thanks for feed-back!

Tobias

Thanks for looking into this!

  basu.


--
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.


Reply via email to