Public Member Functions | |
def | __init__ |
def | __repr__ |
def | SVG |
Public Attributes | |
axis_attr | |
d | |
flipx | |
flipy | |
height | |
last_window | |
minusInfinity | |
text_attr | |
width | |
x | |
x2labels | |
xlabels | |
xlogbase | |
xminiticks | |
xticks | |
xtitle | |
y | |
y2labels | |
ylabels | |
ylogbase | |
ymax | |
yminiticks | |
yticks | |
ytitle | |
Static Public Attributes | |
dictionary | axis_defaults = {} |
float | minitick_length = 0.75 |
dictionary | text_defaults = {"stroke":"none", "fill":"black", "font-size":5} |
int | text_xaxis_offset = 1 |
int | text_xtitle_offset = 6 |
int | text_yaxis_offset = 2 |
int | text_ytitle_offset = 12 |
float | tick_length = 1.5 |
def svgfig::Frame::__init__ | ( | self, | |
xmin, | |||
xmax, | |||
ymin, | |||
ymax, | |||
d, | |||
kwds | |||
) |
Acts like Fig, but draws a coordinate frame around the data. You also need to supply plot ranges. Frame(xmin, xmax, ymin, ymax, obj, obj, obj..., keyword options...) xmin, xmax required minimum and maximum x values (in the objs' coordinates) ymin, ymax required minimum and maximum y values (in the objs' coordinates) obj optional list drawing primatives keyword options keyword list options defined below The following are keyword options, with their default values: x, y 20, 5 upper-left corner of the Frame in SVG coordinates width, height 75, 80 width and height of the Frame in SVG coordinates flipx, flipy False, True flip the sign of the coordinate axis minusInfinity -1000 if an axis is logarithmic and an object is plotted at 0 or a negative value, -1000 will be used as a stand-in for NaN xtitle None if a string, label the x axis xticks -10 request ticks according to the standard tick specification (see help(Ticks)) xminiticks True request miniticks according to the standard minitick specification xlabels True request tick labels according to the standard tick label specification xlogbase None if a number, the axis and transformation are logarithmic with ticks at the given base (10 being the most common) (same for y) text_attr {} a dictionary of attributes for label text axis_attr {} a dictionary of attributes for the axis lines
Definition at line 886 of file svgfig.py.
00887 : 00888 """Acts like Fig, but draws a coordinate frame around the data. You also need to supply plot ranges. 00889 00890 Frame(xmin, xmax, ymin, ymax, obj, obj, obj..., keyword options...) 00891 00892 xmin, xmax required minimum and maximum x values (in the objs' coordinates) 00893 ymin, ymax required minimum and maximum y values (in the objs' coordinates) 00894 obj optional list drawing primatives 00895 keyword options keyword list options defined below 00896 00897 The following are keyword options, with their default values: 00898 00899 x, y 20, 5 upper-left corner of the Frame in SVG coordinates 00900 width, height 75, 80 width and height of the Frame in SVG coordinates 00901 flipx, flipy False, True flip the sign of the coordinate axis 00902 minusInfinity -1000 if an axis is logarithmic and an object is plotted at 0 or 00903 a negative value, -1000 will be used as a stand-in for NaN 00904 xtitle None if a string, label the x axis 00905 xticks -10 request ticks according to the standard tick specification 00906 (see help(Ticks)) 00907 xminiticks True request miniticks according to the standard minitick 00908 specification 00909 xlabels True request tick labels according to the standard tick label 00910 specification 00911 xlogbase None if a number, the axis and transformation are logarithmic 00912 with ticks at the given base (10 being the most common) 00913 (same for y) 00914 text_attr {} a dictionary of attributes for label text 00915 axis_attr {} a dictionary of attributes for the axis lines 00916 """ 00917 00918 self.xmin, self.xmax, self.ymin, self.ymax = xmin, xmax, ymin, ymax 00919 self.d = list(d) 00920 defaults = {"x":20, "y":5, "width":75, "height":80, "flipx":False, "flipy":True, "minusInfinity":-1000, \ 00921 "xtitle":None, "xticks":-10, "xminiticks":True, "xlabels":True, "x2labels":None, "xlogbase":None, \ 00922 "ytitle":None, "yticks":-10, "yminiticks":True, "ylabels":True, "y2labels":None, "ylogbase":None, \ 00923 "text_attr":{}, "axis_attr":{}} 00924 defaults.update(kwds) 00925 kwds = defaults 00926 00927 self.x = kwds["x"]; del kwds["x"] 00928 self.y = kwds["y"]; del kwds["y"] 00929 self.width = kwds["width"]; del kwds["width"] 00930 self.height = kwds["height"]; del kwds["height"] 00931 self.flipx = kwds["flipx"]; del kwds["flipx"] 00932 self.flipy = kwds["flipy"]; del kwds["flipy"] 00933 self.minusInfinity = kwds["minusInfinity"]; del kwds["minusInfinity"] 00934 self.xtitle = kwds["xtitle"]; del kwds["xtitle"] 00935 self.xticks = kwds["xticks"]; del kwds["xticks"] 00936 self.xminiticks = kwds["xminiticks"]; del kwds["xminiticks"] 00937 self.xlabels = kwds["xlabels"]; del kwds["xlabels"] 00938 self.x2labels = kwds["x2labels"]; del kwds["x2labels"] 00939 self.xlogbase = kwds["xlogbase"]; del kwds["xlogbase"] 00940 self.ytitle = kwds["ytitle"]; del kwds["ytitle"] 00941 self.yticks = kwds["yticks"]; del kwds["yticks"] 00942 self.yminiticks = kwds["yminiticks"]; del kwds["yminiticks"] 00943 self.ylabels = kwds["ylabels"]; del kwds["ylabels"] 00944 self.y2labels = kwds["y2labels"]; del kwds["y2labels"] 00945 self.ylogbase = kwds["ylogbase"]; del kwds["ylogbase"] 00946 00947 self.text_attr = dict(self.text_defaults) 00948 self.text_attr.update(kwds["text_attr"]); del kwds["text_attr"] 00949 00950 self.axis_attr = dict(self.axis_defaults) 00951 self.axis_attr.update(kwds["axis_attr"]); del kwds["axis_attr"] 00952 00953 if len(kwds) != 0: 00954 raise TypeError, "Frame() got unexpected keyword arguments %s" % kwds.keys()
def svgfig::Frame::__repr__ | ( | self | ) |
def svgfig::Frame::SVG | ( | self | ) |
Apply the window transformation and return an SVG object.
Definition at line 955 of file svgfig.py.
00956 : 00957 """Apply the window transformation and return an SVG object.""" 00958 00959 self.last_window = window(self.xmin, self.xmax, self.ymin, self.ymax, x=self.x, y=self.y, width=self.width, height=self.height, \ 00960 xlogbase=self.xlogbase, ylogbase=self.ylogbase, minusInfinity=self.minusInfinity, flipx=self.flipx, flipy=self.flipy) 00961 00962 left = YAxis(self.ymin, self.ymax, self.xmin, self.yticks, self.yminiticks, self.ylabels, self.ylogbase, None, None, None, self.text_attr, **self.axis_attr) 00963 right = YAxis(self.ymin, self.ymax, self.xmax, self.yticks, self.yminiticks, self.y2labels, self.ylogbase, None, None, None, self.text_attr, **self.axis_attr) 00964 bottom = XAxis(self.xmin, self.xmax, self.ymin, self.xticks, self.xminiticks, self.xlabels, self.xlogbase, None, None, None, self.text_attr, **self.axis_attr) 00965 top = XAxis(self.xmin, self.xmax, self.ymax, self.xticks, self.xminiticks, self.x2labels, self.xlogbase, None, None, None, self.text_attr, **self.axis_attr) 00966 00967 left.tick_start = -self.tick_length 00968 left.tick_end = 0 00969 left.minitick_start = -self.minitick_length 00970 left.minitick_end = 0. 00971 left.text_start = self.text_yaxis_offset 00972 00973 right.tick_start = 0. 00974 right.tick_end = self.tick_length 00975 right.minitick_start = 0. 00976 right.minitick_end = self.minitick_length 00977 right.text_start = -self.text_yaxis_offset 00978 right.text_attr["text-anchor"] = "start" 00979 00980 bottom.tick_start = 0. 00981 bottom.tick_end = self.tick_length 00982 bottom.minitick_start = 0. 00983 bottom.minitick_end = self.minitick_length 00984 bottom.text_start = -self.text_xaxis_offset 00985 00986 top.tick_start = -self.tick_length 00987 top.tick_end = 0. 00988 top.minitick_start = -self.minitick_length 00989 top.minitick_end = 0. 00990 top.text_start = self.text_xaxis_offset 00991 top.text_attr["dominant-baseline"] = "text-after-edge" 00992 00993 output = Fig(*self.d).SVG(self.last_window) 00994 output.prepend(left.SVG(self.last_window)) 00995 output.prepend(bottom.SVG(self.last_window)) 00996 output.prepend(right.SVG(self.last_window)) 00997 output.prepend(top.SVG(self.last_window)) 00998 00999 if self.xtitle != None: 01000 output.append(SVG("text", self.xtitle, transform="translate(%g, %g)" % ((self.x + self.width/2.), (self.y + self.height + self.text_xtitle_offset)), dominant_baseline="text-before-edge", **self.text_attr)) 01001 if self.ytitle != None: 01002 output.append(SVG("text", self.ytitle, transform="translate(%g, %g) rotate(-90)" % ((self.x - self.text_ytitle_offset), (self.y + self.height/2.)), **self.text_attr)) 01003 return output
dictionary svgfig::Frame::axis_defaults = {} [static] |
float svgfig::Frame::minitick_length = 0.75 [static] |
dictionary svgfig::Frame::text_defaults = {"stroke":"none", "fill":"black", "font-size":5} [static] |
int svgfig::Frame::text_xaxis_offset = 1 [static] |
int svgfig::Frame::text_xtitle_offset = 6 [static] |
int svgfig::Frame::text_yaxis_offset = 2 [static] |
int svgfig::Frame::text_ytitle_offset = 12 [static] |
float svgfig::Frame::tick_length = 1.5 [static] |