]>
gitweb.michael.orlitzky.com - sage.d.git/blob - mjo/plot.py
b301e307aa30514d8865ba9ac7423c5b7170a8fa
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 default plot() function so that we can call it within
20 # mjo_plot and not die of recursion.
23 def mjo_plot(*args
, **kwargs
):
25 Replacement for the default plot function.
27 - If there's a legend, set the background color to 'white' and
28 give it a drop shadow.
31 default_legend_opts
= { 'back_color': 'white',
34 # Create an empty plot using the default options.
36 p
.set_legend_options(**default_legend_opts
)
38 # After trac #12936, this should propagate those options.
39 p
+= sage_plot(*args
, **kwargs
)
44 # Replace both the global `plot` and the ones in the modules. I am
45 # unclear about why this is necessary, and don't care too much.
47 sage
.plot
.plot
.plot
= mjo_plot
48 sage
.plot
.all
.plot
= mjo_plot