]>
gitweb.michael.orlitzky.com - sage.d.git/blob - mjo/plot.py
4 * We set the default tick_formatter to 'latex'.
6 * We replace the plot() function with our own version that sets some
7 default legend options.
11 from sage
.all
import *
13 # Graphics.SHOW_OPTIONS contains the default options that will be
14 # passed to show(). It already handles merging the user-specified
15 # options, so we just tap into that power.
16 show_opts
= sage
.plot
.graphics
.Graphics
.SHOW_OPTIONS
17 show_opts
['tick_formatter'] = 'latex'
19 # Save the original implementation so that we can call it from
21 plot_impl
= sage
.plot
.plot
._plot
22 list_plot_impl
= sage
.plot
.plot
.list_plot
24 def mjo_plot(*args
, **kwargs
):
26 Replacement for the default plot function.
28 - If there's a legend, set the background color to 'white' and
29 give it a drop shadow.
32 default_legend_opts
= { 'back_color': 'white',
35 p
= plot_impl(*args
, **kwargs
)
36 p
.set_legend_options(**default_legend_opts
)
41 def mjo_list_plot(*args
, **kwargs
):
43 Replacement for the default list_plot function.
45 - If there's a legend, set the background color to 'white' and
46 give it a drop shadow.
49 default_legend_opts
= { 'back_color': 'white',
52 p
= list_plot_impl(*args
, **kwargs
)
53 p
.set_legend_options(**default_legend_opts
)
58 # This way, we don't have to try to replace all of the calls to plot()
59 # and list_plot(); we just replace the two function that did the
60 # actual implementations.
61 sage
.plot
.plot
._plot
= mjo_plot
62 sage
.plot
.plot
.list_plot
= mjo_list_plot