SketchPlot

class Stoner.plot.formats.SketchPlot(*args, **kargs)[source]

Bases: Stoner.plot.formats.DefaultPlotStyle

Turn on xkcd plot style.

Implemented as a bit of a joke, but perhaps someone will use this in a real presentation one day ?

Example

"""Example plot in XKCD comic style SketchPlot template."""
import os.path as path
from Stoner import Data, __home__
from Stoner.plot.formats import SketchPlot

filename = path.realpath(
    path.join(__home__, "..", "doc", "samples", "sample.txt")
)
d = Data(filename, setas="xy", template=SketchPlot)
d.plot()

(png, hires.png, pdf)

../_images/sketchstyle.png

Attributes Summary

show_legend

show_title

show_xlabel

show_ylabel

show_zlabel

stylename

stylesheet

Horribly hacky method to traverse over the class heirarchy for style sheet names.

subplot_settings

Methods Summary

__call__(**kargs)

Call the template object can manipulate the rcParams that will be set.

annotate(ix, multiple, plot, **kargs)

Call all the routines necessary to annotate the axes etc.

apply()

Update matplotlib rc parameters from any attributes starting template_.

clear()

Reset everything back o defaults.

customise()

Force on xkcd style.

customise_axes(ax, plot)

Override the default axis configuration.

get(k[,d])

items()

keys()

new_figure([figure])

Create a new figure.

pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[,d])

update(*args, **kargs)

Update the template with new attributes from keyword arguments.

values()

Attributes Documentation

show_legend = True
show_title = True
show_xlabel = True
show_ylabel = True
show_zlabel = True
stylename = 'sketch'
stylesheet

Horribly hacky method to traverse over the class heirarchy for style sheet names.

subplot_settings = {'panels': {'title': (True, False, False), 'xlabel': (False, False, True), 'ylabel': (True, True, True), 'zlabel': (False, False, False)}, 'subplots': {'title': (True, True, True), 'xlabel': (True, True, True), 'ylabel': (True, True, True), 'zlabel': (False, False, False)}, 'y2': {'title': (True, False, False), 'xlabel': (True, False, False), 'ylabel': (True, True, True), 'zlabel': (False, False, False)}}

Methods Documentation

__call__(**kargs)

Call the template object can manipulate the rcParams that will be set.

annotate(ix, multiple, plot, **kargs)

Call all the routines necessary to annotate the axes etc.

Parameters
  • ix (integer) – Index of current subplot

  • multiple (string) – how to handle multiple subplots

  • plot (Stoner.plot.PlotMixin) – The PlotMixin boject we’re working with

apply()

Update matplotlib rc parameters from any attributes starting template_.

clear()

Reset everything back o defaults.

customise()[source]

Force on xkcd style.

customise_axes(ax, plot)[source]

Override the default axis configuration.

get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
new_figure(figure=False, **kargs)

Create a new figure.

This is called by PlotMixin to setup a new figure before we do anything.

pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update(*args, **kargs)

Update the template with new attributes from keyword arguments.

Up to one positional argument may be supplied

Keyword arguments may be supplied to set default parameters. Any Matplotlib rc parameter may be specified, with .’s replaced with _ and )_ replaced with __.

values() an object providing a view on D's values