You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
1
(7) |
2
(14) |
3
(6) |
4
(8) |
5
(6) |
6
(3) |
7
(2) |
8
(22) |
9
(9) |
10
(23) |
11
(14) |
12
(22) |
13
(7) |
14
(3) |
15
(22) |
16
(13) |
17
(18) |
18
(21) |
19
(9) |
20
|
21
(3) |
22
(6) |
23
(5) |
24
|
25
|
26
(3) |
27
|
28
(1) |
29
(11) |
30
(1) |
31
(12) |
|
|
|
Revision: 6535 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6535&view=rev Author: jdh2358 Date: 2008年12月09日 12:27:51 +0000 (2008年12月09日) Log Message: ----------- removed extraneous savefig calls from examples Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/api/barchart_demo.py trunk/matplotlib/examples/api/histogram_demo.py trunk/matplotlib/examples/api/logo2.py trunk/matplotlib/examples/api/watermark_image.py trunk/matplotlib/examples/api/watermark_text.py trunk/matplotlib/examples/pylab_examples/agg_buffer_to_array.py trunk/matplotlib/examples/pylab_examples/alignment_test.py trunk/matplotlib/examples/pylab_examples/annotation_demo.py trunk/matplotlib/examples/pylab_examples/annotation_demo2.py trunk/matplotlib/examples/pylab_examples/arctest.py trunk/matplotlib/examples/pylab_examples/arrow_demo.py trunk/matplotlib/examples/pylab_examples/axes_demo.py trunk/matplotlib/examples/pylab_examples/axes_props.py trunk/matplotlib/examples/pylab_examples/barchart_demo.py trunk/matplotlib/examples/pylab_examples/barcode_demo.py trunk/matplotlib/examples/pylab_examples/boxplot_demo.py trunk/matplotlib/examples/pylab_examples/broken_barh.py trunk/matplotlib/examples/pylab_examples/contour_demo.py trunk/matplotlib/examples/pylab_examples/contour_image.py trunk/matplotlib/examples/pylab_examples/contourf_demo.py trunk/matplotlib/examples/pylab_examples/custom_figure_class.py trunk/matplotlib/examples/pylab_examples/customize_rc.py trunk/matplotlib/examples/pylab_examples/dannys_example.py trunk/matplotlib/examples/pylab_examples/dash_control.py trunk/matplotlib/examples/pylab_examples/dashpointlabel.py trunk/matplotlib/examples/pylab_examples/date_demo2.py trunk/matplotlib/examples/pylab_examples/date_demo_rrule.py trunk/matplotlib/examples/pylab_examples/ellipse_demo.py trunk/matplotlib/examples/pylab_examples/equal_aspect_ratio.py trunk/matplotlib/examples/pylab_examples/errorbar_demo.py trunk/matplotlib/examples/pylab_examples/figimage_demo.py trunk/matplotlib/examples/pylab_examples/figure_title.py trunk/matplotlib/examples/pylab_examples/fonts_demo.py trunk/matplotlib/examples/pylab_examples/fonts_demo_kw.py trunk/matplotlib/examples/pylab_examples/hline_demo.py trunk/matplotlib/examples/pylab_examples/image_demo2.py trunk/matplotlib/examples/pylab_examples/image_demo3.py trunk/matplotlib/examples/pylab_examples/image_interp.py trunk/matplotlib/examples/pylab_examples/image_origin.py trunk/matplotlib/examples/pylab_examples/integral_demo.py trunk/matplotlib/examples/pylab_examples/layer_images.py trunk/matplotlib/examples/pylab_examples/legend_demo.py trunk/matplotlib/examples/pylab_examples/legend_demo2.py trunk/matplotlib/examples/pylab_examples/legend_demo3.py trunk/matplotlib/examples/pylab_examples/logo.py trunk/matplotlib/examples/pylab_examples/manual_axis.py trunk/matplotlib/examples/pylab_examples/mathtext_demo.py trunk/matplotlib/examples/pylab_examples/matplotlib_icon.py trunk/matplotlib/examples/pylab_examples/mri_demo.py trunk/matplotlib/examples/pylab_examples/multiline.py trunk/matplotlib/examples/pylab_examples/multiple_figs_demo.py trunk/matplotlib/examples/pylab_examples/pcolor_demo.py trunk/matplotlib/examples/pylab_examples/pcolor_demo2.py trunk/matplotlib/examples/pylab_examples/pcolor_log.py trunk/matplotlib/examples/pylab_examples/polar_legend.py trunk/matplotlib/examples/pylab_examples/polar_scatter.py trunk/matplotlib/examples/pylab_examples/poormans_contour.py trunk/matplotlib/examples/pylab_examples/pstest.py trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py trunk/matplotlib/examples/pylab_examples/scatter_demo.py trunk/matplotlib/examples/pylab_examples/scatter_profile.py trunk/matplotlib/examples/pylab_examples/simple_plot_fps.py trunk/matplotlib/examples/pylab_examples/stock_demo.py trunk/matplotlib/examples/pylab_examples/symlog_demo.py trunk/matplotlib/examples/pylab_examples/table_demo.py trunk/matplotlib/examples/pylab_examples/tex_demo.py trunk/matplotlib/examples/pylab_examples/tex_unicode_demo.py trunk/matplotlib/examples/pylab_examples/text_themes.py trunk/matplotlib/examples/pylab_examples/toggle_images.py trunk/matplotlib/examples/pylab_examples/unicode_demo.py trunk/matplotlib/examples/pylab_examples/webapp_demo.py trunk/matplotlib/examples/tests/backend_driver.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/CHANGELOG 2008年12月09日 12:27:51 UTC (rev 6535) @@ -1,7 +1,7 @@ -2008年12月08日 Added mdehoon's native macosx backend from sf patch 2179017 +2008年12月08日 Added mdehoon's native macosx backend from sf patch 2179017 - JDH 2008年12月08日 Removed the prints in the set_*style commands. Return the - list of pprinted strings instead + list of pprinted strings instead - JDH 2008年12月08日 Some of the changes Michael made to improve the output of the property tables in the rest docs broke of made Modified: trunk/matplotlib/examples/api/barchart_demo.py =================================================================== --- trunk/matplotlib/examples/api/barchart_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/api/barchart_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -36,5 +36,5 @@ autolabel(rects1) autolabel(rects2) -#fig.savefig('barchart_demo') + plt.show() Modified: trunk/matplotlib/examples/api/histogram_demo.py =================================================================== --- trunk/matplotlib/examples/api/histogram_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/api/histogram_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -31,5 +31,4 @@ ax.set_ylim(0, 0.03) ax.grid(True) -#fig.savefig('histogram_demo',dpi=72) plt.show() Modified: trunk/matplotlib/examples/api/logo2.py =================================================================== --- trunk/matplotlib/examples/api/logo2.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/api/logo2.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -67,10 +67,10 @@ for line in ax.get_ygridlines() + ax.get_xgridlines(): line.set_lw(0.8) - line.set_alpha(0.9) + line.set_alpha(0.9) line.set_ls('-') line.set_color('0.5') - + ax.set_yticks(np.arange(1, 9, 2)) ax.set_rmax(9) @@ -78,7 +78,6 @@ main_axes = add_math_background() add_polar_bar() add_matplotlib_text(main_axes) - fig.savefig('logo2.png', facecolor=figcolor, edgecolor=figcolor, dpi=dpi) plt.show() Modified: trunk/matplotlib/examples/api/watermark_image.py =================================================================== --- trunk/matplotlib/examples/api/watermark_image.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/api/watermark_image.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -18,6 +18,4 @@ ax.grid() fig.figimage(im, 10, 10) -#fig.savefig('watermarked', transparent=True) - plt.show() Modified: trunk/matplotlib/examples/api/watermark_text.py =================================================================== --- trunk/matplotlib/examples/api/watermark_text.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/api/watermark_text.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -18,7 +18,4 @@ fontsize=50, color='gray', ha='right', va='bottom', alpha=0.5) -#fig.savefig('watermarked_text', transparent=True) - - plt.show() Modified: trunk/matplotlib/examples/pylab_examples/agg_buffer_to_array.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/agg_buffer_to_array.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/agg_buffer_to_array.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -20,5 +20,4 @@ fig2 = figure() ax2 = fig2.add_subplot(111, frameon=False) ax2.imshow(X) -fig2.savefig('simple.png') show() Modified: trunk/matplotlib/examples/pylab_examples/alignment_test.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/alignment_test.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/alignment_test.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -78,5 +78,5 @@ transform=ax.transAxes) axis('off') -#savefig('alignment_test', dpi=100) + show() Modified: trunk/matplotlib/examples/pylab_examples/annotation_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/annotation_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/annotation_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -82,7 +82,6 @@ horizontalalignment='right', verticalalignment='bottom', fontsize=20) - #fig.savefig('annotation_coords') if 1: # you can specify the xypoint and the xytext in different @@ -111,8 +110,8 @@ horizontalalignment='left', verticalalignment='bottom', ) - #fig.savefig('annotation_polar') + if 1: # You can also use polar notation on a catesian axes. Here the # native coordinate system ('data') is cartesian, so you need to @@ -138,9 +137,5 @@ ax.set_xlim(-20, 20) ax.set_ylim(-20, 20) - #fig.savefig('annotation_ellipse') - - -#fig.savefig('annotation_demo.png') show() Modified: trunk/matplotlib/examples/pylab_examples/annotation_demo2.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/annotation_demo2.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/annotation_demo2.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -72,9 +72,7 @@ - #fig.savefig('annotation_connection') - if 1: fig = figure(2) fig.clf() @@ -146,6 +144,4 @@ ) ) - #fig.savefig('annotation_arrowstyle') - show() Modified: trunk/matplotlib/examples/pylab_examples/arctest.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/arctest.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/arctest.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -13,6 +13,6 @@ l = plot(t1, f(t1), 'ro') setp(l, 'markersize', 30) setp(l, 'markerfacecolor', 'b') -#savefig('arctest', dpi=150) + show() Modified: trunk/matplotlib/examples/pylab_examples/arrow_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/arrow_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/arrow_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -308,6 +308,5 @@ normalize_data=scaled, head_starts_at_zero=True, size=size) draw() - #savefig('arrows.png') - #print 'Example saved to file "arrows.png"' + show() Modified: trunk/matplotlib/examples/pylab_examples/axes_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/axes_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/axes_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -28,6 +28,5 @@ title('Impulse response') setp(a, xlim=(0,.2), xticks=[], yticks=[]) -#savefig('../figures/axes_demo.eps') -#savefig('../figures/axes_demo.png') + show() Modified: trunk/matplotlib/examples/pylab_examples/axes_props.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/axes_props.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/axes_props.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -26,7 +26,7 @@ setp(xticklabels, 'color', 'r', fontsize='medium') -#savefig('axprops_demo') + show() @@ -57,7 +57,6 @@ label.set_color('r') label.set_fontsize('medium') -#savefig('axprops_demo') show() """ Modified: trunk/matplotlib/examples/pylab_examples/barchart_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/barchart_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/barchart_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -34,5 +34,5 @@ autolabel(rects1) autolabel(rects2) -#savefig('barchart_demo') + plt.show() Modified: trunk/matplotlib/examples/pylab_examples/barcode_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/barcode_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/barcode_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -21,6 +21,6 @@ ax = fig.add_axes([0.3, 0.1, 0.6, 0.1], **axprops) ax.imshow(x, **barprops) -#fig.savefig('barcode.png', dpi=100) + show() Modified: trunk/matplotlib/examples/pylab_examples/boxplot_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/boxplot_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/boxplot_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -15,32 +15,26 @@ # basic plot boxplot(data) -#savefig('box1') # notched plot figure() boxplot(data,1) -#savefig('box2') # change outlier point symbols figure() boxplot(data,0,'gD') -#savefig('box3') # don't show outlier points figure() boxplot(data,0,'') -#savefig('box4') # horizontal boxes figure() boxplot(data,0,'rs',0) -#savefig('box5') # change whisker length figure() boxplot(data,0,'rs',0,0.75) -#savefig('box6') # fake up some more data spread= rand(50) * 100 @@ -59,7 +53,6 @@ # multiple box plots on one figure figure() boxplot(data) -#savefig('box7') show() Modified: trunk/matplotlib/examples/pylab_examples/broken_barh.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/broken_barh.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/broken_barh.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -20,5 +20,4 @@ fontsize=16, horizontalalignment='right', verticalalignment='top') -#fig.savefig('broken_barh', dpi=100) plt.show() Modified: trunk/matplotlib/examples/pylab_examples/contour_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/contour_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/contour_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -101,5 +101,4 @@ CB.ax.set_position([ll, b+0.1*h, ww, h*0.8]) -#savefig('contour_demo') plt.show() Modified: trunk/matplotlib/examples/pylab_examples/contour_image.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/contour_image.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/contour_image.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -98,6 +98,5 @@ setp(gca(), ylim=ylim[::-1]) title("Image, origin from rc, reversed y-axis") colorbar(im) -#savefig('contour_image') show() Modified: trunk/matplotlib/examples/pylab_examples/contourf_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/contourf_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/contourf_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -76,6 +76,5 @@ clabel(CS4, fmt = '%2.1f', colors = 'w', fontsize=14) colorbar(CS3) -#savefig('contourf_demo') show() Modified: trunk/matplotlib/examples/pylab_examples/custom_figure_class.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/custom_figure_class.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/custom_figure_class.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -16,7 +16,6 @@ fig = figure(FigureClass=MyFigure, figtitle='my title') ax = fig.add_subplot(111) ax.plot([1,2,3]) -fig.savefig('test.png') -fig.savefig('test.ps') + show() Modified: trunk/matplotlib/examples/pylab_examples/customize_rc.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/customize_rc.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/customize_rc.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -1,4 +1,4 @@ -#!/usr/bin/env python + """ I'm not trying to make a good liking figure here, but just to show some examples of customizing rc params on the fly @@ -13,7 +13,7 @@ rc('tick', labelsize=15) # tick labels bigger rc('lines', lw=1, color='k') # thicker black lines (no budget for color!) rc('grid', c='0.5', ls='-', lw=0.5) # solid gray grid lines - rc('#savefig', dpi=300) # higher res outputs + rc('savefig', dpi=300) # higher res outputs @@ -22,7 +22,7 @@ >>> set_pub() >>> subplot(111) >>> plot([1,2,3]) ->>> #savefig('myfig') +>>> savefig('myfig') >>> rcdefaults() # restore the defaults """ Modified: trunk/matplotlib/examples/pylab_examples/dannys_example.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/dannys_example.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/dannys_example.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -56,5 +56,4 @@ pylab.text(0.2, 0.15, r'$\mathcal{F} = \int f\left( \phi, c \right) dV,$ \newline $ \frac{ \partial \phi } { \partial t } = -M_{ \phi } \frac{ \delta \mathcal{F} } { \delta \phi }$', {'color' : 'b', 'fontsize' : 20}) -pylab.savefig('pfm-lsm.png') pylab.show() Modified: trunk/matplotlib/examples/pylab_examples/dash_control.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/dash_control.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/dash_control.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -10,5 +10,5 @@ l, = plot(arange(20), '--') l.set_dashes(dashes) -savefig('dash_control') + show() Modified: trunk/matplotlib/examples/pylab_examples/dashpointlabel.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/dashpointlabel.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/dashpointlabel.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -35,7 +35,6 @@ ax.set_xlim((0.0, 5.0)) ax.set_ylim((0.0, 5.0)) -#if save: -# pylab.savefig('dashpointlabel') + pylab.show() Modified: trunk/matplotlib/examples/pylab_examples/date_demo2.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/date_demo2.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/date_demo2.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -43,5 +43,4 @@ fig.autofmt_xdate() -#fig.savefig('date_demo2') show() Modified: trunk/matplotlib/examples/pylab_examples/date_demo_rrule.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/date_demo_rrule.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/date_demo_rrule.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -28,5 +28,4 @@ labels = ax.get_xticklabels() setp(labels, rotation=30, fontsize=10) -savefig('date_demo_rrule') show() Modified: trunk/matplotlib/examples/pylab_examples/ellipse_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/ellipse_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/ellipse_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -17,7 +17,4 @@ ax.set_xlim(0, 10) ax.set_ylim(0, 10) -#fig.savefig('ellipse_demo.eps') -#fig.savefig('ellipse_demo.png') - show() Modified: trunk/matplotlib/examples/pylab_examples/equal_aspect_ratio.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/equal_aspect_ratio.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/equal_aspect_ratio.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -17,7 +17,4 @@ axes().set_aspect('equal', 'datalim') -#savefig('simple_plot.png') -savefig('equal_aspect') - show() Modified: trunk/matplotlib/examples/pylab_examples/errorbar_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/errorbar_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/errorbar_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -43,5 +43,4 @@ ax.set_yscale('log') errorbar(t, s+2, e, f, fmt='o') # both symmetric -#savefig('errorbar_demo') show() Modified: trunk/matplotlib/examples/pylab_examples/figimage_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/figimage_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/figimage_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -15,9 +15,6 @@ im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='lower') im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='lower') -#fig.savefig('figimage_demo.png') -#fig.savefig('figimage_demo.svg') -#fig.savefig('figimage_demo.pdf') plt.show() Modified: trunk/matplotlib/examples/pylab_examples/figure_title.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/figure_title.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/figure_title.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -25,6 +25,5 @@ title('subplot 2') ylabel('Undamped') -#savefig('figtext') show() Modified: trunk/matplotlib/examples/pylab_examples/fonts_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/fonts_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/fonts_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -111,5 +111,5 @@ **alignment) axis([-1,1,0,1]) -#savefig('fonts_demo') + show() Modified: trunk/matplotlib/examples/pylab_examples/fonts_demo_kw.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/fonts_demo_kw.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/fonts_demo_kw.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -80,5 +80,5 @@ **alignment) axis([-1, 1, 0, 1]) -#savefig('fonts_demo_kw') + show() Modified: trunk/matplotlib/examples/pylab_examples/hline_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/hline_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/hline_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -17,7 +17,7 @@ plt.hlines(t, [0], s, lw=2) plt.xlabel('time (s)') plt.title('Comparison of model with data') -plt.savefig('test') + plt.xlim(xmin=0) plt.show() Modified: trunk/matplotlib/examples/pylab_examples/image_demo2.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/image_demo2.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/image_demo2.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -28,6 +28,5 @@ ylabel('density') setp(gca(), 'xticklabels', []) -#savefig('image_demo2') show() Modified: trunk/matplotlib/examples/pylab_examples/image_demo3.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/image_demo3.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/image_demo3.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -14,6 +14,5 @@ ax.set_axis_off() im = imshow(lena, origin='lower') -#savefig('image_demo3') show() Modified: trunk/matplotlib/examples/pylab_examples/image_interp.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/image_interp.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/image_interp.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -50,17 +50,14 @@ A = rand(5,5) figure(1) imshow(A, interpolation='nearest') -savefig('agg_nearest') grid(True) figure(2) imshow(A, interpolation='bilinear') -savefig('agg_bilinear') grid(True) figure(3) imshow(A, interpolation='bicubic') -savefig('agg_bicubic') grid(True) show() Modified: trunk/matplotlib/examples/pylab_examples/image_origin.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/image_origin.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/image_origin.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -21,5 +21,4 @@ title('blue should be down') imshow(x, origin='lower', interpolation=interp) #axis(lim) -savefig('image_origin') show() Modified: trunk/matplotlib/examples/pylab_examples/integral_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/integral_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/integral_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -31,5 +31,4 @@ ax.set_xticks((a,b)) ax.set_xticklabels(('a','b')) ax.set_yticks([]) -#savefig('integral_demo') show() Modified: trunk/matplotlib/examples/pylab_examples/layer_images.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/layer_images.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/layer_images.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -38,11 +38,6 @@ extent=extent) #axis([xmin, xmax, ymin, ymax]) - -savefig('layer_images.png') -savefig('layer_images.svg') -savefig('layer_images.pdf') - show() Modified: trunk/matplotlib/examples/pylab_examples/legend_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/legend_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/legend_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -39,7 +39,6 @@ plt.setp(ltext, fontsize='small') # the legend text fontsize plt.setp(llines, linewidth=1.5) # the legend linewidth #leg.draw_frame(False) # don't draw the legend frame -#plt.savefig('legend_demo') plt.show() Modified: trunk/matplotlib/examples/pylab_examples/legend_demo2.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/legend_demo2.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/legend_demo2.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -17,7 +17,6 @@ xlabel('time') ylabel('volts') title('Damped oscillation') -#savefig('legend_demo2') #axis([0,2,-1,1]) show() Modified: trunk/matplotlib/examples/pylab_examples/legend_demo3.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/legend_demo3.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/legend_demo3.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -31,6 +31,5 @@ plt.draw() plt.show() -#plt.savefig("legend_demo3") Modified: trunk/matplotlib/examples/pylab_examples/logo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/logo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/logo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -20,5 +20,5 @@ axis([1, 1.72,-60, 10]) setp(gca(), 'xticklabels', []) setp(gca(), 'yticklabels', []) -#savefig('logo2.png', dpi=300) + show() Modified: trunk/matplotlib/examples/pylab_examples/manual_axis.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/manual_axis.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/manual_axis.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -52,6 +52,6 @@ ax.set_ylim(-1.5, 1.5) make_xaxis(ax, 0, offset=0.1, **props) make_yaxis(ax, 0, offset=5, **props) -#fig.savefig('manual_axis.png', dpi=100, facecolor='white', edgecolor='white') + show() Modified: trunk/matplotlib/examples/pylab_examples/mathtext_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/mathtext_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/mathtext_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -23,7 +23,7 @@ ax.legend([r"$\sqrt{x^2}$"]) ax.set_title(r'$\Delta_i^j \hspace{0.4} \mathrm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20) -fig.savefig('mathtext_demo') + show() Modified: trunk/matplotlib/examples/pylab_examples/matplotlib_icon.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/matplotlib_icon.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/matplotlib_icon.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -17,5 +17,5 @@ # grid(True) setp(gca(), xticklabels=[], yticklabels=[]) -savefig('matplotlib.svg', facecolor='0.75') +savefig('matplotlib', facecolor='0.75') Modified: trunk/matplotlib/examples/pylab_examples/mri_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/mri_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/mri_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -9,5 +9,5 @@ #imshow(im, ColormapJet(256)) imshow(im, cmap=cm.jet) axis('off') -#savefig('mri_demo') + show() Modified: trunk/matplotlib/examples/pylab_examples/multiline.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/multiline.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/multiline.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -10,6 +10,6 @@ horizontalalignment = 'center', verticalalignment = 'top', multialignment = 'center') -#savefig('multiline') + grid(True) show() Modified: trunk/matplotlib/examples/pylab_examples/multiple_figs_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/multiple_figs_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/multiple_figs_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -21,9 +21,9 @@ plot(t,s2, 'gs') setp(gca(), 'xticklabels', []) -#figure(1) -#savefig('fig1') -#figure(2) -#savefig('fig2') +figure(1) +savefig('fig1') +figure(2) +savefig('fig2') show() Modified: trunk/matplotlib/examples/pylab_examples/pcolor_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/pcolor_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/pcolor_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -22,7 +22,7 @@ pcolor(X, Y, Z) colorbar() axis([-3,3,-3,3]) -savefig('pcolor_demo') + show() Modified: trunk/matplotlib/examples/pylab_examples/pcolor_demo2.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/pcolor_demo2.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/pcolor_demo2.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -25,7 +25,7 @@ #im.set_interpolation('bicubic') im.set_interpolation('bilinear') #ax.set_image_extent(-3, 3, -3, 3) -#savefig('pcolor_demo2') + show() Modified: trunk/matplotlib/examples/pylab_examples/pcolor_log.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/pcolor_log.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/pcolor_log.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -24,4 +24,4 @@ show() -#savefig('pcolor_log.png') + Modified: trunk/matplotlib/examples/pylab_examples/polar_legend.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/polar_legend.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/polar_legend.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -17,5 +17,5 @@ ax.plot(theta, r, color='#ee8d18', lw=3, label='a line') ax.plot(0.5*theta, r, color='blue', ls='--', lw=3, label='another line') ax.legend() -fig.savefig('polar_legend') + show() Modified: trunk/matplotlib/examples/pylab_examples/polar_scatter.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/polar_scatter.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/polar_scatter.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -14,5 +14,5 @@ c = scatter(theta, r, c=colors, s=area) c.set_alpha(0.75) -#savefig('polar_test2') + show() Modified: trunk/matplotlib/examples/pylab_examples/poormans_contour.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/poormans_contour.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/poormans_contour.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -23,6 +23,6 @@ im = imshow(Z, cmap=cmap, interpolation='bilinear') axis('off') colorbar() -#savefig('test') + show() Modified: trunk/matplotlib/examples/pylab_examples/pstest.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/pstest.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/pstest.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -25,6 +25,6 @@ ylabel('Signal 2', fontsize=12) xlabel('time (s)', fontsize=12) -#savefig('pstest') + show() Modified: trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -42,5 +42,4 @@ ax.set_title('With masked values') -savefig("quadmesh_demo") show() Modified: trunk/matplotlib/examples/pylab_examples/scatter_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/scatter_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/scatter_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -6,6 +6,5 @@ y = 0.9*rand(N) area = pi*(10 * rand(N))**2 # 0 to 10 point radiuses scatter(x,y,s=area, marker='^', c='r') -savefig('test.ps') -savefig('test.pdf') + show() Modified: trunk/matplotlib/examples/pylab_examples/scatter_profile.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/scatter_profile.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/scatter_profile.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -19,5 +19,4 @@ y = 0.9*rand(N) s = 20*rand(N) scatter(x,y,s) - #savefig('scatter_demo') print '%d symbols in %1.2f s' % (N, time.time()-tstart) Modified: trunk/matplotlib/examples/pylab_examples/simple_plot_fps.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/simple_plot_fps.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/simple_plot_fps.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -17,9 +17,6 @@ title('About as simple as it gets, folks') grid(True) -#savefig('simple_plot.png') -#savefig('simple_plot') - import time frames = 100.0 Modified: trunk/matplotlib/examples/pylab_examples/stock_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/stock_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/stock_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -15,5 +15,5 @@ title('INTC vs AAPL') legend( ('INTC', 'AAPL') ) -#savefig('stock_demo') + show() Modified: trunk/matplotlib/examples/pylab_examples/symlog_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/symlog_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/symlog_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -25,5 +25,4 @@ grid(True) ylabel('symlog both') -savefig('symlog_demo') show() Modified: trunk/matplotlib/examples/pylab_examples/table_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/table_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/table_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -88,7 +88,5 @@ yticks(vals*1000, ['%d' % val for val in vals]) xticks([]) title('Loss by Disaster') -#savefig('table_demo_small', dpi=75) -#savefig('table_demo_large', dpi=300) show() Modified: trunk/matplotlib/examples/pylab_examples/tex_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/tex_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/tex_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -29,7 +29,5 @@ title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!", fontsize=16, color='r') grid(True) -savefig('tex_demo') - show() Modified: trunk/matplotlib/examples/pylab_examples/tex_unicode_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/tex_unicode_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/tex_unicode_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -22,7 +22,4 @@ title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!", fontsize=16, color='r') grid(True) -savefig('tex_demo') - - show() Modified: trunk/matplotlib/examples/pylab_examples/text_themes.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/text_themes.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/text_themes.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -21,5 +21,4 @@ xlabel('time (s)', font, style='italic') ylabel('voltage (mV)', font) -#savefig('text_themes') show() Modified: trunk/matplotlib/examples/pylab_examples/toggle_images.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/toggle_images.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/toggle_images.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -40,5 +40,5 @@ draw() connect('key_press_event', toggle_images) -#savefig('toggle_images') + show() Modified: trunk/matplotlib/examples/pylab_examples/unicode_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/unicode_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/unicode_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -9,5 +9,4 @@ text( 0.5, 2.5, u'Institut für Festkörperphysik', rotation=45) text( 1, 1.5, u'AVA (check kerning)') -savefig('test') show() Modified: trunk/matplotlib/examples/pylab_examples/webapp_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/webapp_demo.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/pylab_examples/webapp_demo.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -61,6 +61,6 @@ l.set_fontsize(12) canvas = FigureCanvasAgg(fig) - canvas.print_figure('webapp.png', dpi=150) + canvas.print_figure('webapp', dpi=150) make_fig() Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008年12月09日 10:23:53 UTC (rev 6534) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008年12月09日 12:27:51 UTC (rev 6535) @@ -123,7 +123,6 @@ 'legend_demo.py', 'legend_demo2.py', 'legend_demo3.py', - 'legend_demo3.py', 'legend_scatter.py', 'line_collection.py', 'line_collection2.py', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6534 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6534&view=rev Author: mmetz_bn Date: 2008年12月09日 10:23:53 +0000 (2008年12月09日) Log Message: ----------- typo in subplot docs Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年12月09日 04:39:50 UTC (rev 6533) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年12月09日 10:23:53 UTC (rev 6534) @@ -7163,7 +7163,7 @@ *args* is the tuple (*numRows*, *numCols*, *plotNum*), where the array of subplots in the figure has dimensions *numRows*, *numCols*, and where *plotNum* is the number of the subplot - being created. *plotNum* starts at 1 in the upper right + being created. *plotNum* starts at 1 in the upper left corner and increases to the right. If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6533 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6533&view=rev Author: jdh2358 Date: 2008年12月09日 04:39:50 +0000 (2008年12月09日) Log Message: ----------- fixed links in artist tut Modified Paths: -------------- trunk/matplotlib/doc/api/artist_api.rst trunk/matplotlib/doc/users/artists.rst trunk/matplotlib/doc/users/installing.rst Modified: trunk/matplotlib/doc/api/artist_api.rst =================================================================== --- trunk/matplotlib/doc/api/artist_api.rst 2008年12月09日 04:12:34 UTC (rev 6532) +++ trunk/matplotlib/doc/api/artist_api.rst 2008年12月09日 04:39:50 UTC (rev 6533) @@ -1,3 +1,5 @@ +.. _artist-api: + ******************* matplotlib artists ******************* Modified: trunk/matplotlib/doc/users/artists.rst =================================================================== --- trunk/matplotlib/doc/users/artists.rst 2008年12月09日 04:12:34 UTC (rev 6532) +++ trunk/matplotlib/doc/users/artists.rst 2008年12月09日 04:39:50 UTC (rev 6533) @@ -230,10 +230,8 @@ .. TODO: Update these URLs The docstrings for all of the classes also contain the ``Artist`` -properties, so you can consult the interactive "help", the online html -docs at http://matplotlib.sourceforge.net/classdocs.html or PDF documentation -at http://matplotlib.sourceforge.net/api.pdf for a listing of -properties for a give object. +properties, so you can consult the interactive "help" or the +:ref:`artist-api` for a listing of properties for a given object. .. _object-containers: Modified: trunk/matplotlib/doc/users/installing.rst =================================================================== --- trunk/matplotlib/doc/users/installing.rst 2008年12月09日 04:12:34 UTC (rev 6532) +++ trunk/matplotlib/doc/users/installing.rst 2008年12月09日 04:39:50 UTC (rev 6533) @@ -98,7 +98,7 @@ python setup.py install We provide a `setup.cfg -<http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/setup.cfg.template?view=markup>` +<http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/setup.cfg.template?view=markup>`_ file that lives along :file:`setup.py` which you can use to customize the build process, for example, which default backend to use, whether some of the optional libraries that matplotlib ships with are This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6532 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6532&view=rev Author: ryanmay Date: 2008年12月09日 04:12:34 +0000 (2008年12月09日) Log Message: ----------- Fix typo in docstring. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年12月09日 03:51:35 UTC (rev 6531) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年12月09日 04:12:34 UTC (rev 6532) @@ -5548,7 +5548,7 @@ fill_between(x, y1, y2=0, where=None, **kwargs) - Create a :class:`~matplotlib.collectionsPolyCollection` + Create a :class:`~matplotlib.collections.PolyCollection` filling the regions between *y1* and *y2* where ``where==True`` This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6531 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6531&view=rev Author: jdh2358 Date: 2008年12月09日 03:51:35 +0000 (2008年12月09日) Log Message: ----------- added mdehoon's native macosx patch Modified Paths: -------------- trunk/matplotlib/CHANGELOG Added Paths: ----------- trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py trunk/matplotlib/src/_macosx.m Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年12月09日 03:49:11 UTC (rev 6530) +++ trunk/matplotlib/CHANGELOG 2008年12月09日 03:51:35 UTC (rev 6531) @@ -1,4 +1,4 @@ -2008年12月08日 Added mdehoon's native maxosx backend from sf patch 2179017 +2008年12月08日 Added mdehoon's native macosx backend from sf patch 2179017 2008年12月08日 Removed the prints in the set_*style commands. Return the list of pprinted strings instead Added: trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py 2008年12月09日 03:51:35 UTC (rev 6531) @@ -0,0 +1,415 @@ +from __future__ import division + +import os +import numpy + +from matplotlib._pylab_helpers import Gcf +from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\ + FigureManagerBase, FigureCanvasBase, NavigationToolbar2 +from matplotlib.cbook import maxdict +from matplotlib.figure import Figure +from matplotlib.path import Path +from matplotlib.mathtext import MathTextParser + + + +from matplotlib.widgets import SubplotTool + +import matplotlib +from matplotlib.backends import _macosx + +def show(): + """Show all the figures and enter the Cocoa mainloop. + This function will not return until all windows are closed or + the interpreter exits.""" + # Having a Python-level function "show" wrapping the built-in + # function "show" in the _macosx extension module allows us to + # to add attributes to "show". This is something ipython does. + _macosx.show() + +class RendererMac(RendererBase): + """ + The renderer handles drawing/rendering operations. Most of the renderer's + methods forwards the command to the renderer's graphics context. The + renderer does not wrap a C object and is written in pure Python. + """ + + texd = maxdict(50) # a cache of tex image rasters + + def __init__(self, dpi, width, height): + RendererBase.__init__(self) + self.dpi = dpi + self.width = width + self.height = height + self.gc = GraphicsContextMac() + self.mathtext_parser = MathTextParser('MacOSX') + + def set_width_height (self, width, height): + self.width, self.height = width, height + + def draw_path(self, gc, path, transform, rgbFace=None): + path = transform.transform_path(path) + for points, code in path.iter_segments(): + if code == Path.MOVETO: + gc.moveto(points) + elif code == Path.LINETO: + gc.lineto(points) + elif code == Path.CURVE3: + gc.curve3(points) + elif code == Path.CURVE4: + gc.curve4(points) + elif code == Path.CLOSEPOLY: + gc.closepoly() + if rgbFace is not None: + rgbFace = tuple(rgbFace) + gc.stroke(rgbFace) + + def new_gc(self): + self.gc.reset() + return self.gc + + def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): + self.gc.set_clip_rectangle(bbox) + im.flipud_out() + nrows, ncols, data = im.as_rgba_str() + self.gc.draw_image(x, y, nrows, ncols, data) + im.flipud_out() + + def draw_tex(self, gc, x, y, s, prop, angle): + # todo, handle props, angle, origins + size = prop.get_size_in_points() + texmanager = self.get_texmanager() + key = s, size, self.dpi, angle, texmanager.get_font_config() + im = self.texd.get(key) # Not sure what this does; just copied from backend_agg.py + if im is None: + Z = texmanager.get_grey(s, size, self.dpi) + Z = numpy.array(255.0 - Z * 255.0, numpy.uint8) + + gc.draw_mathtext(x, y, angle, Z) + + def _draw_mathtext(self, gc, x, y, s, prop, angle): + size = prop.get_size_in_points() + ox, oy, width, height, descent, image, used_characters = \ + self.mathtext_parser.parse(s, self.dpi, prop) + gc.draw_mathtext(x, y, angle, 255 - image.as_array()) + + def draw_text(self, gc, x, y, s, prop, angle, ismath=False): + if ismath: + self._draw_mathtext(gc, x, y, s, prop, angle) + else: + family = prop.get_family() + size = prop.get_size_in_points() + weight = prop.get_weight() + style = prop.get_style() + gc.draw_text(x, y, unicode(s), family, size, weight, style, angle) + + def get_text_width_height_descent(self, s, prop, ismath): + if ismath=='TeX': + # TODO: handle props + size = prop.get_size_in_points() + texmanager = self.get_texmanager() + Z = texmanager.get_grey(s, size, self.dpi) + m,n = Z.shape + # TODO: handle descent; This is based on backend_agg.py + return n, m, 0 + if ismath: + ox, oy, width, height, descent, fonts, used_characters = \ + self.mathtext_parser.parse(s, self.dpi, prop) + return width, height, descent + family = prop.get_family() + size = prop.get_size_in_points() + weight = prop.get_weight() + style = prop.get_style() + return self.gc.get_text_width_height_descent(unicode(s), family, size, weight, style) + + def flipy(self): + return False + + def points_to_pixels(self, points): + return points/72.0 * self.dpi + + def option_image_nocomposite(self): + return True + +class GraphicsContextMac(_macosx.GraphicsContext, GraphicsContextBase): + """ + The GraphicsContext wraps a Quartz graphics context. All methods + are implemented at the C-level in macosx.GraphicsContext. These + methods set drawing properties such as the line style, fill color, + etc. The actual drawing is done by the Renderer, which draws into + the GraphicsContext. + """ + def __init__(self): + GraphicsContextBase.__init__(self) + _macosx.GraphicsContext.__init__(self) + + def set_clip_rectangle(self, box): + GraphicsContextBase.set_clip_rectangle(self, box) + if not box: return + _macosx.GraphicsContext.set_clip_rectangle(self, box.bounds) + + def set_clip_path(self, path): + GraphicsContextBase.set_clip_path(self, path) + if not path: return + path = path.get_fully_transformed_path() + for points, code in path.iter_segments(): + if code == Path.MOVETO: + self.moveto(points) + elif code == Path.LINETO: + self.lineto(points) + elif code == Path.CURVE3: + self.curve3(points) + elif code == Path.CURVE4: + self.curve4(points) + elif code == Path.CLOSEPOLY: + self.closepoly() + self.clip_path() + + +######################################################################## +# +# The following functions and classes are for pylab and implement +# window/figure managers, etc... +# +######################################################################## + +def draw_if_interactive(): + """ + For performance reasons, we don't want to redraw the figure after + each draw command. Instead, we mark the figure as invalid, so that + it will be redrawn as soon as the event loop resumes via PyOS_InputHook. + This function should be called after each draw event, even if + matplotlib is not running interactively. + """ + figManager = Gcf.get_active() + if figManager is not None: + figManager.canvas.invalidate() + +def new_figure_manager(num, *args, **kwargs): + """ + Create a new figure manager instance + """ + FigureClass = kwargs.pop('FigureClass', Figure) + figure = FigureClass(*args, **kwargs) + canvas = FigureCanvasMac(figure) + manager = FigureManagerMac(canvas, num) + return manager + +class FigureCanvasMac(_macosx.FigureCanvas, FigureCanvasBase): + """ + The canvas the figure renders into. Calls the draw and print fig + methods, creates the renderers, etc... + + Public attribute + + figure - A Figure instance + + Events such as button presses, mouse movements, and key presses + are handled in the C code and the base class methods + button_press_event, button_release_event, motion_notify_event, + key_press_event, and key_release_event are called from there. + """ + + def __init__(self, figure): + FigureCanvasBase.__init__(self, figure) + width, height = self.get_width_height() + self.renderer = RendererMac(figure.dpi, width, height) + _macosx.FigureCanvas.__init__(self, width, height) + + def resize(self, width, height): + self.renderer.set_width_height(width, height) + dpi = self.figure.dpi + width /= dpi + height /= dpi + self.figure.set_size_inches(width, height) + + def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w', + orientation='portrait', **kwargs): + if dpi is None: dpi = matplotlib.rcParams['savefig.dpi'] + filename = unicode(filename) + root, ext = os.path.splitext(filename) + ext = ext[1:].lower() + if not ext: + ext = "png" + filename = root + "." + ext + if ext=="jpg": ext = "jpeg" + + # save the figure settings + origfacecolor = self.figure.get_facecolor() + origedgecolor = self.figure.get_edgecolor() + + # set the new parameters + self.figure.set_facecolor(facecolor) + self.figure.set_edgecolor(edgecolor) + + if ext in ('jpeg', 'png', 'tiff', 'gif', 'bmp'): + width, height = self.figure.get_size_inches() + width, height = width*dpi, height*dpi + self.write_bitmap(filename, width, height) + elif ext == 'pdf': + self.write_pdf(filename) + elif ext in ('ps', 'eps'): + from backend_ps import FigureCanvasPS + # Postscript backend changes figure.dpi, but doesn't change it back + origDPI = self.figure.dpi + fc = self.switch_backends(FigureCanvasPS) + fc.print_figure(filename, dpi, facecolor, edgecolor, + orientation, **kwargs) + self.figure.dpi = origDPI + self.figure.set_canvas(self) + elif ext=='svg': + from backend_svg import FigureCanvasSVG + fc = self.switch_backends(FigureCanvasSVG) + fc.print_figure(filename, dpi, facecolor, edgecolor, + orientation, **kwargs) + self.figure.set_canvas(self) + else: + raise ValueError("Figure format not available (extension %s)" % ext) + + # restore original figure settings + self.figure.set_facecolor(origfacecolor) + self.figure.set_edgecolor(origedgecolor) + + + +class FigureManagerMac(_macosx.FigureManager, FigureManagerBase): + """ + Wrap everything up into a window for the pylab interface + """ + def __init__(self, canvas, num): + FigureManagerBase.__init__(self, canvas, num) + title = "Figure %d" % num + _macosx.FigureManager.__init__(self, canvas, title) + if matplotlib.rcParams['toolbar']=='classic': + self.toolbar = NavigationToolbarMac(canvas) + elif matplotlib.rcParams['toolbar']=='toolbar2': + self.toolbar = NavigationToolbar2Mac(canvas) + else: + self.toolbar = None + if self.toolbar is not None: + self.toolbar.update() + + def notify_axes_change(fig): + 'this will be called whenever the current axes is changed' + if self.toolbar != None: self.toolbar.update() + self.canvas.figure.add_axobserver(notify_axes_change) + + # This is ugly, but this is what tkagg and gtk are doing. + # It is needed to get ginput() working. + self.canvas.figure.show = lambda *args: self.show() + + def show(self): + self.canvas.draw() + + def close(self): + Gcf.destroy(self.num) + +class NavigationToolbarMac(_macosx.NavigationToolbar): + + def __init__(self, canvas): + self.canvas = canvas + basedir = os.path.join(matplotlib.rcParams['datapath'], "images") + images = {} + for imagename in ("stock_left", + "stock_right", + "stock_up", + "stock_down", + "stock_zoom-in", + "stock_zoom-out", + "stock_save_as"): + filename = os.path.join(basedir, imagename+".ppm") + images[imagename] = self._read_ppm_image(filename) + _macosx.NavigationToolbar.__init__(self, images) + self.message = None + + def _read_ppm_image(self, filename): + data = "" + imagefile = open(filename) + for line in imagefile: + if "#" in line: + i = line.index("#") + line = line[:i] + "\n" + data += line + imagefile.close() + magic, width, height, maxcolor, imagedata = data.split(None, 4) + width, height = int(width), int(height) + assert magic=="P6" + assert len(imagedata)==width*height*3 # 3 colors in RGB + return (width, height, imagedata) + + def panx(self, direction): + axes = self.canvas.figure.axes + selected = self.get_active() + for i in selected: + axes[i].xaxis.pan(direction) + self.canvas.invalidate() + + def pany(self, direction): + axes = self.canvas.figure.axes + selected = self.get_active() + for i in selected: + axes[i].yaxis.pan(direction) + self.canvas.invalidate() + + def zoomx(self, direction): + axes = self.canvas.figure.axes + selected = self.get_active() + for i in selected: + axes[i].xaxis.zoom(direction) + self.canvas.invalidate() + + def zoomy(self, direction): + axes = self.canvas.figure.axes + selected = self.get_active() + for i in selected: + axes[i].yaxis.zoom(direction) + self.canvas.invalidate() + + def save_figure(self): + filename = _macosx.choose_save_file('Save the figure') + if filename is None: # Cancel + return + self.canvas.print_figure(filename) + +class NavigationToolbar2Mac(_macosx.NavigationToolbar2, NavigationToolbar2): + + def __init__(self, canvas): + NavigationToolbar2.__init__(self, canvas) + + def _init_toolbar(self): + basedir = os.path.join(matplotlib.rcParams['datapath'], "images") + _macosx.NavigationToolbar2.__init__(self, basedir) + + def draw_rubberband(self, event, x0, y0, x1, y1): + self.canvas.set_rubberband(x0, y0, x1, y1) + + def release(self, event): + self.canvas.remove_rubberband() + + def set_cursor(self, cursor): + _macosx.set_cursor(cursor) + + def save_figure(self): + filename = _macosx.choose_save_file('Save the figure') + if filename is None: # Cancel + return + self.canvas.print_figure(filename) + + def prepare_configure_subplots(self): + toolfig = Figure(figsize=(6,3)) + canvas = FigureCanvasMac(toolfig) + toolfig.subplots_adjust(top=0.9) + tool = SubplotTool(self.canvas.figure, toolfig) + return canvas + + def set_message(self, message): + _macosx.NavigationToolbar2.set_message(self, message.encode('utf-8')) + +######################################################################## +# +# Now just provide the standard names that backend.__init__ is expecting +# +######################################################################## + + +FigureManager = FigureManagerMac Added: trunk/matplotlib/src/_macosx.m =================================================================== --- trunk/matplotlib/src/_macosx.m (rev 0) +++ trunk/matplotlib/src/_macosx.m 2008年12月09日 03:51:35 UTC (rev 6531) @@ -0,0 +1,3773 @@ +#include <Cocoa/Cocoa.h> +#include <ApplicationServices/ApplicationServices.h> +#include <sys/socket.h> +#include <Python.h> +#include "numpy/arrayobject.h" + +static int nwin = 0; + + +/* Varius NSApplicationDefined event subtypes */ +#define STDIN_READY 0 +#define SIGINT_CALLED 1 +#define STOP_EVENT_LOOP 2 +#define WINDOW_CLOSING 3 + +/* -------------------------- Helper function ---------------------------- */ + +static void stdin_ready(CFReadStreamRef readStream, CFStreamEventType eventType, void* context) +{ + NSEvent* event = [NSEvent otherEventWithType: NSApplicationDefined + location: NSZeroPoint + modifierFlags: 0 + timestamp: 0.0 + windowNumber: 0 + context: nil + subtype: STDIN_READY + data1: 0 + data2: 0]; + [NSApp postEvent: event atStart: true]; +} + +static int sigint_fd = -1; + +static void _sigint_handler(int sig) +{ + const char c = 'i'; + write(sigint_fd, &c, 1); +} + +static void _callback(CFSocketRef s, + CFSocketCallBackType type, + CFDataRef address, + const void * data, + void *info) +{ + char c; + CFSocketNativeHandle handle = CFSocketGetNative(s); + read(handle, &c, 1); + NSEvent* event = [NSEvent otherEventWithType: NSApplicationDefined + location: NSZeroPoint + modifierFlags: 0 + timestamp: 0.0 + windowNumber: 0 + context: nil + subtype: SIGINT_CALLED + data1: 0 + data2: 0]; + [NSApp postEvent: event atStart: true]; +} + +static int wait_for_stdin(void) +{ + const UInt8 buffer[] = "/dev/fd/0"; + const CFIndex n = (CFIndex)strlen((char*)buffer); + CFRunLoopRef runloop = CFRunLoopGetCurrent(); + CFURLRef url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, + buffer, + n, + false); + CFReadStreamRef stream = CFReadStreamCreateWithFile(kCFAllocatorDefault, + url); + CFRelease(url); + + CFReadStreamOpen(stream); + if (!CFReadStreamHasBytesAvailable(stream)) + /* This is possible because of how PyOS_InputHook is called from Python */ + { + int error; + int interrupted = 0; + int channel[2]; + CFSocketRef sigint_socket = NULL; + PyOS_sighandler_t py_sigint_handler = NULL; + CFStreamClientContext clientContext = {0, NULL, NULL, NULL, NULL}; + CFReadStreamSetClient(stream, + kCFStreamEventHasBytesAvailable, + stdin_ready, + &clientContext); + CFReadStreamScheduleWithRunLoop(stream, runloop, kCFRunLoopCommonModes); + error = pipe(channel); + if (error==0) + { + fcntl(channel[1], F_SETFL, O_WRONLY | O_NONBLOCK); + + sigint_socket = CFSocketCreateWithNative(kCFAllocatorDefault, + channel[0], + kCFSocketReadCallBack, + _callback, + NULL); + if (sigint_socket) + { + CFRunLoopSourceRef source; + source = CFSocketCreateRunLoopSource(kCFAllocatorDefault, + sigint_socket, + 0); + CFRelease(sigint_socket); + if (source) + { + CFRunLoopAddSource(runloop, source, kCFRunLoopDefaultMode); + CFRelease(source); + sigint_fd = channel[1]; + py_sigint_handler = PyOS_setsig(SIGINT, _sigint_handler); + } + } + else + close(channel[0]); + } + + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + NSDate* date = [NSDate distantFuture]; + while (true) + { NSEvent* event = [NSApp nextEventMatchingMask: NSAnyEventMask + untilDate: date + inMode: NSDefaultRunLoopMode + dequeue: YES]; + if (!event) break; /* No windows open */ + if ([event type]==NSApplicationDefined) + { short subtype = [event subtype]; + if (subtype==STDIN_READY) break; + if (subtype==SIGINT_CALLED) + { interrupted = true; + break; + } + } + [NSApp sendEvent: event]; + } + [pool release]; + + if (py_sigint_handler) PyOS_setsig(SIGINT, py_sigint_handler); + CFReadStreamUnscheduleFromRunLoop(stream, + runloop, + kCFRunLoopCommonModes); + if (sigint_socket) CFSocketInvalidate(sigint_socket); + if (error==0) close(channel[1]); + if (interrupted) raise(SIGINT); + } + CFReadStreamClose(stream); + return 1; +} + +static char show__doc__[] = "Show all the figures and enter the main loop.\nThis function does not return until all Matplotlib windows are closed,\nand is normally not needed in interactive sessions."; + +/* ---------------------------- Cocoa classes ---------------------------- */ + + +@interface Window : NSWindow +{ PyObject* manager; +} +- (Window*)initWithContentRect:(NSRect)rect styleMask:(unsigned int)mask backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation withManager: (PyObject*)theManager; +- (BOOL)closeButtonPressed; +- (void)close; +- (void)dealloc; +@end + +@interface ToolWindow : NSWindow +{ +} +- (ToolWindow*)initWithContentRect:(NSRect)rect master:(NSWindow*)window; +- (void)masterCloses:(NSNotification*)notification; +- (void)close; +@end + +@interface View : NSView +{ PyObject* canvas; + NSRect rubberband; +} +- (void)dealloc; +- (void)drawRect:(NSRect)rect; +- (void)windowDidResize:(NSNotification*)notification; +- (View*)initWithFrame:(NSRect)rect canvas:(PyObject*)fc; +- (BOOL)windowShouldClose:(NSNotification*)notification; +- (BOOL)isFlipped; +- (void)mouseDown:(NSEvent*)event; +- (void)mouseUp:(NSEvent*)event; +- (void)mouseDragged:(NSEvent*)event; +- (void)mouseMoved:(NSEvent*)event; +- (void)setRubberband:(NSRect)rect; +- (void)removeRubberband; +- (const char*)convertKeyEvent:(NSEvent*)event; +- (void)keyDown:(NSEvent*)event; +- (void)keyUp:(NSEvent*)event; +- (void)scrollWheel:(NSEvent *)event; +- (void)flagsChanged:(NSEvent*)event; +@end + +@interface ScrollableButton : NSButton +{ + SEL scrollWheelUpAction; + SEL scrollWheelDownAction; +} +- (void)setScrollWheelUpAction:(SEL)action; +- (void)setScrollWheelDownAction:(SEL)action; +- (void)scrollWheel:(NSEvent *)event; +@end + +@interface MenuItem: NSMenuItem +{ int index; +} ++ (MenuItem*)menuItemWithTitle:(NSString*)title; ++ (MenuItem*)menuItemSelectAll; ++ (MenuItem*)menuItemInvertAll; ++ (MenuItem*)menuItemForAxis:(int)i; +- (void)toggle:(id)sender; +- (void)selectAll:(id)sender; +- (void)invertAll:(id)sender; +- (int)index; +@end + +/* ---------------------------- Python classes ---------------------------- */ + +typedef struct { + PyObject_HEAD + CGContextRef cr; + PyObject* converter; /* Convert color specifications to r,g,b triples */ + CGPatternRef pattern; /* For drawing hatches */ + ATSUStyle style; /* For drawing Unicode strings with ATSUI */ + ATSUTextLayout layout; /* For drawing Unicode strings with ATSUI */ +} GraphicsContext; + +static PyObject* +GraphicsContext_new(PyTypeObject* type, PyObject *args, PyObject *kwds) +{ + OSStatus status; + + GraphicsContext* self = (GraphicsContext*)type->tp_alloc(type, 0); + if (!self) return NULL; + self->cr = NULL; + PyObject* module = PyImport_AddModule("matplotlib.colors"); + if (!module) return NULL; + PyObject* dict = PyObject_GetAttrString(module, "__dict__"); + if (!dict) return NULL; + PyObject* colorConverter = PyDict_GetItemString(dict, "colorConverter"); + Py_DECREF(dict); + if (!colorConverter) + { + PyErr_SetString(PyExc_KeyError, + "failed to find colorConverter in matplotlib.colors"); + return NULL; + } + self->converter = PyObject_GetAttrString(colorConverter, "to_rgb"); + if (!self->converter) return NULL; + + self->pattern = NULL; + + status = ATSUCreateStyle(&self->style); + if (status!=noErr) + { + Py_DECREF(self->converter); + PyErr_SetString(PyExc_RuntimeError, "ATSUCreateStyle failed"); + return NULL; + } + + status = ATSUCreateTextLayout(&self->layout); + if (status!=noErr) + { + Py_DECREF(self->converter); + status = ATSUDisposeStyle(self->style); + if (status!=noErr) + PyErr_WarnEx(PyExc_RuntimeWarning, "ATSUDisposeStyle failed", 1); + PyErr_SetString(PyExc_RuntimeError, "ATSUCreateTextLayout failed"); + return NULL; + } + + return (PyObject*) self; +} + +static void +GraphicsContext_dealloc(GraphicsContext *self) +{ + Py_DECREF(self->converter); + + if (self->pattern) CGPatternRelease(self->pattern); + + OSStatus status; + + status = ATSUDisposeStyle(self->style); + if (status!=noErr) + PyErr_WarnEx(PyExc_RuntimeWarning, "ATSUDisposeStyle failed", 1); + + status = ATSUDisposeTextLayout(self->layout); + if (status!=noErr) + PyErr_WarnEx(PyExc_RuntimeWarning, "ATSUDisposeTextLayout failed", 1); + + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject* +GraphicsContext_repr(GraphicsContext* self) +{ + return PyString_FromFormat("GraphicsContext object %p wrapping the Quartz 2D graphics context %p", self, self->cr); +} + +static PyObject* +GraphicsContext_reset (GraphicsContext* self) +{ + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + CGContextRestoreGState(cr); + CGContextSaveGState(cr); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_set_alpha (GraphicsContext* self, PyObject* args) +{ + float alpha; + if (!PyArg_ParseTuple(args, "f", &alpha)) return NULL; + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + CGContextSetAlpha(cr, alpha); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_set_antialiased (GraphicsContext* self, PyObject* args) +{ + int shouldAntialias; + if (!PyArg_ParseTuple(args, "i", &shouldAntialias)) return NULL; + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + CGContextSetShouldAntialias(cr, shouldAntialias); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_set_capstyle (GraphicsContext* self, PyObject* args) +{ + char* string; + CGLineCap cap; + + if (!PyArg_ParseTuple(args, "s", &string)) return NULL; + + if (!strcmp(string, "butt")) cap = kCGLineCapButt; + else if (!strcmp(string, "round")) cap = kCGLineCapRound; + else if (!strcmp(string, "projecting")) cap = kCGLineCapSquare; + else + { + PyErr_SetString(PyExc_ValueError, + "capstyle should be 'butt', 'round', or 'projecting'"); + return NULL; + } + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + CGContextSetLineCap(cr, cap); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_set_clip_rectangle (GraphicsContext* self, PyObject* args) +{ + CGRect rect; + float x, y, width, height; + if (!PyArg_ParseTuple(args, "(ffff)", &x, &y, &width, &height)) return NULL; + + rect.origin.x = x; + rect.origin.y = y; + rect.size.width = width; + rect.size.height = height; + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + CGContextClipToRect(cr, rect); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_clip_path (GraphicsContext* self) +{ + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + CGContextRestoreGState(cr); + CGContextSaveGState(cr); + CGContextClip(cr); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_set_dashes (GraphicsContext* self, PyObject* args) +{ + float phase = 0.0; + PyObject* offset; + PyObject* dashes; + + if (!PyArg_ParseTuple(args, "OO", &offset, &dashes)) return NULL; + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + if (offset!=Py_None) + { + if (PyFloat_Check(offset)) phase = PyFloat_AsDouble(offset); + else if (PyInt_Check(offset)) phase = PyInt_AsLong(offset); + else + { + PyErr_SetString(PyExc_TypeError, + "offset should be a floating point value"); + return NULL; + } + } + + if (dashes!=Py_None) + { + if (PyList_Check(dashes)) dashes = PyList_AsTuple(dashes); + else if (PyTuple_Check(dashes)) Py_INCREF(dashes); + else + { + PyErr_SetString(PyExc_TypeError, + "dashes should be a tuple or a list"); + return NULL; + } + int n = PyTuple_GET_SIZE(dashes); + int i; + float* lengths = malloc(n*sizeof(float)); + if(!lengths) + { + PyErr_SetString(PyExc_MemoryError, "Failed to store dashes"); + Py_DECREF(dashes); + return NULL; + } + for (i = 0; i < n; i++) + { + PyObject* value = PyTuple_GET_ITEM(dashes, i); + if (PyFloat_Check(value)) + lengths[i] = (float) PyFloat_AS_DOUBLE(value); + else if (PyInt_Check(value)) + lengths[i] = (float) PyInt_AS_LONG(value); + else break; + } + Py_DECREF(dashes); + if (i < n) /* break encountered */ + { + free(lengths); + PyErr_SetString(PyExc_TypeError, "Failed to read dashes"); + return NULL; + } + CGContextSetLineDash(cr, phase, lengths, n); + free(lengths); + } + else + CGContextSetLineDash(cr, phase, NULL, 0); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_set_foreground(GraphicsContext* self, PyObject* args, PyObject* keywords) +{ float r, g, b; + PyObject* fg; + int isRGB = 0; + static char* kwlist[] = {"fg", "isRGB", NULL}; + if(!PyArg_ParseTupleAndKeywords(args, keywords, "O|i", kwlist, + &fg, &isRGB)) return NULL; + if (isRGB) + { + if(!PyArg_ParseTuple(fg, "fff", &r, &g, &b)) return NULL; + } + else + { fg = PyObject_CallFunctionObjArgs(self->converter, fg, NULL); + if(!fg) return NULL; + if(!PyArg_ParseTuple(fg, "fff", &r, &g, &b)) return NULL; + Py_DECREF(fg); + } + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + CGContextSetRGBStrokeColor(cr, r, g, b, 1.0); + CGContextSetRGBFillColor(cr, r, g, b, 1.0); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_set_graylevel(GraphicsContext* self, PyObject* args) +{ float gray; + if(!PyArg_ParseTuple(args, "f", &gray)) return NULL; + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + CGContextSetGrayStrokeColor(cr, gray, 1.0); + CGContextSetGrayFillColor(cr, gray, 1.0); + Py_INCREF(Py_None); + return Py_None; +} + +static void drawHatch (void *info, CGContextRef cr) +{ + int i; + + PyObject* string = (PyObject*)info; + char* hatches = PyString_AS_STRING(string); + + int frequency[4] = {0, 0, 0, 0}; + float position, distance; + + const float size = 12.0; + const int n = strlen(hatches); + + for (i = 0; i < n; i++) + { + switch(hatches[i]) + { + case '/': frequency[3]++; break; + case '\\': frequency[2]++; break; + case '|': frequency[1]++; break; + case '-': frequency[0]++; break; + case '+': frequency[0]++; frequency[1]++; break; + case 'x': frequency[2]++; frequency[3]++; break; + } + } + + distance = size / frequency[0]; + position = distance / 2.0; + for (i = 0; i < frequency[0]; i++, position += distance) + { + CGContextMoveToPoint(cr, 0.0, position); + CGContextAddLineToPoint(cr, size, position); + } + distance = size / frequency[1]; + position = distance / 2.0; + for (i = 0; i < frequency[1]; i++, position += distance) + { + CGContextMoveToPoint(cr, position, 0.0); + CGContextAddLineToPoint(cr, position, size); + } + distance = size / frequency[2]; + position = distance / 2.0; + for (i = 0; i < frequency[2]; i++, position += distance) + { + CGContextMoveToPoint(cr, position, 0.0); + CGContextAddLineToPoint(cr, 0.0, position); + CGContextMoveToPoint(cr, position, size); + CGContextAddLineToPoint(cr, size, position); + } + distance = size / frequency[3]; + position = distance / 2.0; + for (i = 0; i < frequency[3]; i++, position += distance) + { + CGContextMoveToPoint(cr, position, 0.0); + CGContextAddLineToPoint(cr, size, size-position); + CGContextMoveToPoint(cr, position, size); + CGContextAddLineToPoint(cr, 0.0, size-position); + } + CGContextSetLineWidth(cr, 2.0); + CGContextSetLineCap(cr, kCGLineCapSquare); + CGContextStrokePath(cr); + + Py_DECREF(string); +} + +static PyObject* +GraphicsContext_set_hatch(GraphicsContext* self, PyObject* args) +{ PyObject* hatches; + + const float size = 12.0; + static const CGPatternCallbacks callbacks = {0, &drawHatch, NULL}; + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + if(!PyArg_ParseTuple(args, "O", &hatches)) return NULL; + if(!PyString_Check(hatches)) return NULL; + + Py_INCREF(hatches); + + CGColorSpaceRef baseSpace = CGColorSpaceCreateDeviceRGB(); + CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(baseSpace); + CGColorSpaceRelease(baseSpace); + CGContextSetFillColorSpace(cr, patternSpace); + CGColorSpaceRelease(patternSpace); + + self->pattern = CGPatternCreate((void*)hatches, + CGRectMake(0, 0, size, size), + CGAffineTransformIdentity, size, size, + kCGPatternTilingNoDistortion, + false, + &callbacks); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_set_linewidth (GraphicsContext* self, PyObject* args) +{ + float width; + if (!PyArg_ParseTuple(args, "f", &width)) return NULL; + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + CGContextSetLineWidth(cr, width); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_set_joinstyle(GraphicsContext* self, PyObject* args) +{ char* string; + CGLineJoin join; + + if (!PyArg_ParseTuple(args, "s", &string)) return NULL; + + if (!strcmp(string, "miter")) join = kCGLineJoinMiter; + else if (!strcmp(string, "round")) join = kCGLineJoinRound; + else if (!strcmp(string, "bevel")) join = kCGLineJoinBevel; + else + { + PyErr_SetString(PyExc_ValueError, + "joinstyle should be 'miter', 'round', or 'bevel'"); + return NULL; + } + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + CGContextSetLineJoin(cr, join); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_moveto(GraphicsContext* self, PyObject* args) +{ + float x; + float y; + + if(!PyArg_ParseTuple(args, "(ff)", &x, &y)) return NULL; + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + CGContextMoveToPoint(cr, x, y); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_lineto(GraphicsContext* self, PyObject* args) +{ + float x; + float y; + + if(!PyArg_ParseTuple(args, "(ff)", &x, &y)) return NULL; + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + CGContextAddLineToPoint(cr, x, y); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_curve3(GraphicsContext* self, PyObject* args) +{ + float cpx; + float cpy; + float x; + float y; + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + if(!PyArg_ParseTuple(args, "(ffff)", &cpx, + &cpy, + &x, + &y)) return NULL; + + CGContextAddQuadCurveToPoint(cr, cpx, cpy, x, y); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_curve4 (GraphicsContext* self, PyObject* args) +{ + float cp1x; + float cp1y; + float cp2x; + float cp2y; + float x; + float y; + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + if(!PyArg_ParseTuple(args, "(ffffff)", &cp1x, + &cp1y, + &cp2x, + &cp2y, + &x, + &y)) return NULL; + + CGContextAddCurveToPoint(cr, cp1x, cp1y, cp2x, cp2y, x, y); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_closepoly (GraphicsContext* self) +{ + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + CGContextClosePath(cr); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_stroke (GraphicsContext* self, PyObject* args) +{ + PyObject* color; + CGContextRef cr = self->cr; + + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + if(!PyArg_ParseTuple(args, "O", &color)) return NULL; + + if(color!=Py_None) + { + float r, g, b; + if(!PyArg_ParseTuple(color, "fff", &r, &g, &b)) return NULL; + if(self->pattern) + { + float components[4]; + components[0] = r; + components[1] = g; + components[2] = b; + components[3] = 1.0; + CGContextSetFillPattern(cr, self->pattern, components); + CGPatternRelease (self->pattern); + self->pattern = nil; + } + else CGContextSetRGBFillColor(cr, r, g, b, 1.0); + CGContextDrawPath(cr, kCGPathFillStroke); + } + else CGContextStrokePath(cr); + + Py_INCREF(Py_None); + return Py_None; +} + +static ATSFontRef +setfont(CGContextRef cr, PyObject* family, float size, const char weight[], + const char style[]) +{ +#define NMAP 40 +#define NFONT 31 + int i, j, n; + const char* temp; + const char* name = "Times-Roman"; + CFStringRef string; + ATSFontRef atsfont = 0; + + const int k = (strcmp(style, "italic") ? 0 : 2) + + (strcmp(weight, "bold") ? 0 : 1); + + struct {char* name; int index;} map[NMAP] = { + {"New Century Schoolbook", 0}, + {"Century Schoolbook L", 0}, + {"Utopia", 1}, + {"ITC Bookman", 2}, + {"Bookman", 2}, + {"Bitstream Vera Serif", 3}, + {"Nimbus Roman No9 L", 4}, + {"Times New Roman", 5}, + {"Times", 6}, + {"Palatino", 7}, + {"Charter", 8}, + {"serif", 0}, + {"Lucida Grande", 9}, + {"Verdana", 10}, + {"Geneva", 11}, + {"Lucida", 12}, + {"Bitstream Vera Sans", 13}, + {"Arial", 14}, + {"Helvetica", 15}, + {"Avant Garde", 16}, + {"sans-serif", 10}, + {"Apple Chancery", 17}, + {"Textile", 18}, + {"Zapf Chancery", 19}, + {"Sand", 20}, + {"cursive", 17}, + {"Comic Sans MS", 21}, + {"Chicago", 22}, + {"Charcoal", 23}, + {"Impact", 24}, + {"Western", 25}, + {"fantasy", 21}, + {"Andale Mono", 26}, + {"Bitstream Vera Sans Mono", 27}, + {"Nimbus Mono L", 28}, + {"Courier", 29}, + {"Courier New", 30}, + {"Fixed", 30}, + {"Terminal", 30}, + {"monospace", 30}, + }; + + const char* psnames[NFONT][4] = { + {"CenturySchoolbook", /* 0 */ + "CenturySchoolbook-Bold", + "CenturySchoolbook-Italic", + "CenturySchoolbook-BoldItalic"}, + {"Utopia", /* 1 */ + "Utopia-Bold", + "Utopia-Italic", + "Utopia-BoldItalic"}, + {"Bookman-Light", /* 2 */ + "Bookman-Bold", + "Bookman-LightItalic", + "Bookman-BoldItalic"}, + {"BitstreamVeraSerif-Roman", /* 3 */ + "BitstreamVeraSerif-Bold", + "", + ""}, + {"NimbusRomNo9L-Reg", /* 4 */ + "NimbusRomNo9T-Bol", + "NimbusRomNo9L-RegIta", + "NimbusRomNo9T-BolIta"}, + {"TimesNewRomanPSMT", /* 5 */ + "TimesNewRomanPS-BoldMT", + "TimesNewRomanPS-ItalicMT", + "TimesNewRomanPS-BoldItalicMT"}, + {"Times-Roman", /* 6 */ + "Times-Bold", + "Times-Italic", + "Times-BoldItalic"}, + {"Palatino-Roman", /* 7 */ + "Palatino-Bold", + "Palatino-Italic", + "Palatino-BoldItalic"}, + {"CharterBT-Roman", /* 8 */ + "CharterBT-Bold", + "CharterBT-Italic", + "CharterBT-BoldItalic"}, + {"LucidaGrande", /* 9 */ + "LucidaGrande-Bold", + "", + ""}, + {"Verdana", /* 10 */ + "Verdana-Bold", + "Verdana-Italic", + "Verdana-BoldItalic"}, + {"Geneva", /* 11 */ + "", + "", + ""}, + {"LucidaSans", /* 12 */ + "LucidaSans-Demi", + "LucidaSans-Italic", + "LucidaSans-DemiItalic"}, + {"BitstreamVeraSans-Roman", /* 13 */ + "BitstreamVeraSans-Bold", + "BitstreamVeraSans-Oblique", + "BitstreamVeraSans-BoldOblique"}, + {"ArialMT", /* 14 */ + "Arial-BoldMT", + "Arial-ItalicMT", + "Arial-BoldItalicMT"}, + {"Helvetica", /* 15 */ + "Helvetica-Bold", + "", + ""}, + {"AvantGardeITC-Book", /* 16 */ + "AvantGardeITC-Demi", + "AvantGardeITC-BookOblique", + "AvantGardeITC-DemiOblique"}, + {"Apple-Chancery", /* 17 */ + "", + "", + ""}, + {"TextileRegular", /* 18 */ + "", + "", + ""}, + {"ZapfChancery-Roman", /* 19 */ + "ZapfChancery-Bold", + "ZapfChancery-Italic", + "ZapfChancery-MediumItalic"}, + {"SandRegular", /* 20 */ + "", + "", + ""}, + {"ComicSansMS", /* 21 */ + "ComicSansMS-Bold", + "", + ""}, + {"Chicago", /* 22 */ + "", + "", + ""}, + {"Charcoal", /* 23 */ + "", + "", + ""}, + {"Impact", /* 24 */ + "", + "", + ""}, + {"Playbill", /* 25 */ + "", + "", + ""}, + {"AndaleMono", /* 26 */ + "", + "", + ""}, + {"BitstreamVeraSansMono-Roman", /* 27 */ + "BitstreamVeraSansMono-Bold", + "BitstreamVeraSansMono-Oblique", + "BitstreamVeraSansMono-BoldOb"}, + {"NimbusMonL-Reg", /* 28 */ + "NimbusMonL-Bol", + "NimbusMonL-RegObl", + "NimbusMonL-BolObl"}, + {"Courier", /* 29 */ + "Courier-Bold", + "", + ""}, + {"CourierNewPS", /* 30 */ + "CourierNewPS-BoldMT", + "CourierNewPS-ItalicMT", + "CourierNewPS-Bold-ItalicMT"}, + }; + + if(!PyList_Check(family)) return 0; + n = PyList_GET_SIZE(family); + + for (i = 0; i < n; i++) + { + PyObject* item = PyList_GET_ITEM(family, i); + if(!PyString_Check(item)) return 0; + temp = PyString_AS_STRING(item); + for (j = 0; j < NMAP; j++) + { if (!strcmp(map[j].name, temp)) + { temp = psnames[map[j].index][k]; + break; + } + } + /* If the font name is not found in mapping, we assume */ + /* that the user specified the Postscript name directly */ + + /* Check if this font can be found on the system */ + string = CFStringCreateWithCString(kCFAllocatorDefault, + temp, + kCFStringEncodingMacRoman); + atsfont = ATSFontFindFromPostScriptName(string, kATSOptionFlagsDefault); + CFRelease(string); + + if(atsfont) + { + name = temp; + break; + } + } + if(!atsfont) + { string = CFStringCreateWithCString(kCFAllocatorDefault, + name, + kCFStringEncodingMacRoman); + atsfont = ATSFontFindFromPostScriptName(string, kATSOptionFlagsDefault); + CFRelease(string); + } + CGContextSelectFont(cr, name, size, kCGEncodingMacRoman); + return atsfont; +} + +static PyObject* +GraphicsContext_draw_text (GraphicsContext* self, PyObject* args) +{ + float x; + float y; + const UniChar* text; + int n; + PyObject* family; + float size; + const char* weight; + const char* style; + float angle; + ATSFontRef atsfont; + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + if(!PyArg_ParseTuple(args, "ffu#Ofssf", + &x, + &y, + &text, + &n, + &family, + &size, + &weight, + &style, + &angle)) return NULL; + + atsfont = setfont(cr, family, size, weight, style); + + OSStatus status; + + ATSUAttributeTag tags[] = {kATSUFontTag, kATSUSizeTag, kATSUQDBoldfaceTag}; + ByteCount sizes[] = {sizeof(ATSUFontID), sizeof(Fixed), sizeof(Boolean)}; + Fixed atsuSize = Long2Fix(size); + Boolean isBold = FALSE; /* setfont takes care of this */ + + ATSUAttributeValuePtr values[] = {&atsfont, &atsuSize, &isBold}; + status = ATSUSetAttributes(self->style, 3, tags, sizes, values); + if (status!=noErr) + { + PyErr_SetString(PyExc_RuntimeError, "ATSUSetAttributes failed"); + return NULL; + } + + status = ATSUSetTextPointerLocation(self->layout, + text, + kATSUFromTextBeginning, // offset from beginning + kATSUToTextEnd, // length of text range + n); // length of text buffer + if (status!=noErr) + { + PyErr_SetString(PyExc_RuntimeError, + "ATSUCreateTextLayoutWithTextPtr failed"); + return NULL; + } + + status = ATSUSetRunStyle(self->layout, + self->style, + kATSUFromTextBeginning, + kATSUToTextEnd); + if (status!=noErr) + { + PyErr_SetString(PyExc_RuntimeError, "ATSUSetRunStyle failed"); + return NULL; + } + + Fixed atsuAngle = X2Fix(angle); + ATSUAttributeTag tags2[] = {kATSUCGContextTag, kATSULineRotationTag}; + ByteCount sizes2[] = {sizeof (CGContextRef), sizeof(Fixed)}; + ATSUAttributeValuePtr values2[] = {&cr, &atsuAngle}; + status = ATSUSetLayoutControls(self->layout, 2, tags2, sizes2, values2); + if (status!=noErr) + { + PyErr_SetString(PyExc_RuntimeError, "ATSUSetLayoutControls failed"); + return NULL; + } + + status = ATSUDrawText(self->layout, + kATSUFromTextBeginning, + kATSUToTextEnd, + X2Fix(x), + X2Fix(y)); + if (status!=noErr) + { + PyErr_SetString(PyExc_RuntimeError, "ATSUDrawText failed"); + return NULL; + } + + Py_INCREF(Py_None); + return Py_None; +} + +static void _data_provider_release(void* info, const void* data, size_t size) +{ + PyObject* image = (PyObject*)info; + Py_DECREF(image); +} + +static PyObject* +GraphicsContext_draw_mathtext(GraphicsContext* self, PyObject* args) +{ + float x, y, angle; + npy_intp nrows, ncols; + int n; + + PyObject* object; + PyArrayObject* image; + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + if(!PyArg_ParseTuple(args, "fffO", &x, &y, &angle, &object)) return NULL; + + /* ------------- Check the image ---------------------------- */ + if(!PyArray_Check (object)) + { + PyErr_SetString(PyExc_TypeError, "image should be a NumPy array."); + return NULL; + } + image = (PyArrayObject*) object; + if(PyArray_NDIM(image) != 2) + { + PyErr_Format(PyExc_TypeError, + "image has incorrect rank (%d expected 2)", + PyArray_NDIM(image)); + return NULL; + } + if (PyArray_TYPE(image) != NPY_UBYTE) + { + PyErr_SetString(PyExc_TypeError, + "image has incorrect type (should be uint8)"); + return NULL; + } + if (!PyArray_ISCONTIGUOUS(image)) + { + PyErr_SetString(PyExc_TypeError, "image array is not contiguous"); + return NULL; + } + + nrows = PyArray_DIM(image, 0); + ncols = PyArray_DIM(image, 1); + if (nrows != (int) nrows || ncols != (int) ncols) + { + PyErr_SetString(PyExc_RuntimeError, "bitmap image too large"); + return NULL; + } + n = nrows * ncols; + Py_INCREF(object); + + const size_t bytesPerComponent = 1; + const size_t bitsPerComponent = 8 * bytesPerComponent; + const size_t nComponents = 1; /* gray */ + const size_t bitsPerPixel = bitsPerComponent * nComponents; + const size_t bytesPerRow = nComponents * bytesPerComponent * ncols; + CGDataProviderRef provider = CGDataProviderCreateWithData(object, + PyArray_DATA(image), + n, + _data_provider_release); + CGImageRef bitmap = CGImageMaskCreate ((int) ncols, + (int) nrows, + bitsPerComponent, + bitsPerPixel, + bytesPerRow, + provider, + NULL, + false); + CGDataProviderRelease(provider); + + if(!bitmap) + { + PyErr_SetString(PyExc_RuntimeError, "CGImageMaskCreate failed"); + return NULL; + } + + if (angle==0.0) + { + CGContextDrawImage(cr, CGRectMake(x,y,ncols,nrows), bitmap); + } + else + { + CGContextSaveGState(cr); + CGContextTranslateCTM(cr, x, y); + CGContextRotateCTM(cr, angle*M_PI/180); + CGContextDrawImage(cr, CGRectMake(0,0,ncols,nrows), bitmap); + CGContextRestoreGState(cr); + } + CGImageRelease(bitmap); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +GraphicsContext_get_text_width_height_descent(GraphicsContext* self, PyObject* args) +{ + const UniChar* text; + int n; + PyObject* family; + float size; + const char* weight; + const char* style; + + ATSFontRef atsfont; + + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + if(!PyArg_ParseTuple(args, "u#Ofss", &text, &n, &family, &size, &weight, &style)) return NULL; + + atsfont = setfont(cr, family, size, weight, style); + + OSStatus status = noErr; + ATSUAttributeTag tags[] = {kATSUFontTag, + kATSUSizeTag, + kATSUQDBoldfaceTag, + kATSUQDItalicTag}; + ByteCount sizes[] = {sizeof(ATSUFontID), + sizeof(Fixed), + sizeof(Boolean), + sizeof(Boolean)}; + Fixed atsuSize = Long2Fix(size); + Boolean isBold = FALSE; /* setfont takes care of this */ + Boolean isItalic = FALSE; /* setfont takes care of this */ + ATSUAttributeValuePtr values[] = {&atsfont, &atsuSize, &isBold, &isItalic}; + + status = ATSUSetAttributes(self->style, 4, tags, sizes, values); + if (status!=noErr) + { + PyErr_SetString(PyExc_RuntimeError, "ATSUSetAttributes failed"); + return NULL; + } + + status = ATSUSetTextPointerLocation(self->layout, + text, + kATSUFromTextBeginning, // offset from beginning + kATSUToTextEnd, // length of text range + n); // length of text buffer + if (status!=noErr) + { + PyErr_SetString(PyExc_RuntimeError, + "ATSUCreateTextLayoutWithTextPtr failed"); + return NULL; + } + + status = ATSUSetRunStyle(self->layout, + self->style, + kATSUFromTextBeginning, + kATSUToTextEnd); + if (status!=noErr) + { + PyErr_SetString(PyExc_RuntimeError, "ATSUSetRunStyle failed"); + return NULL; + } + + ATSUAttributeTag tag = kATSUCGContextTag; + ByteCount bc = sizeof (CGContextRef); + ATSUAttributeValuePtr value = &cr; + status = ATSUSetLayoutControls(self->layout, 1, &tag, &bc, &value); + if (status!=noErr) + { + PyErr_SetString(PyExc_RuntimeError, "ATSUSetLayoutControls failed"); + return NULL; + } + + ATSUTextMeasurement before; + ATSUTextMeasurement after; + ATSUTextMeasurement ascent; + ATSUTextMeasurement descent; + status = ATSUGetUnjustifiedBounds(self->layout, + kATSUFromTextBeginning, kATSUToTextEnd, + &before, &after, &ascent, &descent); + if (status!=noErr) + { + PyErr_SetString(PyExc_RuntimeError, "ATSUGetUnjustifiedBounds failed"); + return NULL; + } + + const float width = FixedToFloat(after-before); + const float height = FixedToFloat(ascent-descent); + + return Py_BuildValue("fff", width, height, FixedToFloat(descent)); +} + +static PyObject* +GraphicsContext_draw_image(GraphicsContext* self, PyObject* args) +{ + float x, y; + int nrows, ncols; + const char* data; + int n; + PyObject* image; + CGContextRef cr = self->cr; + if (!cr) + { + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; + } + + if(!PyArg_ParseTuple(args, "ffiiO", &x, + &y, + &nrows, + &ncols, + &image)) return NULL; + + if (!PyString_Check(image)) + { + PyErr_SetString(PyExc_RuntimeError, "image is not a string"); + return NULL; + } + + const size_t bytesPerComponent = 1; + const size_t bitsPerComponent = 8 * bytesPerComponent; + const size_t nComponents = 4; /* red, green, blue, alpha */ + const size_t bitsPerPixel = bitsPerComponent * nComponents; + const size_t bytesPerRow = nComponents * bytesPerComponent * ncols; + CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); + + Py_INCREF(image); + n = PyString_GET_SIZE(image); + data = PyString_AsString(image); + + CGDataProviderRef provider = CGDataProviderCreateWithData(image, + data, + n, + _data_provider_release); + CGImageRef bitmap = CGImageCreate (ncols, + nrows, + bitsPerComponent, + bitsPerPixel, + bytesPerRow, + colorspace, + kCGImageAlphaLast, + provider, + ... [truncated message content]
Revision: 6530 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6530&view=rev Author: jdh2358 Date: 2008年12月09日 03:49:11 +0000 (2008年12月09日) Log Message: ----------- added mdehoon's native macosx patch Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/mathtext.py trunk/matplotlib/lib/matplotlib/rcsetup.py trunk/matplotlib/matplotlibrc.template trunk/matplotlib/setup.cfg.template trunk/matplotlib/setup.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年12月09日 03:37:16 UTC (rev 6529) +++ trunk/matplotlib/CHANGELOG 2008年12月09日 03:49:11 UTC (rev 6530) @@ -1,3 +1,5 @@ +2008年12月08日 Added mdehoon's native maxosx backend from sf patch 2179017 + 2008年12月08日 Removed the prints in the set_*style commands. Return the list of pprinted strings instead Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2008年12月09日 03:37:16 UTC (rev 6529) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2008年12月09日 03:49:11 UTC (rev 6530) @@ -2749,7 +2749,8 @@ 'ps' : MathtextBackendPs, 'pdf' : MathtextBackendPdf, 'svg' : MathtextBackendSvg, - 'cairo' : MathtextBackendCairo + 'cairo' : MathtextBackendCairo, + 'macosx': MathtextBackendAgg, } _font_type_mapping = { Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/rcsetup.py 2008年12月09日 03:37:16 UTC (rev 6529) +++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2008年12月09日 03:49:11 UTC (rev 6530) @@ -23,8 +23,8 @@ # The capitalized forms are needed for ipython at present; this may # change for later versions. -interactive_bk = ['GTK', 'GTKAgg', 'GTKCairo', 'FltkAgg', 'QtAgg', 'Qt4Agg', - 'TkAgg', 'WX', 'WXAgg', 'CocoaAgg'] +interactive_bk = ['GTK', 'GTKAgg', 'GTKCairo', 'FltkAgg', 'MacOSX', + 'QtAgg', 'Qt4Agg', 'TkAgg', 'WX', 'WXAgg', 'CocoaAgg'] non_interactive_bk = ['agg', 'cairo', 'emf', 'gdk', Modified: trunk/matplotlib/matplotlibrc.template =================================================================== --- trunk/matplotlib/matplotlibrc.template 2008年12月09日 03:37:16 UTC (rev 6529) +++ trunk/matplotlib/matplotlibrc.template 2008年12月09日 03:49:11 UTC (rev 6530) @@ -24,9 +24,9 @@ #### CONFIGURATION BEGINS HERE # the default backend; one of GTK GTKAgg GTKCairo CocoaAgg FltkAgg -# QtAgg Qt4Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG Template You -# can also deploy your own backend outside of matplotlib by referring -# to the module name (which must be in the PYTHONPATH) as +# MacOSX QtAgg Qt4Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG Template +# You can also deploy your own backend outside of matplotlib by +# referring to the module name (which must be in the PYTHONPATH) as # 'module://my_backend' backend : %(backend)s Modified: trunk/matplotlib/setup.cfg.template =================================================================== --- trunk/matplotlib/setup.cfg.template 2008年12月09日 03:37:16 UTC (rev 6529) +++ trunk/matplotlib/setup.cfg.template 2008年12月09日 03:49:11 UTC (rev 6530) @@ -32,9 +32,9 @@ [gui_support] # Matplotlib supports multiple GUI toolkits, including Cocoa, -# GTK, Fltk, Qt, Qt4, Tk, and WX. Support for many of these -# toolkits requires AGG, the Anti-Grain Geometry library, which -# is provided by matplotlib and built by default. +# GTK, Fltk, MacOSX, Qt, Qt4, Tk, and WX. Support for many of +# these toolkits requires AGG, the Anti-Grain Geometry library, +# which is provided by matplotlib and built by default. # # Some backends are written in pure Python, and others require # extension code to be compiled. By default, matplotlib checks @@ -59,16 +59,17 @@ #gtkagg = False #tkagg = False #wxagg = False +#macosx = False [rc_options] # User-configurable options # -# Default backend, one of: Agg, Cairo, CocoaAgg, GTK, GTKAgg, -# GTKCairo, FltkAgg, Pdf, Ps, QtAgg, Qt4Agg, SVG, TkAgg, WX, WXAgg. +# Default backend, one of: Agg, Cairo, CocoaAgg, GTK, GTKAgg, GTKCairo, +# FltkAgg, MacOSX, Pdf, Ps, QtAgg, Qt4Agg, SVG, TkAgg, WX, WXAgg. # # The Agg, Ps, Pdf and SVG backends do not require external -# dependencies. Do not choose GTK, GTKAgg, GTKCairo, TkAgg or WXAgg if -# you have disabled the relevent extension modules. Agg will be used +# dependencies. Do not choose GTK, GTKAgg, GTKCairo, MacOSX, TkAgg or WXAgg +# if you have disabled the relevent extension modules. Agg will be used # by default. # #backend = Agg Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2008年12月09日 03:37:16 UTC (rev 6529) +++ trunk/matplotlib/setup.py 2008年12月09日 03:49:11 UTC (rev 6530) @@ -26,15 +26,15 @@ import glob from distutils.core import setup from setupext import build_agg, build_gtkagg, build_tkagg, build_wxagg,\ - build_ft2font, build_image, build_windowing, build_path, \ + build_macosx, build_ft2font, build_image, build_windowing, build_path, \ build_contour, build_delaunay, build_nxutils, build_traits, build_gdk, \ build_ttconv, print_line, print_status, print_message, \ print_raw, check_for_freetype, check_for_libpng, check_for_gtk, \ - check_for_tk, check_for_wx, check_for_numpy, check_for_qt, check_for_qt4, \ - check_for_cairo, check_provide_traits, check_provide_pytz, \ - check_provide_dateutil, check_provide_configobj, check_for_dvipng, \ - check_for_ghostscript, check_for_latex, check_for_pdftops, \ - check_for_datetime, options, build_png + check_for_tk, check_for_wx, check_for_macosx, check_for_numpy, \ + check_for_qt, check_for_qt4, check_for_cairo, check_provide_traits, \ + check_provide_pytz, check_provide_dateutil, check_provide_configobj, \ + check_for_dvipng, check_for_ghostscript, check_for_latex, \ + check_for_pdftops, check_for_datetime, options, build_png #import distutils.sysconfig # jdh @@ -149,6 +149,11 @@ build_gtkagg(ext_modules, packages) rc['backend'] = 'GTKAgg' +if options['build_macosx']: + if check_for_macosx() or (options['build_macosx'] is True): + build_macosx(ext_modules, packages) + rc['backend'] = 'MacOSX' + # These are informational only. We don't build any extensions for them. check_for_qt() check_for_qt4() Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2008年12月09日 03:37:16 UTC (rev 6529) +++ trunk/matplotlib/setupext.py 2008年12月09日 03:49:11 UTC (rev 6530) @@ -76,6 +76,7 @@ BUILT_TTCONV = False BUILT_GTKAGG = False BUILT_IMAGE = False +BUILT_MACOSX = False BUILT_TKAGG = False BUILT_WXAGG = False BUILT_WINDOWING = False @@ -105,6 +106,7 @@ 'build_gtkagg': 'auto', 'build_tkagg': 'auto', 'build_wxagg': 'auto', + 'build_macosx': 'auto', 'build_image': True, 'build_windowing': True, 'backend': None, @@ -867,6 +869,17 @@ print_message(explanation) return gotit +def check_for_macosx(): + gotit = False + import sys + if sys.platform=='darwin': + gotit = True + if gotit: + print_status("Mac OS X native", "yes") + else: + print_status("Mac OS X native", "no") + return gotit + def query_tcltk(): """Tries to open a Tk window in order to query the Tk object about its library paths. This should never be called more than once by the same process, as Tk intricacies @@ -1214,6 +1227,19 @@ ext_modules.append(module) BUILT_WXAGG = True + +def build_macosx(ext_modules, packages): + global BUILT_MACOSX + if BUILT_MACOSX: return # only build it if you you haven't already + module = Extension('matplotlib.backends._macosx', + ['src/_macosx.m'], + extra_link_args = ['-framework','Cocoa'], + ) + add_numpy_flags(module) + ext_modules.append(module) + BUILT_MACOSX = True + + def build_png(ext_modules, packages): global BUILT_PNG if BUILT_PNG: return # only build it if you you haven't already This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6529 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6529&view=rev Author: jdh2358 Date: 2008年12月09日 03:37:16 +0000 (2008年12月09日) Log Message: ----------- added missing comma to backend driver list Modified Paths: -------------- trunk/matplotlib/examples/tests/backend_driver.py Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008年12月09日 03:33:57 UTC (rev 6528) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008年12月09日 03:37:16 UTC (rev 6529) @@ -221,7 +221,7 @@ 'quad_bezier.py', 'scatter_piecharts.py', 'span_regions.py', - 'two_scales.py' + 'two_scales.py', 'unicode_minus.py', 'watermark_image.py', 'watermark_text.py', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6528 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6528&view=rev Author: jdh2358 Date: 2008年12月09日 03:33:57 +0000 (2008年12月09日) Log Message: ----------- tweaks to backend driver list Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/tests/backend_driver.py trunk/matplotlib/lib/matplotlib/patches.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年12月09日 03:24:44 UTC (rev 6527) +++ trunk/matplotlib/CHANGELOG 2008年12月09日 03:33:57 UTC (rev 6528) @@ -1,3 +1,6 @@ +2008年12月08日 Removed the prints in the set_*style commands. Return the + list of pprinted strings instead + 2008年12月08日 Some of the changes Michael made to improve the output of the property tables in the rest docs broke of made difficult to use some of the interactive doc helpers, eg Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008年12月09日 03:24:44 UTC (rev 6527) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008年12月09日 03:33:57 UTC (rev 6528) @@ -25,8 +25,8 @@ pylab_dir = os.path.join('..', 'pylab_examples') pylab_files = [ - 'two_scales.py', + 'accented_text.py', 'alignment_test.py', 'annotation_demo.py', @@ -191,10 +191,8 @@ 'unicode_demo.py', 'vertical_ticklabels.py', 'vline_demo.py', - 'webapp_demo.py', 'xcorr_demo.py', 'zorder_demo.py', - ] @@ -202,13 +200,16 @@ api_files = [ 'agg_oo.py', 'barchart_demo.py', + 'bbox_intersect.py', 'collections_demo.py', + 'color_cycle.py', + 'colorbar_only.py', 'custom_projection_example.py', 'custom_scale_example.py', 'date_demo.py', 'date_index_formatter.py', + 'donut_demo.py', 'font_family_rc.py', - 'font_file.py', 'histogram_demo.py', 'image_zcoord.py', 'legend_demo.py', @@ -216,19 +217,14 @@ 'logo2.py', 'mathtext_asarray.py', 'patch_collection.py', + 'path_patch_demo.py', + 'quad_bezier.py', 'scatter_piecharts.py', 'span_regions.py', + 'two_scales.py' 'unicode_minus.py', 'watermark_image.py', 'watermark_text.py', - - 'bbox_intersect.py', - 'colorbar_only.py', - 'color_cycle.py', - 'donut_demo.py', - 'path_patch_demo.py', - 'quad_bezier.py', - 'two_scales.py' ] units_dir = os.path.join('..', 'units') Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2008年12月09日 03:24:44 UTC (rev 6527) +++ trunk/matplotlib/lib/matplotlib/patches.py 2008年12月09日 03:33:57 UTC (rev 6528) @@ -1494,19 +1494,19 @@ :class:`BoxStyle` is a container class which defines several boxstyle classes, which are used for :class:`FancyBoxPatch`. - A style object can be created as + A style object can be created as:: BoxStyle.Round(pad=0.2) - or + or:: BoxStyle("Round", pad=0.2) - or + or:: BoxStyle("Round, pad=0.2") - Following boxstyle classes are defined. + The following boxstyle classes are defined. %(AvailableBoxstyles)s @@ -2026,7 +2026,7 @@ Old attrs simply are forgotten. - Without argument (or with *boxstyle* = None), it prints out + Without argument (or with *boxstyle* = None), it returns available box styles. ACCEPTS: [ %(AvailableBoxstyles)s ] @@ -2034,10 +2034,7 @@ """ if boxstyle==None: - # print out available boxstyles and return. - print "Following box styles are available:" - print BoxStyle.pprint_styles() - return + return BoxStyle.pprint_styles() if isinstance(boxstyle, BoxStyle._Base): self._bbox_transmuter = boxstyle @@ -2097,7 +2094,7 @@ return _path - # Followong methods are borrowed from the Rectangle class. + # Following methods are borrowed from the Rectangle class. def get_x(self): "Return the left coord of the rectangle" @@ -2183,19 +2180,19 @@ between two points. These are mainly used with :class:`FancyArrowPatch`. - A connectionstyle object can be either created as + A connectionstyle object can be either created as:: ConnectionStyle.Arc3(rad=0.2) - or + or:: ConnectionStyle("Arc3", rad=0.2) - or + or:: ConnectionStyle("Arc3, rad=0.2") - Following classes are defined + The following classes are defined %(AvailableConnectorstyles)s @@ -2205,11 +2202,13 @@ __call__(self, posA, posB, patchA=None, patchB=None, shrinkA=2., shrinkB=2.) - and it returns a :class:`Path` instance. *posA* and *posB are tuples - of x,y coordinates of the two points to be connected. *patchA* (or - $patchB*) is given, the returned path is clipped so that it start - (or end) from the boundary of the patch. The path is further - shrinked by *shrinkA* (or *shrinkB*) which is given in points. + and it returns a :class:`Path` instance. *posA* and *posB* are + tuples of x,y coordinates of the two points to be + connected. *patchA* (or *patchB*) is given, the returned path is + clipped so that it start (or end) from the boundary of the + patch. The path is further shrunk by *shrinkA* (or *shrinkB*) + which is given in points. + """ _style_list = {} @@ -2547,18 +2546,18 @@ arrowstyle classes, which is used to create an arrow path along a given path. These are mainly used with :class:`FancyArrowPatch`. - A arrowstyle object can be either created as + A arrowstyle object can be either created as:: ArrowStyle.Fancy(head_length=.4, head_width=.4, tail_width=.4) - or + or:: ArrowStyle("Fancy", head_length=.4, head_width=.4, tail_width=.4) - or + or:: ArrowStyle("Fancy, head_length=.4, head_width=.4, tail_width=.4") - Following classes are defined + The following classes are defined %(AvailableArrowstyles)s @@ -3232,7 +3231,7 @@ connected. It can be an instance of the ConnectionStyle class (matplotlib.patches.ConnectionStlye) or a string of the connectionstyle name, with optional comma-separated - attributes. Following connection styles are available. + attributes. The following connection styles are available. %(AvailableConnectorstyles)s @@ -3241,7 +3240,7 @@ drawn. It can be string of the available arrowstyle names, with optional comma-separated attributes, or one of the ArrowStyle instance. The optional attributes are meant to be - scaled with the *mutation_scale*. Following arrow styles are + scaled with the *mutation_scale*. The following arrow styles are available. %(AvailableArrowstyles)s @@ -3334,14 +3333,12 @@ Old attrs simply are forgotten. - Without argument (or with connectionstyle=None), it prints out - available styles. + Without argument (or with connectionstyle=None), return + available styles as a list of strings. """ if connectionstyle==None: - # print out available styles and return. - print "Following styles are available:" - print ConnectionStyle.pprint_styles() + return ConnectionStyle.pprint_styles() if isinstance(connectionstyle, ConnectionStyle._Base): self._connector = connectionstyle @@ -3372,14 +3369,12 @@ Old attrs simply are forgotten. - Without argument (or with arrowstyle=None), it prints out - available box styles. + Without argument (or with arrowstyle=None), return + available box styles as a list of strings. """ if arrowstyle==None: - # print out available styles and return. - print "Following styles are available:" - print ArrowStyle.pprint_styles() + return ArrowStyle.pprint_styles() if isinstance(arrowstyle, ConnectionStyle._Base): self._arrow_transmuter = arrowstyle This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6527 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6527&view=rev Author: jdh2358 Date: 2008年12月09日 03:24:44 +0000 (2008年12月09日) Log Message: ----------- added more examples to backend driver Modified Paths: -------------- trunk/matplotlib/examples/api/watermark_image.py trunk/matplotlib/examples/api/watermark_text.py trunk/matplotlib/examples/pylab_examples/annotation_demo.py trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py trunk/matplotlib/examples/pylab_examples/manual_axis.py trunk/matplotlib/examples/tests/backend_driver.py Modified: trunk/matplotlib/examples/api/watermark_image.py =================================================================== --- trunk/matplotlib/examples/api/watermark_image.py 2008年12月08日 23:28:55 UTC (rev 6526) +++ trunk/matplotlib/examples/api/watermark_image.py 2008年12月09日 03:24:44 UTC (rev 6527) @@ -18,5 +18,6 @@ ax.grid() fig.figimage(im, 10, 10) -fig.savefig('watermarked', transparent=True) +#fig.savefig('watermarked', transparent=True) +plt.show() Modified: trunk/matplotlib/examples/api/watermark_text.py =================================================================== --- trunk/matplotlib/examples/api/watermark_text.py 2008年12月08日 23:28:55 UTC (rev 6526) +++ trunk/matplotlib/examples/api/watermark_text.py 2008年12月09日 03:24:44 UTC (rev 6527) @@ -2,8 +2,8 @@ Use a Text as a watermark """ import numpy as np -import matplotlib -matplotlib.use('Agg') +#import matplotlib +#matplotlib.use('Agg') import matplotlib.pyplot as plt @@ -18,5 +18,7 @@ fontsize=50, color='gray', ha='right', va='bottom', alpha=0.5) -fig.savefig('watermarked_text', transparent=True) +#fig.savefig('watermarked_text', transparent=True) + +plt.show() Modified: trunk/matplotlib/examples/pylab_examples/annotation_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/annotation_demo.py 2008年12月08日 23:28:55 UTC (rev 6526) +++ trunk/matplotlib/examples/pylab_examples/annotation_demo.py 2008年12月09日 03:24:44 UTC (rev 6527) @@ -82,7 +82,7 @@ horizontalalignment='right', verticalalignment='bottom', fontsize=20) - fig.savefig('annotation_coords') + #fig.savefig('annotation_coords') if 1: # you can specify the xypoint and the xytext in different @@ -111,7 +111,7 @@ horizontalalignment='left', verticalalignment='bottom', ) - fig.savefig('annotation_polar') + #fig.savefig('annotation_polar') if 1: # You can also use polar notation on a catesian axes. Here the @@ -138,7 +138,7 @@ ax.set_xlim(-20, 20) ax.set_ylim(-20, 20) - fig.savefig('annotation_ellipse') + #fig.savefig('annotation_ellipse') Modified: trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py 2008年12月08日 23:28:55 UTC (rev 6526) +++ trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py 2008年12月09日 03:24:44 UTC (rev 6527) @@ -89,5 +89,4 @@ n, bins, patches = P.hist( [x0,x1,x2], 10, histtype='bar') - -P.show() \ No newline at end of file +P.show() Modified: trunk/matplotlib/examples/pylab_examples/manual_axis.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/manual_axis.py 2008年12月08日 23:28:55 UTC (rev 6526) +++ trunk/matplotlib/examples/pylab_examples/manual_axis.py 2008年12月09日 03:24:44 UTC (rev 6527) @@ -52,6 +52,6 @@ ax.set_ylim(-1.5, 1.5) make_xaxis(ax, 0, offset=0.1, **props) make_yaxis(ax, 0, offset=5, **props) -fig.savefig('manual_axis.png', dpi=100, facecolor='white', edgecolor='white') +#fig.savefig('manual_axis.png', dpi=100, facecolor='white', edgecolor='white') show() Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008年12月08日 23:28:55 UTC (rev 6526) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008年12月09日 03:24:44 UTC (rev 6527) @@ -25,85 +25,154 @@ pylab_dir = os.path.join('..', 'pylab_examples') pylab_files = [ + 'two_scales.py', + + 'accented_text.py', 'alignment_test.py', + 'annotation_demo.py', + 'annotation_demo.py', + 'annotation_demo2.py', + 'annotation_demo2.py', + 'anscombe.py', 'arctest.py', 'arrow_demo.py', - #'auto_layout.py', 'axes_demo.py', + 'axes_props.py', 'axhspan_demo.py', + 'axis_equal_demo.py', 'bar_stacked.py', + 'barb_demo.py', 'barchart_demo.py', - 'barb_demo.py', 'barcode_demo.py', + 'barh_demo.py', 'boxplot_demo.py', 'broken_barh.py', - 'barh_demo.py', + 'clippedline.py', + 'cohere_demo.py', + 'color_by_yvalue.py', 'color_demo.py', - 'cohere_demo.py', + 'colorbar_tick_labelling_demo.py', 'contour_demo.py', + 'contour_image.py', 'contour_label_demo.py', 'contourf_demo.py', + 'contourf_log.py', + 'coords_demo.py', + 'coords_report.py', + 'csd_demo.py', + 'cursor_demo.py', 'custom_cmap.py', - 'geo_demo.py', - 'griddata_demo.py', - 'csd_demo.py', + 'custom_figure_class.py', 'custom_ticker1.py', 'customize_rc.py', + 'dash_control.py', + 'dashpointlabel.py', 'date_demo1.py', 'date_demo2.py', + 'date_demo_convert.py', + 'date_demo_rrule.py', + 'date_index_formatter.py', + 'dolphin.py', 'ellipse_collection.py', + 'ellipse_demo.py', + 'ellipse_rotated.py', 'equal_aspect_ratio.py', + 'errorbar_demo.py', 'errorbar_limits.py', + 'fancyarrow_demo.py', 'fancybox_demo.py', + 'fancybox_demo2.py', 'fancytextbox_demo.py', 'figimage_demo.py', 'figlegend_demo.py', 'figure_title.py', + 'fill_between.py', 'fill_demo.py', + 'fill_demo2.py', + 'fill_spiral.py', 'finance_demo.py', + 'findobj_demo.py', + 'fonts_demo.py', 'fonts_demo_kw.py', + 'ganged_plots.py', + 'geo_demo.py', + 'gradient_bar.py', + 'griddata_demo.py', + 'hatch_demo.py', 'hexbin_demo.py', 'hexbin_demo2.py', + 'hist_colormapped.py', 'histogram_demo.py', + 'histogram_demo_extended.py', 'hline_demo.py', + + 'image_clip_path.py', 'image_demo.py', 'image_demo2.py', + 'image_demo3.py', + 'image_interp.py', 'image_masked.py', + 'image_nonuniform.py', 'image_origin.py', - 'image_nonuniform.py', + 'image_slices_viewer.py', + 'integral_demo.py', + 'interp_demo.py', 'invert_axes.py', 'layer_images.py', 'legend_auto.py', 'legend_demo.py', 'legend_demo2.py', + 'legend_demo3.py', + 'legend_demo3.py', + 'legend_scatter.py', 'line_collection.py', 'line_collection2.py', 'line_styles.py', + 'log_bar.py', 'log_demo.py', 'log_test.py', 'major_minor_demo1.py', 'major_minor_demo2.py', + 'manual_axis.py', 'masked_demo.py', 'mathtext_demo.py', + 'mathtext_examples.py', + 'matplotlib_icon.py', + 'matshow.py', + 'mri_demo.py', 'mri_with_eeg.py', + 'multi_image.py', + 'multiline.py', 'multiple_figs_demo.py', - 'multi_image.py', 'nan_test.py', + 'newscalarformatter_demo.py', 'pcolor_demo.py', 'pcolor_demo2.py', + 'pcolor_log.py', 'pcolor_small.py', 'pie_demo.py', + 'plotfile_demo.py', + 'polar_bar.py', 'polar_demo.py', + 'polar_legend.py', 'polar_scatter.py', + 'poormans_contour.py', 'psd_demo.py', + 'psd_demo2.py', + 'psd_demo3.py', 'quadmesh_demo.py', 'quiver_demo.py', + 'scatter_custom_symbol.py', 'scatter_demo.py', 'scatter_demo2.py', + 'scatter_masked.py', + 'scatter_profile.py', 'scatter_star_poly.py', + 'set_and_get.py', + 'shared_axis_across_figures.py', 'shared_axis_demo.py', - 'shared_axis_across_figures.py', 'simple_plot.py', + 'simplification_clipping_test.py', 'specgram_demo.py', 'spy_demos.py', 'stem_plot.py', @@ -111,23 +180,48 @@ 'stix_fonts_demo.py', 'stock_demo.py', 'subplot_demo.py', + 'subplots_adjust.py', 'symlog_demo.py', - # 'set_and_get.py', 'table_demo.py', 'text_handles.py', 'text_rotation.py', + 'text_rotation_relative_to_line.py', 'text_themes.py', -# 'tex_demo.py', -# 'two_scales.py', + 'transoffset.py', 'unicode_demo.py', + 'vertical_ticklabels.py', 'vline_demo.py', + 'webapp_demo.py', 'xcorr_demo.py', 'zorder_demo.py', + ] api_dir = os.path.join('..', 'api') api_files = [ + 'agg_oo.py', + 'barchart_demo.py', + 'collections_demo.py', + 'custom_projection_example.py', + 'custom_scale_example.py', + 'date_demo.py', + 'date_index_formatter.py', + 'font_family_rc.py', + 'font_file.py', + 'histogram_demo.py', + 'image_zcoord.py', + 'legend_demo.py', + 'line_with_text.py', + 'logo2.py', + 'mathtext_asarray.py', + 'patch_collection.py', + 'scatter_piecharts.py', + 'span_regions.py', + 'unicode_minus.py', + 'watermark_image.py', + 'watermark_text.py', + 'bbox_intersect.py', 'colorbar_only.py', 'color_cycle.py', @@ -178,17 +272,23 @@ report_missing(api_dir, api_files) report_missing(units_dir, units_files) -files = [os.path.join(pylab_dir, fname) for fname in pylab_files] +\ - [os.path.join(api_dir, fname) for fname in api_files] +\ +files = ( + [os.path.join(api_dir, fname) for fname in api_files] + + [os.path.join(pylab_dir, fname) for fname in pylab_files] + [os.path.join(units_dir, fname) for fname in units_files] + ) # tests known to fail on a given backend failbackend = dict( - SVG = ('tex_demo.py,'), + svg = ('tex_demo.py', ), + agg = ('hyperlinks.py', ), + pdf = ('hyperlinks.py', ), + ps = ('hyperlinks.py', ), ) + try: import subprocess def run(arglist): @@ -256,7 +356,7 @@ if backend in rcsetup.interactive_bk: tmpfile.write('show()') else: - tmpfile.write('savefig("%s", dpi=150)' % outfile) + tmpfile.write('\nsavefig("%s", dpi=150)' % outfile) tmpfile.close() start_time = time.time() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.