pyg.twod.
pyg2d
(env=’plot’, polar=False, colors=’purdue’)[source]¶Bases: object
A pyg.pyg2d
object plots many two-dimensional data types.
The pyg2d
class provides an access to matplotlib
charting functions
and some hook ins to making these functions easier to use and more
repeatable. The constructor itself takes only one optional argument,
env
.
Todo
Add more color schemes and the ability to define and hook in color schemes manually.
Parameters: |
|
---|---|
Returns: | the |
Return type: |
|
add_arrow
(x1, x2, y1, y2, string=”, axes=None, fc=‘0.5’, alpha=1.0, ha=’center’, va=’center’, arrowprops=None)[source]¶add_data_pointer
(x, curve=None, point=None, string=None, place=’up-right’, ha=’left’, axes=None, latex=True, fc=‘0.3’)[source]¶add_hline
(y, xmin=None, xmax=None, ls=’solid’, lw=1.5, color=’black’, axes=None)[source]¶pyg2d.add_hline
draws a horizontal line.
pyg2d.add_hline
draws a horizontal line from either the left axis
to the right axis if xmin
and xmax
are not provided, otherwise
it is drawn from xmin
to xmax
at y
. Be careful not to
change from linear to log scale AFTER using this function, as
and this means the line will extend past the extents of the latex page.
Parameters: |
|
---|---|
Returns: | None |
add_hmeasure
(x1, x2, y1, string=None, place=None, offset=0.01, axes=None, units=”, log=False)[source]¶add_line
(x, y, name=’plot’, xerr=None, yerr=None, linewidth=0.5, linestyle=None, linecolor=’black’, legend=True, axes=None, error_fill=False)[source]¶add_line_xx
(x, y, name=’plot’, xerr=None, yerr=None, linecolor=’black’, linewidth=0.5, linestyle=None, legend=True)[source]¶add_line_yy
(x, y, name=’plot’, xerr=None, yerr=None, linecolor=’black’, linewidth=0.5, linestyle=None, legend=True, axes=None)[source]¶add_subplot
(subp=121, polar=False)[source]¶pyg2d.add_subplot
adds a grid in which you can make subplots.
pyg2d.add_subplot
follows Matlab’s lead and allows you to plot
several axes on one plot. The newly created axes is saved as
pyg2d.ax2
- this should be expanded for more axes later.
Todo
Expand subplotting to be able to use more than two axes total.
Parameters: | subp (int) – If kwarg subp is not defined, the
default is to add a second plot in a 1x2 array. When subp is
defined, it will follow that system (i.e. subp=234 means you
have two rows and three columns and you are plotting in the 4th
postition (2,1) ). |
---|---|
Returns: | None |
add_text
(x1, y1, string=None, ha=’center’, va=’center’, color=’#746C66’, rotation=0, axes=None, fontsize=None)[source]¶add_vline
(x, ymin=None, ymax=None, ls=’solid’, lw=1.5, color=’black’, name=None, axes=None)[source]¶pyg2d.add_vline
draws a vertical line.
pyg2d.add_vline
draws a vertical line from either the bottom axis
to the top axis if ymin
and ymax
are not provided, otherwise
it is drawn from ymin
to ymax
at x
. Be careful not to
change from linear to log scale AFTER using this function, as
and this means the line will extend past the extents of the latex page.
Todo
Fix the latex page extents problem with \(-\infty\)
Parameters: |
|
---|---|
Returns: | None |
add_vmeasure
(x1, y1, y2, string=None, place=None, offset=0.01, axes=None, units=”, log=False)[source]¶export
(filename, sizes=None, formats=None, customsize=None, legloc=None, tight=True, ratio=’golden’, width=None, caption=”, force_pdf=False, force=False)[source]¶fill_between
(x, y1, y2=None, fc=’red’, name=’plot’, ec=’None’, leg=True, axes=None, alpha=0.5, xmin=None, xmax=None, log=False)[source]¶fit_lines_on
()[source]¶pyg2d.fit_lines_on
turns on the connector lines for anyReturns: | None |
---|
fit_markers_off
()[source]¶pyg2d.fit_markers_off
turns off the data markers for anyReturns: | None |
---|
instances
= [<weakproxy at 0x2acb1e311418 to NoneType at 0x8fd4d0>]¶leg_col_full_page
= 4¶leg_col_one_col
= 2¶leg_col_two_col
= 3¶legend
(loc=1, exclude=’saljfdaljdfaslkjfd’, axes=None)[source]¶pyg2d.legend
shows the legend on the plot.
pyg2d.legend
toggles the legend showing on. This is done by getting
the included objects and titles from the matplotlib
axis item, and
then checking to see if there is the word ‘connector’ in that title. If
there is that word, then the entry is discarded.
Parameters: | |
---|---|
Returns: | None |
linestyle
= {0: ‘-‘, 1: ‘–’, 2: ‘-.’, 3: ‘:’}¶marker
= {0: ‘+’, 1: ‘.’, 2: ‘1’, 3: ‘2’, 4: ‘3’, 5: ‘4’}¶set_size
(size, sizeofsizes, customsize=None, legloc=None, tight=True, ratio=’golden’, width=None)[source]¶sizestring
= {‘1’: ‘onecolumn’, ‘fp’: ‘fullpage’, ‘none’: ”, ‘2’: ‘twocolumn’, ‘cs’: ‘customsize’}¶title
(title, axes=None)[source]¶pyg2d.title
adds a title to the plot.
Parameters: | title (str) – the title to be added to the plot. The title can take LaTeX arguments. |
---|---|
Returns: | None |
xlabel
(label, axes=None)[source]¶pyg2d.xlabel
adds a label to the x-axis.
pyg2d.xlabel
adds a label to the x-axis of the current axes (or
other axis given by kwarg axes
).
Parameters: |
|
---|---|
Returns: | None |
xlim
(minx, maxx, axes=None)[source]¶pyg2d.xlim
limits the view of the x-axis to limits.
Parameters: | |
---|---|
Returns: | None |
xticks
(ticks, labels, axes=None)[source]¶pyg2d.xticks
changes the ticks and labels to provided values.
pyg2d.xticks
will move the ticks on the abscissa to the
locations given in ticks
and place the labels in list labels
at
those locations, repsectively.
Parameters: |
|
---|---|
Returns: | None |
ylabel
(label, axes=None)[source]¶pyg2d.ylabel
adds a label to the y-axis.
pyg2d.ylabel
adds a label to the y-axis of the current axes (or
other axis given by kwarg axes
). The label can take LaTeX
arguments and the ah style guide asks for labels given as ‘Label
($variable$) [$unit$]’.
Parameters: |
|
---|---|
Returns: | None |
ylim
(miny, maxy, axes=None)[source]¶pyg2d.ylim
limits the view of the y-axis to limits.
Parameters: | |
---|---|
Returns: | None |
yticks
(ticks, labels, axes=None)[source]¶pyg2d.yticks
changes the ticks and labels to provided values.
pyg2d.yticks
will move the ticks on the ordinate axis to the
locations given in ticks
and place the labels in list labels
at
those locations, repsectively.
Parameters: |
|
---|---|
Returns: | None |