X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fplot.py;h=21bd24cfa1a0691a48c6cfb494b65978bdb1df41;hb=10142e85f34c47fa35df002f519d1d58a79a74f4;hp=87fccb335103e57dc2d98704c31296cc0aa116aa;hpb=2058780173b27773116403f88d5b9daf6ec21b47;p=sage.d.git diff --git a/mjo/plot.py b/mjo/plot.py index 87fccb3..21bd24c 100644 --- a/mjo/plot.py +++ b/mjo/plot.py @@ -19,6 +19,7 @@ show_opts['tick_formatter'] = 'latex' # Save the original implementation so that we can call it from # within mjo_plot. plot_impl = sage.plot.plot._plot +list_plot_impl = sage.plot.plot.list_plot def mjo_plot(*args, **kwargs): """ @@ -31,16 +32,31 @@ def mjo_plot(*args, **kwargs): default_legend_opts = { 'back_color': 'white', 'shadow': True } - # Create an empty plot using the default options. - p = Graphics() + p = plot_impl(*args, **kwargs) p.set_legend_options(**default_legend_opts) - # After trac #12936, this should propagate those options. - p += plot_impl(*args, **kwargs) return p -# This way, we don't have to try to replace all of the calls to -# plot(); we just replace the one function that did the actual -# implementation. +def mjo_list_plot(*args, **kwargs): + """ + Replacement for the default list_plot function. + + - If there's a legend, set the background color to 'white' and + give it a drop shadow. + + """ + default_legend_opts = { 'back_color': 'white', + 'shadow': True } + + p = list_plot_impl(*args, **kwargs) + p.set_legend_options(**default_legend_opts) + + return p + + +# This way, we don't have to try to replace all of the calls to plot() +# and list_plot(); we just replace the two function that did the +# actual implementations. sage.plot.plot._plot = mjo_plot +sage.plot.plot.list_plot = mjo_list_plot