# Path: artist/plot.py
# class Plot(SubPlot, BasePlotContainer):
# 
#     """Create a plot containing a single subplot.
# 
#     This class creates a 2D plot.  Its various methods add data,
#     annotations and options which is stored in class variables. Finally,
#     the plot can be rendered using the Jinja2 templating engine
#     resulting in a LaTeX or PDF file.
# 
#     """
# 
#     def __init__(self, axis='', width=r'.67\linewidth', height=None,
#                  font_options=None):
#         environment = jinja2.Environment(loader=jinja2.PackageLoader(
#             'artist', 'templates'), finalize=self._convert_none)
#         self.template = environment.get_template('plot.tex')
# 
#         self.width = width
#         self.height = height
#         self.xmode, self.ymode = self._get_axis_modes(axis)
#         self.font_options = font_options
#         self.external_filename = None
# 
#         super(Plot, self).__init__()
# 
#     def render(self, template=None):
#         """Render the plot using a template.
# 
#         Once the plot is complete, it needs to be rendered.  Artist uses
#         the Jinja2 templating engine.  The default template results in a
#         LaTeX file which can be included in your document.
# 
#         :param template: a user-supplied template or None.
#         :type template: string or None.
#         :returns: the rendered template as string.
# 
#         """
#         if not template:
#             template = self.template
# 
#         self._prepare_data()
# 
#         response = template.render(
#             axis_background=self.axis_background,
#             xmode=self.xmode,
#             ymode=self.ymode,
#             title=self.title,
#             width=self.width,
#             height=self.height,
#             xlabel=self.xlabel,
#             ylabel=self.ylabel,
#             limits=self.limits,
#             xscale=self.xscale,
#             yscale=self.yscale,
#             ticks=self.ticks,
#             axis_equal=self.axis_equal,
#             scalebar=self.scalebar,
#             colorbar=self.colorbar,
#             colormap=self.colormap,
#             external_filename=self.external_filename,
#             font_options=self.font_options,
#             axis_options=self.axis_options,
#             has_graph_paper=self.has_graph_paper,
#             plot=self,
#             plot_template=self.template)
#         return response


from numpy import linspace, pi, sin, cos
from artist import Plot
    y = r * sin(phi)
    plot.plot(x, y, mark=None)
    plot.add_pin('start', relative_position=0, use_arrow=True)
    plot.add_pin('half', relative_position=.5, use_arrow=True)
    plot.add_pin('46\%', relative_position=.46, use_arrow=True,
                 location='above')
    plot.add_pin('end', relative_position=1, use_arrow=True, location='below')

    phi = linspace(0, 2 * pi, 10)
    x = 6 * cos(phi)
    y = 6 * sin(phi)
    plot.plot(x, y, mark=None, linestyle='thick, gray')
    plot.add_pin('start', relative_position=0, use_arrow=True,
                 location='above right')
    plot.add_pin('half', relative_position=.5, use_arrow=True,
                 location='above left')
    plot.add_pin('70\%', relative_position=.7, use_arrow=True,
                 location='below')
    plot.add_pin('end', relative_position=1, use_arrow=True,
                 location='below right')

    plot.plot([-5, 2, 5], [-7.5, -7.5, -7.5], linestyle='lightgray')
    plot.add_pin('50\%', relative_position=.5, use_arrow=True,
                 location='above right')

    plot.set_xlimits(-8, 8)
    plot.set_ylimits(-8, 8)
    plot.save('relative_pin')

    # With one logarithmic axis

# Path: artist/plot.py
# class Plot(SubPlot, BasePlotContainer):
# 
#     """Create a plot containing a single subplot.
# 
#     This class creates a 2D plot.  Its various methods add data,
#     annotations and options which is stored in class variables. Finally,
#     the plot can be rendered using the Jinja2 templating engine
#     resulting in a LaTeX or PDF file.
# 
#     """
# 
#     def __init__(self, axis='', width=r'.67\linewidth', height=None,
#                  font_options=None):
#         environment = jinja2.Environment(loader=jinja2.PackageLoader(
#             'artist', 'templates'), finalize=self._convert_none)
#         self.template = environment.get_template('plot.tex')
# 
#         self.width = width
#         self.height = height
#         self.xmode, self.ymode = self._get_axis_modes(axis)
#         self.font_options = font_options
#         self.external_filename = None
# 
#         super(Plot, self).__init__()
# 
#     def render(self, template=None):
#         """Render the plot using a template.
# 
#         Once the plot is complete, it needs to be rendered.  Artist uses
#         the Jinja2 templating engine.  The default template results in a
#         LaTeX file which can be included in your document.
# 
#         :param template: a user-supplied template or None.
#         :type template: string or None.
#         :returns: the rendered template as string.
# 
#         """
#         if not template:
#             template = self.template
# 
#         self._prepare_data()
# 
#         response = template.render(
#             axis_background=self.axis_background,
#             xmode=self.xmode,
#             ymode=self.ymode,
#             title=self.title,
#             width=self.width,
#             height=self.height,
#             xlabel=self.xlabel,
#             ylabel=self.ylabel,
#             limits=self.limits,
#             xscale=self.xscale,
#             yscale=self.yscale,
#             ticks=self.ticks,
#             axis_equal=self.axis_equal,
#             scalebar=self.scalebar,
#             colorbar=self.colorbar,
#             colormap=self.colormap,
#             external_filename=self.external_filename,
#             font_options=self.font_options,
#             axis_options=self.axis_options,
#             has_graph_paper=self.has_graph_paper,
#             plot=self,
#             plot_template=self.template)
#         return response


# Path: demo/demo_relative_pin.py
from numpy import linspace, pi, sin, cos
from artist import Plot

    y = r * sin(phi)
    plot.plot(x, y, mark=None)
    plot.add_pin('start', relative_position=0, use_arrow=True)
    plot.add_pin('half', relative_position=.5, use_arrow=True)
    plot.add_pin('46\%', relative_position=.46, use_arrow=True,
                 location='above')
    plot.add_pin('end', relative_position=1, use_arrow=True, location='below')

    phi = linspace(0, 2 * pi, 10)
    x = 6 * cos(phi)
    y = 6 * sin(phi)
    plot.plot(x, y, mark=None, linestyle='thick, gray')
    plot.add_pin('start', relative_position=0, use_arrow=True,
                 location='above right')
    plot.add_pin('half', relative_position=.5, use_arrow=True,
                 location='above left')
    plot.add_pin('70\%', relative_position=.7, use_arrow=True,
                 location='below')
    plot.add_pin('end', relative_position=1, use_arrow=True,
                 location='below right')

    plot.plot([-5, 2, 5], [-7.5, -7.5, -7.5], linestyle='lightgray')
    plot.add_pin('50\%', relative_position=.5, use_arrow=True,
                 location='above right')

    plot.set_xlimits(-8, 8)
    plot.set_ylimits(-8, 8)
    plot.save('relative_pin')

    # With one logarithmic axis

    plot = Plot(axis='semilogy')